From 1310f9446fc01e7de206a3e91485769526a77fb4 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 20 Aug 2025 03:12:54 +1200 Subject: [PATCH 01/22] Add 1.8.x support --- README.md | 6 +- analysis_options.yaml | 1 + docs/examples/databases/create.md | 1 + docs/examples/functions/create-execution.md | 2 +- .../tablesdb/create-boolean-column.md | 17 + .../tablesdb/create-datetime-column.md | 17 + docs/examples/tablesdb/create-email-column.md | 17 + docs/examples/tablesdb/create-enum-column.md | 18 + docs/examples/tablesdb/create-float-column.md | 19 + docs/examples/tablesdb/create-index.md | 18 + .../tablesdb/create-integer-column.md | 19 + docs/examples/tablesdb/create-ip-column.md | 17 + .../tablesdb/create-relationship-column.md | 19 + docs/examples/tablesdb/create-row.md | 16 + docs/examples/tablesdb/create-rows.md | 14 + .../examples/tablesdb/create-string-column.md | 19 + docs/examples/tablesdb/create-table.md | 17 + docs/examples/tablesdb/create-url-column.md | 17 + docs/examples/tablesdb/create.md | 15 + .../examples/tablesdb/decrement-row-column.md | 17 + docs/examples/tablesdb/delete-column.md | 14 + docs/examples/tablesdb/delete-index.md | 14 + docs/examples/tablesdb/delete-row.md | 14 + docs/examples/tablesdb/delete-rows.md | 14 + docs/examples/tablesdb/delete-table.md | 13 + docs/examples/tablesdb/delete.md | 12 + docs/examples/tablesdb/get-column.md | 14 + docs/examples/tablesdb/get-index.md | 14 + docs/examples/tablesdb/get-row.md | 15 + docs/examples/tablesdb/get-table.md | 13 + docs/examples/tablesdb/get.md | 12 + .../examples/tablesdb/increment-row-column.md | 17 + docs/examples/tablesdb/list-columns.md | 14 + docs/examples/tablesdb/list-indexes.md | 14 + docs/examples/tablesdb/list-rows.md | 14 + docs/examples/tablesdb/list-tables.md | 14 + docs/examples/tablesdb/list.md | 13 + .../tablesdb/update-boolean-column.md | 17 + .../tablesdb/update-datetime-column.md | 17 + docs/examples/tablesdb/update-email-column.md | 17 + docs/examples/tablesdb/update-enum-column.md | 18 + docs/examples/tablesdb/update-float-column.md | 19 + .../tablesdb/update-integer-column.md | 19 + docs/examples/tablesdb/update-ip-column.md | 17 + .../tablesdb/update-relationship-column.md | 16 + docs/examples/tablesdb/update-row.md | 16 + docs/examples/tablesdb/update-rows.md | 15 + .../examples/tablesdb/update-string-column.md | 18 + docs/examples/tablesdb/update-table.md | 17 + docs/examples/tablesdb/update-url-column.md | 17 + docs/examples/tablesdb/update.md | 14 + docs/examples/tablesdb/upsert-row.md | 16 + docs/examples/tablesdb/upsert-rows.md | 14 + example/README.md | 62 - lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/dart_appwrite.dart | 3 +- lib/enums.dart | 1 + lib/id.dart | 3 +- lib/models.dart | 17 + lib/query.dart | 90 +- lib/role.dart | 106 +- lib/services/account.dart | 2161 +++++++------ lib/services/avatars.dart | 434 ++- lib/services/databases.dart | 2761 ++++++++--------- lib/services/functions.dart | 1385 ++++----- lib/services/graphql.dart | 90 +- lib/services/health.dart | 683 ++-- lib/services/locale.dart | 246 +- lib/services/messaging.dart | 2628 +++++++--------- lib/services/sites.dart | 1282 ++++---- lib/services/storage.dart | 744 ++--- lib/services/tables-db.dart | 1163 +++++++ lib/services/teams.dart | 671 ++-- lib/services/tokens.dart | 216 +- lib/services/users.dart | 2063 ++++++------ lib/src/client.dart | 15 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 125 +- lib/src/client_io.dart | 145 +- lib/src/client_mixin.dart | 64 +- lib/src/client_stub.dart | 3 +- lib/src/enums.dart | 4 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 +-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/type.dart | 14 + lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 71 + lib/src/models/column_datetime.dart | 77 + lib/src/models/column_email.dart | 77 + lib/src/models/column_enum.dart | 83 + lib/src/models/column_float.dart | 83 + lib/src/models/column_index.dart | 77 + lib/src/models/column_index_list.dart | 29 + lib/src/models/column_integer.dart | 83 + lib/src/models/column_ip.dart | 77 + lib/src/models/column_list.dart | 29 + lib/src/models/column_relationship.dart | 101 + lib/src/models/column_string.dart | 83 + lib/src/models/column_url.dart | 77 + lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 90 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 232 +- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 +-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 116 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 66 + lib/src/models/row_list.dart | 32 + lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 +-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 +-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 77 + lib/src/models/table_list.dart | 29 + lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- lib/src/upload_progress.dart | 2 +- pubspec.yaml | 4 +- test/query_test.dart | 129 +- test/services/databases_test.dart | 23 +- test/services/tables-db_test.dart | 1232 ++++++++ test/src/enums_test.dart | 6 +- test/src/exception_test.dart | 9 +- test/src/input_file_test.dart | 3 +- test/src/models/algo_argon2_test.dart | 1 - test/src/models/algo_bcrypt_test.dart | 1 - test/src/models/algo_md5_test.dart | 1 - test/src/models/algo_phpass_test.dart | 1 - .../src/models/algo_scrypt_modified_test.dart | 1 - test/src/models/algo_scrypt_test.dart | 1 - test/src/models/algo_sha_test.dart | 1 - test/src/models/attribute_boolean_test.dart | 1 - test/src/models/attribute_datetime_test.dart | 1 - test/src/models/attribute_email_test.dart | 1 - test/src/models/attribute_enum_test.dart | 1 - test/src/models/attribute_float_test.dart | 1 - test/src/models/attribute_integer_test.dart | 1 - test/src/models/attribute_ip_test.dart | 1 - test/src/models/attribute_list_test.dart | 1 - .../models/attribute_relationship_test.dart | 1 - test/src/models/attribute_string_test.dart | 1 - test/src/models/attribute_url_test.dart | 1 - test/src/models/bucket_list_test.dart | 1 - test/src/models/bucket_test.dart | 1 - test/src/models/collection_list_test.dart | 1 - test/src/models/collection_test.dart | 1 - test/src/models/column_boolean_test.dart | 29 + test/src/models/column_datetime_test.dart | 31 + test/src/models/column_email_test.dart | 31 + test/src/models/column_enum_test.dart | 33 + test/src/models/column_float_test.dart | 29 + test/src/models/column_index_list_test.dart | 19 + test/src/models/column_index_test.dart | 33 + test/src/models/column_integer_test.dart | 29 + test/src/models/column_ip_test.dart | 31 + test/src/models/column_list_test.dart | 19 + test/src/models/column_relationship_test.dart | 41 + test/src/models/column_string_test.dart | 31 + test/src/models/column_url_test.dart | 31 + test/src/models/continent_list_test.dart | 1 - test/src/models/continent_test.dart | 1 - test/src/models/country_list_test.dart | 1 - test/src/models/country_test.dart | 1 - test/src/models/currency_list_test.dart | 1 - test/src/models/currency_test.dart | 1 - test/src/models/database_list_test.dart | 1 - test/src/models/database_test.dart | 3 +- test/src/models/deployment_list_test.dart | 1 - test/src/models/deployment_test.dart | 1 - test/src/models/document_list_test.dart | 1 - test/src/models/document_test.dart | 1 - test/src/models/execution_list_test.dart | 1 - test/src/models/execution_test.dart | 1 - test/src/models/file_list_test.dart | 1 - test/src/models/file_test.dart | 1 - test/src/models/framework_adapter_test.dart | 1 - test/src/models/framework_list_test.dart | 1 - test/src/models/framework_test.dart | 1 - test/src/models/function_list_test.dart | 1 - test/src/models/function_test.dart | 1 - test/src/models/headers_test.dart | 1 - test/src/models/health_antivirus_test.dart | 1 - test/src/models/health_certificate_test.dart | 1 - test/src/models/health_queue_test.dart | 1 - test/src/models/health_status_test.dart | 1 - test/src/models/health_time_test.dart | 1 - test/src/models/identity_list_test.dart | 1 - test/src/models/identity_test.dart | 1 - test/src/models/index_list_test.dart | 1 - test/src/models/index_test.dart | 11 +- test/src/models/jwt_test.dart | 1 - test/src/models/language_list_test.dart | 1 - test/src/models/language_test.dart | 1 - test/src/models/locale_code_list_test.dart | 1 - test/src/models/locale_code_test.dart | 1 - test/src/models/locale_test.dart | 1 - test/src/models/log_list_test.dart | 1 - test/src/models/log_test.dart | 1 - test/src/models/membership_list_test.dart | 1 - test/src/models/membership_test.dart | 1 - test/src/models/message_list_test.dart | 1 - test/src/models/message_test.dart | 1 - test/src/models/mfa_challenge_test.dart | 1 - test/src/models/mfa_factors_test.dart | 1 - test/src/models/mfa_recovery_codes_test.dart | 1 - test/src/models/mfa_type_test.dart | 1 - test/src/models/phone_list_test.dart | 1 - test/src/models/phone_test.dart | 1 - test/src/models/preferences_test.dart | 1 - test/src/models/provider_list_test.dart | 1 - test/src/models/provider_test.dart | 1 - test/src/models/resource_token_list_test.dart | 1 - test/src/models/resource_token_test.dart | 1 - test/src/models/row_list_test.dart | 19 + test/src/models/row_test.dart | 30 + test/src/models/runtime_list_test.dart | 1 - test/src/models/runtime_test.dart | 1 - test/src/models/session_list_test.dart | 1 - test/src/models/session_test.dart | 1 - test/src/models/site_list_test.dart | 1 - test/src/models/site_test.dart | 1 - test/src/models/specification_list_test.dart | 1 - test/src/models/specification_test.dart | 1 - test/src/models/subscriber_list_test.dart | 1 - test/src/models/subscriber_test.dart | 1 - test/src/models/table_list_test.dart | 19 + test/src/models/table_test.dart | 35 + test/src/models/target_list_test.dart | 1 - test/src/models/target_test.dart | 1 - test/src/models/team_list_test.dart | 1 - test/src/models/team_test.dart | 1 - test/src/models/token_test.dart | 1 - test/src/models/topic_list_test.dart | 1 - test/src/models/topic_test.dart | 1 - test/src/models/user_list_test.dart | 1 - test/src/models/user_test.dart | 1 - test/src/models/variable_list_test.dart | 1 - test/src/models/variable_test.dart | 1 - test/src/response_test.dart | 2 +- 347 files changed, 17196 insertions(+), 13398 deletions(-) create mode 100644 analysis_options.yaml create mode 100644 docs/examples/tablesdb/create-boolean-column.md create mode 100644 docs/examples/tablesdb/create-datetime-column.md create mode 100644 docs/examples/tablesdb/create-email-column.md create mode 100644 docs/examples/tablesdb/create-enum-column.md create mode 100644 docs/examples/tablesdb/create-float-column.md create mode 100644 docs/examples/tablesdb/create-index.md create mode 100644 docs/examples/tablesdb/create-integer-column.md create mode 100644 docs/examples/tablesdb/create-ip-column.md create mode 100644 docs/examples/tablesdb/create-relationship-column.md create mode 100644 docs/examples/tablesdb/create-row.md create mode 100644 docs/examples/tablesdb/create-rows.md create mode 100644 docs/examples/tablesdb/create-string-column.md create mode 100644 docs/examples/tablesdb/create-table.md create mode 100644 docs/examples/tablesdb/create-url-column.md create mode 100644 docs/examples/tablesdb/create.md create mode 100644 docs/examples/tablesdb/decrement-row-column.md create mode 100644 docs/examples/tablesdb/delete-column.md create mode 100644 docs/examples/tablesdb/delete-index.md create mode 100644 docs/examples/tablesdb/delete-row.md create mode 100644 docs/examples/tablesdb/delete-rows.md create mode 100644 docs/examples/tablesdb/delete-table.md create mode 100644 docs/examples/tablesdb/delete.md create mode 100644 docs/examples/tablesdb/get-column.md create mode 100644 docs/examples/tablesdb/get-index.md create mode 100644 docs/examples/tablesdb/get-row.md create mode 100644 docs/examples/tablesdb/get-table.md create mode 100644 docs/examples/tablesdb/get.md create mode 100644 docs/examples/tablesdb/increment-row-column.md create mode 100644 docs/examples/tablesdb/list-columns.md create mode 100644 docs/examples/tablesdb/list-indexes.md create mode 100644 docs/examples/tablesdb/list-rows.md create mode 100644 docs/examples/tablesdb/list-tables.md create mode 100644 docs/examples/tablesdb/list.md create mode 100644 docs/examples/tablesdb/update-boolean-column.md create mode 100644 docs/examples/tablesdb/update-datetime-column.md create mode 100644 docs/examples/tablesdb/update-email-column.md create mode 100644 docs/examples/tablesdb/update-enum-column.md create mode 100644 docs/examples/tablesdb/update-float-column.md create mode 100644 docs/examples/tablesdb/update-integer-column.md create mode 100644 docs/examples/tablesdb/update-ip-column.md create mode 100644 docs/examples/tablesdb/update-relationship-column.md create mode 100644 docs/examples/tablesdb/update-row.md create mode 100644 docs/examples/tablesdb/update-rows.md create mode 100644 docs/examples/tablesdb/update-string-column.md create mode 100644 docs/examples/tablesdb/update-table.md create mode 100644 docs/examples/tablesdb/update-url-column.md create mode 100644 docs/examples/tablesdb/update.md create mode 100644 docs/examples/tablesdb/upsert-row.md create mode 100644 docs/examples/tablesdb/upsert-rows.md create mode 100644 lib/services/tables-db.dart create mode 100644 lib/src/enums/type.dart create mode 100644 lib/src/models/column_boolean.dart create mode 100644 lib/src/models/column_datetime.dart create mode 100644 lib/src/models/column_email.dart create mode 100644 lib/src/models/column_enum.dart create mode 100644 lib/src/models/column_float.dart create mode 100644 lib/src/models/column_index.dart create mode 100644 lib/src/models/column_index_list.dart create mode 100644 lib/src/models/column_integer.dart create mode 100644 lib/src/models/column_ip.dart create mode 100644 lib/src/models/column_list.dart create mode 100644 lib/src/models/column_relationship.dart create mode 100644 lib/src/models/column_string.dart create mode 100644 lib/src/models/column_url.dart create mode 100644 lib/src/models/row.dart create mode 100644 lib/src/models/row_list.dart create mode 100644 lib/src/models/table.dart create mode 100644 lib/src/models/table_list.dart create mode 100644 test/services/tables-db_test.dart create mode 100644 test/src/models/column_boolean_test.dart create mode 100644 test/src/models/column_datetime_test.dart create mode 100644 test/src/models/column_email_test.dart create mode 100644 test/src/models/column_enum_test.dart create mode 100644 test/src/models/column_float_test.dart create mode 100644 test/src/models/column_index_list_test.dart create mode 100644 test/src/models/column_index_test.dart create mode 100644 test/src/models/column_integer_test.dart create mode 100644 test/src/models/column_ip_test.dart create mode 100644 test/src/models/column_list_test.dart create mode 100644 test/src/models/column_relationship_test.dart create mode 100644 test/src/models/column_string_test.dart create mode 100644 test/src/models/column_url_test.dart create mode 100644 test/src/models/row_list_test.dart create mode 100644 test/src/models/row_test.dart create mode 100644 test/src/models/table_list_test.dart create mode 100644 test/src/models/table_test.dart diff --git a/README.md b/README.md index b71f7cf8..bebfe6d2 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,12 @@ [![pub package](https://img.shields.io/pub/v/dart_appwrite.svg?style=flat-square)](https://pub.dartlang.org/packages/dart_appwrite) ![License](https://img.shields.io/github/license/appwrite/sdk-for-dart.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.7.x-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.8.x-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![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.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-dart/releases).** +**This SDK is compatible with Appwrite server version 1.8.x. 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) @@ -23,7 +23,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - dart_appwrite: ^16.2.0 + dart_appwrite: ^17.0.0 ``` You can install packages from the command line: diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 00000000..ea2c9e94 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1 @@ +include: package:lints/recommended.yaml \ No newline at end of file diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index a2e978bd..79b8af6e 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -11,4 +11,5 @@ Database result = await databases.create( databaseId: '', name: '', enabled: false, // (optional) + type: .tablesdb, // (optional) ); diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index 2ae64bce..64b28d5f 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -14,5 +14,5 @@ Execution result = await functions.createExecution( path: '', // (optional) method: ExecutionMethod.gET, // (optional) headers: {}, // (optional) - scheduledAt: '', // (optional) + scheduledAt: '', // (optional) ); diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md new file mode 100644 index 00000000..7faac9e0 --- /dev/null +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -0,0 +1,17 @@ +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); + +ColumnBoolean result = await tablesDb.createBooleanColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + xdefault: false, // (optional) + array: false, // (optional) +); diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md new file mode 100644 index 00000000..9519db81 --- /dev/null +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -0,0 +1,17 @@ +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); + +ColumnDatetime result = await tablesDb.createDatetimeColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + xdefault: '', // (optional) + array: false, // (optional) +); diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md new file mode 100644 index 00000000..6ce8ed37 --- /dev/null +++ b/docs/examples/tablesdb/create-email-column.md @@ -0,0 +1,17 @@ +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); + +ColumnEmail result = await tablesDb.createEmailColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + xdefault: 'email@example.com', // (optional) + array: false, // (optional) +); diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md new file mode 100644 index 00000000..9584d81f --- /dev/null +++ b/docs/examples/tablesdb/create-enum-column.md @@ -0,0 +1,18 @@ +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); + +ColumnEnum result = await tablesDb.createEnumColumn( + databaseId: '', + tableId: '', + key: '', + elements: [], + xrequired: false, + xdefault: '', // (optional) + array: false, // (optional) +); diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md new file mode 100644 index 00000000..6092f584 --- /dev/null +++ b/docs/examples/tablesdb/create-float-column.md @@ -0,0 +1,19 @@ +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); + +ColumnFloat result = await tablesDb.createFloatColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + min: 0, // (optional) + max: 0, // (optional) + xdefault: 0, // (optional) + array: false, // (optional) +); diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md new file mode 100644 index 00000000..01466398 --- /dev/null +++ b/docs/examples/tablesdb/create-index.md @@ -0,0 +1,18 @@ +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); + +ColumnIndex result = await tablesDb.createIndex( + databaseId: '', + tableId: '', + key: '', + type: IndexType.key, + columns: [], + orders: [], // (optional) + lengths: [], // (optional) +); diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md new file mode 100644 index 00000000..5f4eb0b8 --- /dev/null +++ b/docs/examples/tablesdb/create-integer-column.md @@ -0,0 +1,19 @@ +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); + +ColumnInteger result = await tablesDb.createIntegerColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + min: 0, // (optional) + max: 0, // (optional) + xdefault: 0, // (optional) + array: false, // (optional) +); diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md new file mode 100644 index 00000000..44e9ce38 --- /dev/null +++ b/docs/examples/tablesdb/create-ip-column.md @@ -0,0 +1,17 @@ +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); + +ColumnIp result = await tablesDb.createIpColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + xdefault: '', // (optional) + array: false, // (optional) +); diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md new file mode 100644 index 00000000..1b61250d --- /dev/null +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -0,0 +1,19 @@ +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); + +ColumnRelationship result = await tablesDb.createRelationshipColumn( + databaseId: '', + tableId: '', + relatedTableId: '', + type: RelationshipType.oneToOne, + twoWay: false, // (optional) + key: '', // (optional) + twoWayKey: '', // (optional) + onDelete: RelationMutate.cascade, // (optional) +); diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md new file mode 100644 index 00000000..5724e3ed --- /dev/null +++ b/docs/examples/tablesdb/create-row.md @@ -0,0 +1,16 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +TablesDb tablesDb = TablesDb(client); + +Row result = await tablesDb.createRow( + databaseId: '', + tableId: '', + rowId: '', + data: {}, + permissions: ["read("any")"], // (optional) +); diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md new file mode 100644 index 00000000..4f4e1c45 --- /dev/null +++ b/docs/examples/tablesdb/create-rows.md @@ -0,0 +1,14 @@ +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); + +RowList result = await tablesDb.createRows( + databaseId: '', + tableId: '', + rows: [], +); diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md new file mode 100644 index 00000000..a5d53a0e --- /dev/null +++ b/docs/examples/tablesdb/create-string-column.md @@ -0,0 +1,19 @@ +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); + +ColumnString result = await tablesDb.createStringColumn( + databaseId: '', + tableId: '', + key: '', + size: 1, + xrequired: false, + xdefault: '', // (optional) + array: false, // (optional) + encrypt: false, // (optional) +); diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md new file mode 100644 index 00000000..bb8206dc --- /dev/null +++ b/docs/examples/tablesdb/create-table.md @@ -0,0 +1,17 @@ +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); + +Table result = await tablesDb.createTable( + databaseId: '', + tableId: '', + name: '', + permissions: ["read("any")"], // (optional) + rowSecurity: false, // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md new file mode 100644 index 00000000..ac181814 --- /dev/null +++ b/docs/examples/tablesdb/create-url-column.md @@ -0,0 +1,17 @@ +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); + +ColumnUrl result = await tablesDb.createUrlColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + xdefault: 'https://example.com', // (optional) + array: false, // (optional) +); diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md new file mode 100644 index 00000000..486e5220 --- /dev/null +++ b/docs/examples/tablesdb/create.md @@ -0,0 +1,15 @@ +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); + +Database result = await tablesDb.create( + databaseId: '', + name: '', + enabled: false, // (optional) + type: .tablesdb, // (optional) +); diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md new file mode 100644 index 00000000..d881c19d --- /dev/null +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -0,0 +1,17 @@ +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); + +Row result = await tablesDb.decrementRowColumn( + databaseId: '', + tableId: '', + rowId: '', + column: '', + value: 0, // (optional) + min: 0, // (optional) +); diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md new file mode 100644 index 00000000..f86e7f10 --- /dev/null +++ b/docs/examples/tablesdb/delete-column.md @@ -0,0 +1,14 @@ +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); + +await tablesDb.deleteColumn( + databaseId: '', + tableId: '', + key: '', +); diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md new file mode 100644 index 00000000..3727bd41 --- /dev/null +++ b/docs/examples/tablesdb/delete-index.md @@ -0,0 +1,14 @@ +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); + +await tablesDb.deleteIndex( + databaseId: '', + tableId: '', + key: '', +); diff --git a/docs/examples/tablesdb/delete-row.md b/docs/examples/tablesdb/delete-row.md new file mode 100644 index 00000000..8ebdf733 --- /dev/null +++ b/docs/examples/tablesdb/delete-row.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +TablesDb tablesDb = TablesDb(client); + +await tablesDb.deleteRow( + databaseId: '', + tableId: '', + rowId: '', +); diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md new file mode 100644 index 00000000..932e6475 --- /dev/null +++ b/docs/examples/tablesdb/delete-rows.md @@ -0,0 +1,14 @@ +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); + +await tablesDb.deleteRows( + databaseId: '', + tableId: '', + queries: [], // (optional) +); diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md new file mode 100644 index 00000000..c9504d3e --- /dev/null +++ b/docs/examples/tablesdb/delete-table.md @@ -0,0 +1,13 @@ +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); + +await tablesDb.deleteTable( + databaseId: '', + tableId: '', +); diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md new file mode 100644 index 00000000..c8ea7818 --- /dev/null +++ b/docs/examples/tablesdb/delete.md @@ -0,0 +1,12 @@ +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); + +await tablesDb.delete( + databaseId: '', +); diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md new file mode 100644 index 00000000..898945fa --- /dev/null +++ b/docs/examples/tablesdb/get-column.md @@ -0,0 +1,14 @@ +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); + + result = await tablesDb.getColumn( + databaseId: '', + tableId: '', + key: '', +); diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md new file mode 100644 index 00000000..eb8703d2 --- /dev/null +++ b/docs/examples/tablesdb/get-index.md @@ -0,0 +1,14 @@ +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); + +ColumnIndex result = await tablesDb.getIndex( + databaseId: '', + tableId: '', + key: '', +); diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md new file mode 100644 index 00000000..abd412b1 --- /dev/null +++ b/docs/examples/tablesdb/get-row.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +TablesDb tablesDb = TablesDb(client); + +Row result = await tablesDb.getRow( + databaseId: '', + tableId: '', + rowId: '', + queries: [], // (optional) +); diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md new file mode 100644 index 00000000..becce951 --- /dev/null +++ b/docs/examples/tablesdb/get-table.md @@ -0,0 +1,13 @@ +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); + +Table result = await tablesDb.getTable( + databaseId: '', + tableId: '', +); diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md new file mode 100644 index 00000000..44628b3c --- /dev/null +++ b/docs/examples/tablesdb/get.md @@ -0,0 +1,12 @@ +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); + +Database result = await tablesDb.get( + databaseId: '', +); diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md new file mode 100644 index 00000000..ad9d1b9d --- /dev/null +++ b/docs/examples/tablesdb/increment-row-column.md @@ -0,0 +1,17 @@ +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); + +Row result = await tablesDb.incrementRowColumn( + databaseId: '', + tableId: '', + rowId: '', + column: '', + value: 0, // (optional) + max: 0, // (optional) +); diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md new file mode 100644 index 00000000..608ff1e6 --- /dev/null +++ b/docs/examples/tablesdb/list-columns.md @@ -0,0 +1,14 @@ +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); + +ColumnList result = await tablesDb.listColumns( + databaseId: '', + tableId: '', + queries: [], // (optional) +); diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md new file mode 100644 index 00000000..c78eaddf --- /dev/null +++ b/docs/examples/tablesdb/list-indexes.md @@ -0,0 +1,14 @@ +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); + +ColumnIndexList result = await tablesDb.listIndexes( + databaseId: '', + tableId: '', + queries: [], // (optional) +); diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md new file mode 100644 index 00000000..07b2733a --- /dev/null +++ b/docs/examples/tablesdb/list-rows.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +TablesDb tablesDb = TablesDb(client); + +RowList result = await tablesDb.listRows( + databaseId: '', + tableId: '', + queries: [], // (optional) +); diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md new file mode 100644 index 00000000..5d18cd5b --- /dev/null +++ b/docs/examples/tablesdb/list-tables.md @@ -0,0 +1,14 @@ +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); + +TableList result = await tablesDb.listTables( + databaseId: '', + queries: [], // (optional) + search: '', // (optional) +); diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md new file mode 100644 index 00000000..38b73b43 --- /dev/null +++ b/docs/examples/tablesdb/list.md @@ -0,0 +1,13 @@ +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); + +DatabaseList result = await tablesDb.list( + queries: [], // (optional) + search: '', // (optional) +); diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md new file mode 100644 index 00000000..7ca6e5e3 --- /dev/null +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -0,0 +1,17 @@ +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); + +ColumnBoolean result = await tablesDb.updateBooleanColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + xdefault: false, + newKey: '', // (optional) +); diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md new file mode 100644 index 00000000..0ea38fe9 --- /dev/null +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -0,0 +1,17 @@ +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); + +ColumnDatetime result = await tablesDb.updateDatetimeColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + xdefault: '', + newKey: '', // (optional) +); diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md new file mode 100644 index 00000000..0fdc6521 --- /dev/null +++ b/docs/examples/tablesdb/update-email-column.md @@ -0,0 +1,17 @@ +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); + +ColumnEmail result = await tablesDb.updateEmailColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + xdefault: 'email@example.com', + newKey: '', // (optional) +); diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md new file mode 100644 index 00000000..5f4403fe --- /dev/null +++ b/docs/examples/tablesdb/update-enum-column.md @@ -0,0 +1,18 @@ +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); + +ColumnEnum result = await tablesDb.updateEnumColumn( + databaseId: '', + tableId: '', + key: '', + elements: [], + xrequired: false, + xdefault: '', + newKey: '', // (optional) +); diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md new file mode 100644 index 00000000..bfb1d7c3 --- /dev/null +++ b/docs/examples/tablesdb/update-float-column.md @@ -0,0 +1,19 @@ +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); + +ColumnFloat result = await tablesDb.updateFloatColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + xdefault: 0, + min: 0, // (optional) + max: 0, // (optional) + newKey: '', // (optional) +); diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md new file mode 100644 index 00000000..c1ae2887 --- /dev/null +++ b/docs/examples/tablesdb/update-integer-column.md @@ -0,0 +1,19 @@ +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); + +ColumnInteger result = await tablesDb.updateIntegerColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + xdefault: 0, + min: 0, // (optional) + max: 0, // (optional) + newKey: '', // (optional) +); diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md new file mode 100644 index 00000000..c1d9123f --- /dev/null +++ b/docs/examples/tablesdb/update-ip-column.md @@ -0,0 +1,17 @@ +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); + +ColumnIp result = await tablesDb.updateIpColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + xdefault: '', + newKey: '', // (optional) +); diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md new file mode 100644 index 00000000..5f0fafb4 --- /dev/null +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -0,0 +1,16 @@ +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); + +ColumnRelationship result = await tablesDb.updateRelationshipColumn( + databaseId: '', + tableId: '', + key: '', + onDelete: RelationMutate.cascade, // (optional) + newKey: '', // (optional) +); diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md new file mode 100644 index 00000000..31535b4e --- /dev/null +++ b/docs/examples/tablesdb/update-row.md @@ -0,0 +1,16 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +TablesDb tablesDb = TablesDb(client); + +Row result = await tablesDb.updateRow( + databaseId: '', + tableId: '', + rowId: '', + data: {}, // (optional) + permissions: ["read("any")"], // (optional) +); diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md new file mode 100644 index 00000000..b8d47a35 --- /dev/null +++ b/docs/examples/tablesdb/update-rows.md @@ -0,0 +1,15 @@ +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); + +RowList result = await tablesDb.updateRows( + databaseId: '', + tableId: '', + data: {}, // (optional) + queries: [], // (optional) +); diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md new file mode 100644 index 00000000..7ef30e4b --- /dev/null +++ b/docs/examples/tablesdb/update-string-column.md @@ -0,0 +1,18 @@ +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); + +ColumnString result = await tablesDb.updateStringColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + xdefault: '', + size: 1, // (optional) + newKey: '', // (optional) +); diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md new file mode 100644 index 00000000..0ff11cdf --- /dev/null +++ b/docs/examples/tablesdb/update-table.md @@ -0,0 +1,17 @@ +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); + +Table result = await tablesDb.updateTable( + databaseId: '', + tableId: '', + name: '', + permissions: ["read("any")"], // (optional) + rowSecurity: false, // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md new file mode 100644 index 00000000..7075ba15 --- /dev/null +++ b/docs/examples/tablesdb/update-url-column.md @@ -0,0 +1,17 @@ +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); + +ColumnUrl result = await tablesDb.updateUrlColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + xdefault: 'https://example.com', + newKey: '', // (optional) +); diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md new file mode 100644 index 00000000..72b50f0b --- /dev/null +++ b/docs/examples/tablesdb/update.md @@ -0,0 +1,14 @@ +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); + +Database result = await tablesDb.update( + databaseId: '', + name: '', + enabled: false, // (optional) +); diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md new file mode 100644 index 00000000..95720df0 --- /dev/null +++ b/docs/examples/tablesdb/upsert-row.md @@ -0,0 +1,16 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +TablesDb tablesDb = TablesDb(client); + +Row result = await tablesDb.upsertRow( + databaseId: '', + tableId: '', + rowId: '', + data: {}, // (optional) + permissions: ["read("any")"], // (optional) +); diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md new file mode 100644 index 00000000..e6e9cb10 --- /dev/null +++ b/docs/examples/tablesdb/upsert-rows.md @@ -0,0 +1,14 @@ +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); + +RowList result = await tablesDb.upsertRows( + databaseId: '', + tableId: '', + rows: [], +); diff --git a/example/README.md b/example/README.md index fc2c6d09..e69de29b 100644 --- a/example/README.md +++ b/example/README.md @@ -1,62 +0,0 @@ -# Examples - -Init your Appwrite client: - -```dart -Client client = Client(); - -client - .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint - .setProject('5e8cf4f46b5e8') // Your project ID - .setSelfSigned() // Remove in production -; -``` - -Create a new user: - -```dart -Users users = Users(client); - -User result = await users.create( - userId: ID.unique(), - email: "email@example.com", - phone: "+123456789", - password: "password", - name: "Walter O'Brien" -); -``` - -Fetch user profile: - -```dart -Users users = Users(client); - -User profile = await users.get( - userId: '[USER_ID]', -); -``` - -Upload File: - -```dart -Storage storage = Storage(client); - -InputFile file = InputFile(path: './path-to-file/image.jpg', filename: 'image.jpg'); - -storage.createFile( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', // use 'unique()' to automatically generate a unique ID - file: file, - permissions: [ - Permission.read(Role.any()), - ], -) -.then((response) { - print(response); // File uploaded! -}) -.catchError((error) { - print(error.response); -}); -``` - -All examples and API features are available at the [official Appwrite docs](https://appwrite.io/docs) 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 0848a050..f3b8837b 100644 --- a/lib/dart_appwrite.dart +++ b/lib/dart_appwrite.dart @@ -1,6 +1,6 @@ /// Appwrite Dart SDK /// -/// This SDK is compatible with Appwrite server version 1.7.x. +/// This SDK is compatible with Appwrite server version 1.8.x. /// For older versions, please check /// [previous releases](https://github.com/appwrite/sdk-for-dart/releases). library dart_appwrite; @@ -37,6 +37,7 @@ part 'services/locale.dart'; part 'services/messaging.dart'; part 'services/sites.dart'; part 'services/storage.dart'; +part 'services/tables-db.dart'; part 'services/teams.dart'; part 'services/tokens.dart'; part 'services/users.dart'; diff --git a/lib/enums.dart b/lib/enums.dart index dd69b671..838ca018 100644 --- a/lib/enums.dart +++ b/lib/enums.dart @@ -7,6 +7,7 @@ part 'src/enums/o_auth_provider.dart'; part 'src/enums/browser.dart'; part 'src/enums/credit_card.dart'; part 'src/enums/flag.dart'; +part 'src/enums/type.dart'; part 'src/enums/relationship_type.dart'; part 'src/enums/relation_mutate.dart'; part 'src/enums/index_type.dart'; diff --git a/lib/id.dart b/lib/id.dart index 28ff15e8..72e26a23 100644 --- a/lib/id.dart +++ b/lib/id.dart @@ -10,7 +10,8 @@ class ID { final now = DateTime.now(); final sec = (now.millisecondsSinceEpoch / 1000).floor(); final usec = now.microsecondsSinceEpoch - (sec * 1000000); - return sec.toRadixString(16) + usec.toRadixString(16).padLeft(5, '0'); + return sec.toRadixString(16) + + usec.toRadixString(16).padLeft(5, '0'); } // Generate a unique ID with padding to have a longer ID diff --git a/lib/models.dart b/lib/models.dart index 59b862d5..71b1a2fd 100644 --- a/lib/models.dart +++ b/lib/models.dart @@ -2,10 +2,13 @@ library dart_appwrite.models; part 'src/models/model.dart'; +part 'src/models/row_list.dart'; part 'src/models/document_list.dart'; +part 'src/models/table_list.dart'; part 'src/models/collection_list.dart'; part 'src/models/database_list.dart'; part 'src/models/index_list.dart'; +part 'src/models/column_index_list.dart'; part 'src/models/user_list.dart'; part 'src/models/session_list.dart'; part 'src/models/identity_list.dart'; @@ -47,7 +50,21 @@ part 'src/models/attribute_ip.dart'; part 'src/models/attribute_url.dart'; part 'src/models/attribute_datetime.dart'; part 'src/models/attribute_relationship.dart'; +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_float.dart'; +part 'src/models/column_boolean.dart'; +part 'src/models/column_email.dart'; +part 'src/models/column_enum.dart'; +part 'src/models/column_ip.dart'; +part 'src/models/column_url.dart'; +part 'src/models/column_datetime.dart'; +part 'src/models/column_relationship.dart'; part 'src/models/index.dart'; +part 'src/models/column_index.dart'; +part 'src/models/row.dart'; part 'src/models/document.dart'; part 'src/models/log.dart'; part 'src/models/user.dart'; diff --git a/lib/query.dart b/lib/query.dart index cfc08c05..37179593 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -1,5 +1,6 @@ part of 'dart_appwrite.dart'; + /// Helper class to generate query strings. class Query { final String method; @@ -9,13 +10,15 @@ class Query { Query._(this.method, [this.attribute = null, this.values = null]); Map toJson() { - final map = {'method': method}; + final map = { + 'method': method, + }; - if (attribute != null) { + if(attribute != null) { map['attribute'] = attribute; } - - if (values != null) { + + if(values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +29,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. @@ -58,12 +61,10 @@ class Query { Query._('search', attribute, value).toString(); /// Filter resources where [attribute] is null. - static String isNull(String attribute) => - Query._('isNull', attribute).toString(); + static String isNull(String attribute) => Query._('isNull', attribute).toString(); /// Filter resources where [attribute] is not null. - static String isNotNull(String attribute) => - Query._('isNotNull', attribute).toString(); + static String isNotNull(String attribute) => Query._('isNotNull', attribute).toString(); /// Filter resources where [attribute] is between [start] and [end] (inclusive). static String between(String attribute, dynamic start, dynamic end) => @@ -82,51 +83,74 @@ class Query { static String contains(String attribute, dynamic value) => Query._('contains', attribute, value).toString(); - static String or(List queries) => Query._( - 'or', - null, - queries.map((query) => jsonDecode(query)).toList(), - ).toString(); + /// Filter resources where [attribute] does not contain [value] + /// [value] can be a single value or a list. + static String notContains(String attribute, dynamic value) => + Query._('notContains', attribute, value).toString(); + + /// Filter resources by searching [attribute] for [value] (inverse of search). + static String notSearch(String attribute, String value) => + Query._('notSearch', attribute, value).toString(); + + /// Filter resources where [attribute] is not between [start] and [end] (exclusive). + static String notBetween(String attribute, dynamic start, dynamic end) => + Query._('notBetween', attribute, [start, end]).toString(); + + /// Filter resources where [attribute] does not start with [value]. + static String notStartsWith(String attribute, String value) => + Query._('notStartsWith', attribute, value).toString(); + + /// Filter resources where [attribute] does not end with [value]. + static String notEndsWith(String attribute, String value) => + Query._('notEndsWith', attribute, value).toString(); - static String and(List queries) => Query._( - 'and', - null, - queries.map((query) => jsonDecode(query)).toList(), - ).toString(); + /// Filter resources where document was created before [value]. + static String createdBefore(String value) => Query._('createdBefore', null, value).toString(); + + /// Filter resources where document was created after [value]. + static String createdAfter(String value) => Query._('createdAfter', null, value).toString(); + + /// Filter resources where document was updated before [value]. + static String updatedBefore(String value) => Query._('updatedBefore', null, value).toString(); + + /// Filter resources where document was updated after [value]. + static String updatedAfter(String value) => Query._('updatedAfter', null, value).toString(); + + static String or(List queries) => + Query._('or', null, queries.map((query) => jsonDecode(query)).toList()).toString(); + + static String and(List queries) => + Query._('and', null, queries.map((query) => jsonDecode(query)).toList()).toString(); /// Specify which attributes should be returned by the API call. static String select(List attributes) => Query._('select', null, attributes).toString(); /// Sort results by [attribute] ascending. - static String orderAsc(String attribute) => - Query._('orderAsc', attribute).toString(); + static String orderAsc(String attribute) => Query._('orderAsc', attribute).toString(); /// Sort results by [attribute] descending. - static String orderDesc(String attribute) => - Query._('orderDesc', attribute).toString(); + static String orderDesc(String attribute) => Query._('orderDesc', attribute).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(); + 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) => - Query._('cursorAfter', null, id).toString(); + static String cursorAfter(String id) => Query._('cursorAfter', null, id).toString(); /// Return only [limit] results. 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(); -} + static String offset(int offset) => Query._('offset', null, offset).toString(); + +} \ No newline at end of file diff --git a/lib/role.dart b/lib/role.dart index dafeb78d..6552df47 100644 --- a/lib/role.dart +++ b/lib/role.dart @@ -2,65 +2,65 @@ part of 'dart_appwrite.dart'; /// Helper class to generate role strings for [Permission]. class Role { - Role._(); - - /// Grants access to anyone. - /// - /// This includes authenticated and unauthenticated users. - static String any() { - return 'any'; - } + Role._(); + + /// Grants access to anyone. + /// + /// This includes authenticated and unauthenticated users. + static String any() { + return 'any'; + } - /// Grants access to a specific user by user ID. - /// - /// You can optionally pass verified or unverified for - /// [status] to target specific types of users. - static String user(String id, [String status = '']) { - if (status.isEmpty) { - return 'user:$id'; + /// Grants access to a specific user by user ID. + /// + /// You can optionally pass verified or unverified for + /// [status] to target specific types of users. + static String user(String id, [String status = '']) { + if(status.isEmpty) { + return 'user:$id'; + } + return 'user:$id/$status'; } - return 'user:$id/$status'; - } - /// Grants access to any authenticated or anonymous user. - /// - /// You can optionally pass verified or unverified for - /// [status] to target specific types of users. - static String users([String status = '']) { - if (status.isEmpty) { - return 'users'; + /// Grants access to any authenticated or anonymous user. + /// + /// You can optionally pass verified or unverified for + /// [status] to target specific types of users. + static String users([String status = '']) { + if(status.isEmpty) { + return 'users'; + } + return 'users/$status'; } - return 'users/$status'; - } - /// Grants access to any guest user without a session. - /// - /// Authenticated users don't have access to this role. - static String guests() { - return 'guests'; - } + /// Grants access to any guest user without a session. + /// + /// Authenticated users don't have access to this role. + static String guests() { + return 'guests'; + } - /// Grants access to a team by team ID. - /// - /// You can optionally pass a role for [role] to target - /// team members with the specified role. - static String team(String id, [String role = '']) { - if (role.isEmpty) { - return 'team:$id'; + /// Grants access to a team by team ID. + /// + /// You can optionally pass a role for [role] to target + /// team members with the specified role. + static String team(String id, [String role = '']) { + if(role.isEmpty) { + return 'team:$id'; + } + return 'team:$id/$role'; } - return 'team:$id/$role'; - } - /// Grants access to a specific member of a team. - /// - /// When the member is removed from the team, they will - /// no longer have access. - static String member(String id) { - return 'member:$id'; - } + /// Grants access to a specific member of a team. + /// + /// When the member is removed from the team, they will + /// no longer have access. + static String member(String id) { + return 'member:$id'; + } - /// Grants access to a user with the specified label. - static String label(String name) { - return 'label:$name'; - } -} + /// Grants access to a user with the specified label. + 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 90e1f03e..ab1684de 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -2,1084 +2,1083 @@ part of '../dart_appwrite.dart'; /// The Account service allows you to authenticate and manage a user account. class Account extends Service { - Account(super.client); - - /// Get the currently logged in user. - Future get() async { - final String apiPath = '/account'; - - final Map apiParams = {}; - - final Map 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 - /// the - /// [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) - /// 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'; - - final Map apiParams = { - 'userId': userId, - 'email': email, - 'password': password, - 'name': name, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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 - /// email is not sent automatically however you can use the send confirmation - /// email endpoint again to send the confirmation email. For security measures, - /// 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'; - - final Map apiParams = { - 'email': email, - 'password': password, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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}) async { - final String apiPath = '/account/identities'; - - final Map apiParams = {'queries': queries}; - - final Map 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, - ); - - 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; - } - - /// 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() async { - final String apiPath = '/account/jwts'; - - final Map apiParams = {}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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}) async { - final String apiPath = '/account/logs'; - - final Map apiParams = {'queries': queries}; - - final Map 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'; - - 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, - ); - - 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. - Future createMfaAuthenticator({ - required enums.AuthenticatorType type, - }) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( - '{type}', - type.value, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - 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, - ); - - return models.User.fromMap(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, - ); - - 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; - } - - /// 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/challenge'; - - 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, - ); - - 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. - Future updateMfaChallenge({ - required String challengeId, - required String otp, - }) async { - final String apiPath = '/account/mfa/challenge'; - - final Map apiParams = { - 'challengeId': challengeId, - 'otp': otp, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - Future listMfaFactors() async { - final String apiPath = '/account/mfa/factors'; - - final Map apiParams = {}; - - final Map 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. - Future getMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; - - final Map apiParams = {}; - - final Map 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. - Future createMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; - - final Map apiParams = {}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - Future updateMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; - - 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.MfaRecoveryCodes.fromMap(res.data); - } - - /// Update currently logged in user 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, - ); - - 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'; - - final Map apiParams = { - 'password': password, - 'oldPassword': oldPassword, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'phone': phone, - 'password': password, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = {}; - - final Map 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'; - - 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, - ); - - 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 - /// app password reset URL with the secret key and email address values - /// attached to the URL query string. Use the query string params to submit a - /// request to the [PUT - /// /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'; - - final Map apiParams = {'email': email, 'url': url}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'userId': userId, - 'secret': secret, - 'password': password, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = {}; - - final Map 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'; - - 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; - } - - /// 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 - /// allow the new user to convert an anonymous account to a normal account, you - /// need to update its [email and - /// 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'; - - final Map apiParams = {}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'email': email, - 'password': password, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - Future updateMagicURLSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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 updatePhoneSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - ); - - final Map apiParams = {}; - - final Map 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, - ); - - 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.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, - ); - - 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; - } - - /// 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'; - - 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.User.fromMap(res.data); - } - - /// Sends the user an email 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 - /// returned user ID and secret and submit a request to the [POST - /// /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'; - - final Map apiParams = { - 'userId': userId, - 'email': email, - 'phrase': phrase, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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 - /// the user clicks the link in the email, the user is redirected back to the - /// URL you provided with the secret key and userId values attached to the URL - /// query string. Use the query string parameters to submit a request to the - /// [POST - /// /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'; - - final Map apiParams = { - 'userId': userId, - 'email': email, - 'url': url, - 'phrase': phrase, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - /// - /// 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, - ); - - final Map params = { - 'success': success, - 'failure': failure, - 'scopes': scopes, - - 'project': client.config['project'], - }; - - final List query = []; - - params.forEach((key, value) { - if (value is List) { - for (var item in value) { - query.add( - Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item), - ); - } - } else if (value != null) { - query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); - } - }); - - 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('&'), - ); - - 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 - /// returned user ID and secret and submit a request to the [POST - /// /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'; - - final Map apiParams = {'userId': userId, 'phone': phone}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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** - /// and **secret** arguments will be passed as query parameters to the URL you - /// have provided to be attached to the verification email. The provided URL - /// should redirect the user back to your app and allow you to complete the - /// verification process by verifying both the **userId** and **secret** - /// 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; - - 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, - ); - - 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 updateVerification({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/verification'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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 - /// using the - /// [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) - /// endpoint. Learn more about how to [complete the verification - /// 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/verification/phone'; - - final Map apiParams = {}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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/verification/phone'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.Token.fromMap(res.data); - } -} + Account(super.client); + + /// Get the currently logged in user. + Future get() async { + final String apiPath = '/account'; + + final Map apiParams = { + + + }; + + final Map 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 + /// the + /// [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) + /// 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'; + + final Map apiParams = { + + 'userId': userId, +'email': email, +'password': password, +'name': name, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 + /// email is not sent automatically however you can use the send confirmation + /// email endpoint again to send the confirmation email. For security measures, + /// 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'; + + final Map apiParams = { + + 'email': email, +'password': password, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/account/identities'; + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + + 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; + + } + + /// 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() async { + final String apiPath = '/account/jwts'; + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/account/logs'; + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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'; + + 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); + + 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. + Future createMfaAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. + 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); + + return models.User.fromMap(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); + + 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; + + } + + /// 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/challenge'; + + 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); + + 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. + Future updateMfaChallenge({required String challengeId, required String otp}) async { + final String apiPath = '/account/mfa/challenge'; + + final Map apiParams = { + + 'challengeId': challengeId, +'otp': otp, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. + Future listMfaFactors() async { + final String apiPath = '/account/mfa/factors'; + + final Map apiParams = { + + + }; + + final Map 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. + Future getMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; + + final Map apiParams = { + + + }; + + final Map 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. + Future createMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. + Future updateMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; + + 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.MfaRecoveryCodes.fromMap(res.data); + + } + + /// Update currently logged in user 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); + + 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'; + + final Map apiParams = { + + 'password': password, +'oldPassword': oldPassword, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'phone': phone, +'password': password, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + + }; + + final Map 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'; + + 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); + + 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 + /// app password reset URL with the secret key and email address values + /// attached to the URL query string. Use the query string params to submit a + /// request to the [PUT + /// /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'; + + final Map apiParams = { + + 'email': email, +'url': url, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, +'password': password, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + + }; + + final Map 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'; + + 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; + + } + + /// 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 + /// allow the new user to convert an anonymous account to a normal account, you + /// need to update its [email and + /// 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'; + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'email': email, +'password': password, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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.') + Future updateMagicURLSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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.') + Future updatePhoneSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + 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.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); + + 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; + + } + + /// 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'; + + 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.User.fromMap(res.data); + + } + + /// Sends the user an email 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 + /// returned user ID and secret and submit a request to the [POST + /// /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'; + + final Map apiParams = { + + 'userId': userId, +'email': email, +'phrase': phrase, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 + /// the user clicks the link in the email, the user is redirected back to the + /// URL you provided with the secret key and userId values attached to the URL + /// query string. Use the query string parameters to submit a request to the + /// [POST + /// /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'; + + final Map apiParams = { + + 'userId': userId, +'email': email, +'url': url, +'phrase': phrase, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. + /// + /// 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); + + final Map params = { + 'success': success, +'failure': failure, +'scopes': scopes, + + + 'project': client.config['project'], + }; + + final List query = []; + + params.forEach((key, value) { + if (value is List) { + for (var item in value) { + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); + } + } else if(value != null) { + query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); + } + }); + + 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('&') + ); + + 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 + /// returned user ID and secret and submit a request to the [POST + /// /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'; + + final Map apiParams = { + + 'userId': userId, +'phone': phone, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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** + /// and **secret** arguments will be passed as query parameters to the URL you + /// have provided to be attached to the verification email. The provided URL + /// should redirect the user back to your app and allow you to complete the + /// verification process by verifying both the **userId** and **secret** + /// 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 createVerification({required String url}) async { + final String apiPath = '/account/verification'; + + 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); + + 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 updateVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 + /// using the + /// [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) + /// endpoint. Learn more about how to [complete the verification + /// 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/verification/phone'; + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/verification/phone'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Token.fromMap(res.data); + + } +} \ No newline at end of file diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index 8033f1cd..381146d4 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -3,253 +3,187 @@ part of '../dart_appwrite.dart'; /// 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); - - /// 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, - ); - - final Map params = { - 'width': width, - 'height': height, - 'quality': quality, - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - 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, - ); - - final Map params = { - 'width': width, - 'height': height, - 'quality': quality, - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - 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'; - - 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, - ); - 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, - ); - - final Map params = { - 'width': width, - 'height': height, - 'quality': quality, - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - 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'; - - final Map params = { - 'url': url, - 'width': width, - 'height': height, - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - 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'; - - final Map params = { - 'name': name, - 'width': width, - 'height': height, - 'background': background, - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - 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'; - - final Map params = { - 'text': text, - 'size': size, - 'margin': margin, - 'download': download, - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: params, - responseType: ResponseType.bytes, - ); - return res.data; - } -} + 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); + + final Map params = { + 'width': width, +'height': height, +'quality': quality, + + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + 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); + + final Map params = { + 'width': width, +'height': height, +'quality': quality, + + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + 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'; + + 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); + 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); + + final Map params = { + 'width': width, +'height': height, +'quality': quality, + + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + 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'; + + final Map params = { + 'url': url, +'width': width, +'height': height, + + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + 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'; + + final Map params = { + 'name': name, +'width': width, +'height': height, +'background': background, + + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + 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'; + + final Map params = { + 'text': text, +'size': size, +'margin': margin, +'download': download, + + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); + return res.data; + } +} \ No newline at end of file diff --git a/lib/services/databases.dart b/lib/services/databases.dart index aad77bf2..3d1e095d 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -3,1553 +3,1214 @@ part of '../dart_appwrite.dart'; /// The Databases service allows you to create structured collections of /// documents, query and filter lists of documents class Databases extends Service { - Databases(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, - }) async { - final String apiPath = '/databases'; - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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 = '/databases'; - - final Map apiParams = { - 'databaseId': databaseId, - 'name': name, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.Database.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 = '/databases/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {}; - - final Map 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/databases/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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 = '/databases/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - 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 collections that belong to the provided databaseId. You - /// can use the search parameter to filter your results. - Future listCollections({ - required String databaseId, - List? queries, - String? search, - }) async { - final String apiPath = '/databases/{databaseId}/collections'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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. - Future createCollection({ - required String databaseId, - required String collectionId, - required String name, - List? permissions, - bool? documentSecurity, - bool? enabled, - }) async { - final String apiPath = '/databases/{databaseId}/collections'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = { - 'collectionId': collectionId, - 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - 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 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. - Future updateCollection({ - required String databaseId, - required String collectionId, - required String name, - List? permissions, - bool? documentSecurity, - bool? enabled, - }) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - 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 apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } - - /// List attributes in the collection. - Future listAttributes({ - required String databaseId, - required String collectionId, - List? queries, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.AttributeList.fromMap(res.data); - } - - /// Create a boolean attribute. - /// - 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, - 'array': array, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - 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, - 'array': array, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.AttributeDatetime.fromMap(res.data); - } - - /// Create an email attribute. - /// - 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, - 'array': array, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - /// - 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.AttributeEmail.fromMap(res.data); - } - - /// Create an enumeration attribute. The `elements` param acts as a white-list - /// of accepted values for this attribute. - /// - 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, - 'array': array, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - /// - 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - /// - 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, - 'array': array, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - /// - 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - /// - 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, - 'array': array, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - /// - 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.AttributeInteger.fromMap(res.data); - } - - /// Create IP address attribute. - /// - 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, - 'array': array, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - /// - 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.AttributeIp.fromMap(res.data); - } - - /// Create relationship attribute. [Learn more about relationship - /// attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - /// - 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.AttributeRelationship.fromMap(res.data); - } - - /// Create a string attribute. - /// - 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, - 'array': array, - 'encrypt': encrypt, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - /// - 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.AttributeString.fromMap(res.data); - } - - /// Create a URL attribute. - /// - 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, - 'array': array, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - /// - 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.AttributeUrl.fromMap(res.data); - } - - /// Get attribute by ID. - 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 apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } - - /// Deletes an attribute. - 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 apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } - - /// Update relationship attribute. [Learn more about relationship - /// attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - /// - 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/{key}/relationship' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); - - final Map apiParams = { - 'onDelete': onDelete?.value, - 'newKey': newKey, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.AttributeRelationship.fromMap(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. - Future listDocuments({ - required String databaseId, - required String collectionId, - List? queries, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map 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. - Future createDocument({ - required String databaseId, - required String collectionId, - required String documentId, - required Map data, - List? permissions, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'documentId': documentId, - 'data': data, - 'permissions': permissions, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.Document.fromMap(res.data); - } - - /// **WARNING: Experimental Feature** - This endpoint is experimental and not - /// yet officially supported. It may be subject to breaking changes or removal - /// in future versions. - /// - /// 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. - Future createDocuments({ - required String databaseId, - required String collectionId, - required List documents, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.DocumentList.fromMap(res.data); - } - - /// **WARNING: Experimental Feature** - This endpoint is experimental and not - /// yet officially supported. It may be subject to breaking changes or removal - /// in future versions. - /// - /// 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. - /// - Future upsertDocuments({ - required String databaseId, - required String collectionId, - required List documents, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.DocumentList.fromMap(res.data); - } - - /// **WARNING: Experimental Feature** - This endpoint is experimental and not - /// yet officially supported. It may be subject to breaking changes or removal - /// in future versions. - /// - /// 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. - Future updateDocuments({ - required String databaseId, - required String collectionId, - Map? data, - List? queries, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.DocumentList.fromMap(res.data); - } - - /// **WARNING: Experimental Feature** - This endpoint is experimental and not - /// yet officially supported. It may be subject to breaking changes or removal - /// in future versions. - /// - /// Bulk delete documents using queries, if no queries are passed then all - /// documents are deleted. - Future deleteDocuments({ - required String databaseId, - required String collectionId, - List? queries, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - Future getDocument({ - required String databaseId, - required String collectionId, - required String documentId, - List? queries, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.Document.fromMap(res.data); - } - - /// **WARNING: Experimental Feature** - This endpoint is experimental and not - /// yet officially supported. It may be subject to breaking changes or removal - /// in future versions. - /// - /// 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. - Future upsertDocument({ - required String databaseId, - required String collectionId, - required String documentId, - required Map data, - List? permissions, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - final Map apiParams = { - 'data': data, - 'permissions': permissions, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - Future updateDocument({ - required String databaseId, - required String collectionId, - required String documentId, - Map? data, - List? permissions, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - final Map apiParams = { - 'data': data, - 'permissions': permissions, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - Future deleteDocument({ - required String databaseId, - required String collectionId, - required String documentId, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - 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; - } - - /// Decrement a specific attribute of a document by a given value. - Future decrementDocumentAttribute({ - required String databaseId, - required String collectionId, - required String documentId, - required String attribute, - double? value, - double? min, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - Future incrementDocumentAttribute({ - required String databaseId, - required String collectionId, - required String documentId, - required String attribute, - double? value, - double? max, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.Document.fromMap(res.data); - } - - /// List indexes in the collection. - Future listIndexes({ - required String databaseId, - required String collectionId, - List? queries, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map 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`. - Future createIndex({ - required String databaseId, - required String collectionId, - required String key, - required enums.IndexType 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, - 'orders': orders, - 'lengths': lengths, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.Index.fromMap(res.data); - } - - /// Get index by ID. - 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 apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.Index.fromMap(res.data); - } - - /// Delete an index. - 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 apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } -} + 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}) async { + final String apiPath = '/databases'; + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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.createDatabase` instead.') + Future create({required String databaseId, required String name, bool? enabled, enums.Type? type}) async { + final String apiPath = '/databases'; + + final Map apiParams = { + + 'databaseId': databaseId, +'name': name, +'enabled': enabled, +'type': type?.value, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Database.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); + + final Map apiParams = { + + + }; + + final Map 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, required String name, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'collectionId': collectionId, +'name': name, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'name': name, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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; + + } + + /// 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + '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); + + 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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + '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); + + 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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + '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); + + 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); + + final Map apiParams = { + + 'key': key, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'elements': elements, +'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); + + 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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'required': xrequired, +'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.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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'required': xrequired, +'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.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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + '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); + + return models.AttributeIp.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); + + final Map apiParams = { + + 'relatedCollectionId': relatedCollectionId, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, 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); + + final Map apiParams = { + + 'key': key, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'required': xrequired, +'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); + + return models.AttributeString.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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + '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); + + return models.AttributeUrl.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); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } + + /// 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); + + 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 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/{key}/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + + final Map apiParams = { + + 'onDelete': onDelete?.value, +'newKey': newKey, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.AttributeRelationship.fromMap(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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documentId': documentId, +'data': data, +'permissions': permissions, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, required Map data, List? permissions}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + final Map apiParams = { + + 'data': data, +'permissions': permissions, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + final Map apiParams = { + + 'data': data, +'permissions': permissions, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + 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; + + } + + /// 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}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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, +'orders': orders, +'lengths': lengths, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Index.fromMap(res.data); + + } + + /// Get index by 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); + + final Map apiParams = { + + + }; + + final Map 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); + + 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; + + } +} \ No newline at end of file diff --git a/lib/services/functions.dart b/lib/services/functions.dart index e86f1afe..ad261abf 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -3,768 +3,623 @@ part of '../dart_appwrite.dart'; /// The Functions Service allows you view, create and manage your Cloud /// Functions. class Functions extends Service { - 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, - }) async { - final String apiPath = '/functions'; - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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? specification, - }) async { - final String apiPath = '/functions'; - - final Map apiParams = { - 'functionId': functionId, - 'name': name, - 'runtime': runtime.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = {}; - - final Map 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'; - - final Map apiParams = {}; - - final Map 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, - ); - - final Map apiParams = {}; - - final Map 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? specification, - }) async { - final String apiPath = '/functions/{functionId}'.replaceAll( - '{functionId}', - functionId, - ); - - final Map apiParams = { - 'name': name, - 'runtime': runtime?.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - ); - - 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 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, - ); - - 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, - ); - - 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, - }) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll( - '{functionId}', - functionId, - ); - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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, - ); - - final Map apiParams = { - 'entrypoint': entrypoint, - 'commands': commands, - 'code': code, - 'activate': activate, - }; - - final Map apiHeaders = { - 'content-type': 'multipart/form-data', - }; - - String idParamName = ''; - final paramName = 'code'; - final res = await client.chunkedUpload( - path: apiPath, - params: apiParams, - paramName: paramName, - idParamName: idParamName, - headers: apiHeaders, - onProgress: onProgress, - ); - - 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); - - final Map apiParams = { - 'deploymentId': deploymentId, - 'buildId': buildId, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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/server/functions#listTemplates) to - /// find the template details. - Future createTemplateDeployment({ - required String functionId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - bool? activate, - }) async { - final String apiPath = '/functions/{functionId}/deployments/template' - .replaceAll('{functionId}', functionId); - - final Map apiParams = { - 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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.VCSDeploymentType 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, - 'activate': activate, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = {}; - - final Map 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); - - 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 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); - - final Map params = { - '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, - ); - 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); - - 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.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, - }) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll( - '{functionId}', - functionId, - ); - - final Map apiParams = {'queries': queries}; - - final Map 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, - ); - - final Map apiParams = { - 'body': body, - 'async': xasync, - 'path': path, - 'method': method?.value, - 'headers': headers, - 'scheduledAt': scheduledAt, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = {}; - - final Map 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); - - 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 variables of a specific function. - Future listVariables({ - required String functionId, - }) async { - final String apiPath = '/functions/{functionId}/variables'.replaceAll( - '{functionId}', - functionId, - ); - - final Map apiParams = {}; - - 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, - ); - - final Map apiParams = { - 'key': key, - 'value': value, - 'secret': secret, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = {}; - - final Map 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); - - final Map apiParams = { - 'key': key, - 'value': value, - 'secret': secret, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - 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; - } -} + 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}) async { + final String apiPath = '/functions'; + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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? specification}) async { + final String apiPath = '/functions'; + + final Map apiParams = { + + 'functionId': functionId, +'name': name, +'runtime': runtime.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + + }; + + final Map 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'; + + final Map apiParams = { + + + }; + + final Map 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); + + final Map apiParams = { + + + }; + + final Map 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? specification}) async { + final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); + + final Map apiParams = { + + 'name': name, +'runtime': runtime?.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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 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); + + 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); + + 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}) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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); + + final Map apiParams = { + + 'entrypoint': entrypoint, +'commands': commands, +'code': code, +'activate': activate, + + }; + + final Map apiHeaders = { + 'content-type': 'multipart/form-data', + + }; + + String idParamName = ''; + final paramName = 'code'; + final res = await client.chunkedUpload( + path: apiPath, + params: apiParams, + paramName: paramName, + idParamName: idParamName, + headers: apiHeaders, + onProgress: onProgress, + ); + + 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); + + final Map apiParams = { + + 'deploymentId': deploymentId, +'buildId': buildId, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/functions#listTemplates) to + /// find the template details. + Future createTemplateDeployment({required String functionId, required String repository, required String owner, required String rootDirectory, required String version, bool? activate}) async { + final String apiPath = '/functions/{functionId}/deployments/template'.replaceAll('{functionId}', functionId); + + final Map apiParams = { + + 'repository': repository, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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.VCSDeploymentType 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, +'activate': activate, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + 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 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); + + final Map params = { + '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); + 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); + + 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.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}) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + + final Map apiParams = { + + 'body': body, +'async': xasync, +'path': path, +'method': method?.value, +'headers': headers, +'scheduledAt': scheduledAt, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + 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 variables of a specific function. + Future listVariables({required String functionId}) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll('{functionId}', functionId); + + final Map apiParams = { + + + }; + + 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); + + final Map apiParams = { + + 'key': key, +'value': value, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + final Map apiParams = { + + 'key': key, +'value': value, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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; + + } +} \ No newline at end of file diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index 18eb54f1..92cc591f 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -3,47 +3,49 @@ part of '../dart_appwrite.dart'; /// The GraphQL API allows you to query and mutate your Appwrite server using /// GraphQL. class Graphql extends Service { - Graphql(super.client); - - /// Execute a GraphQL mutation. - 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', - }; - - 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'; - - final Map apiParams = {'query': query}; - - final Map apiHeaders = { - 'x-sdk-graphql': 'true', - 'content-type': 'application/json', - }; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } -} + Graphql(super.client); + + /// Execute a GraphQL mutation. + 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', + + }; + + 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'; + + final Map apiParams = { + + 'query': query, + + }; + + final Map apiHeaders = { + 'x-sdk-graphql': 'true', +'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/health.dart b/lib/services/health.dart index 5250c91d..3bfeba6b 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -3,434 +3,459 @@ part of '../dart_appwrite.dart'; /// 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'; + /// Check the Appwrite HTTP server is up and responsive. + 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); - } + 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'; + } - final Map apiParams = {}; + /// Check the Appwrite Antivirus server is up and connection is successful. + Future getAntivirus() async { + final String apiPath = '/health/anti-virus'; - final Map apiHeaders = {}; + final Map apiParams = { + + + }; - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + + }; - return models.HealthAntivirus.fromMap(res.data); - } + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - /// Check the Appwrite in-memory cache servers are up and connection is - /// successful. - Future getCache() async { - final String apiPath = '/health/cache'; + return models.HealthAntivirus.fromMap(res.data); - final Map apiParams = {}; + } - final Map apiHeaders = {}; + /// Check the Appwrite in-memory cache servers are up and connection is + /// successful. + Future getCache() async { + final String apiPath = '/health/cache'; - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiParams = { + + + }; - return models.HealthStatus.fromMap(res.data); - } + final Map apiHeaders = { + + }; - /// Get the SSL certificate for a domain - Future getCertificate({String? domain}) async { - final String apiPath = '/health/certificate'; + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - final Map apiParams = {'domain': domain}; + return models.HealthStatus.fromMap(res.data); - final Map apiHeaders = {}; + } - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// Get the SSL certificate for a domain + Future getCertificate({String? domain}) async { + final String apiPath = '/health/certificate'; - return models.HealthCertificate.fromMap(res.data); - } + final Map apiParams = { + 'domain': domain, - /// Check the Appwrite database servers are up and connection is successful. - Future getDB() async { - final String apiPath = '/health/db'; + + }; - 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.HealthCertificate.fromMap(res.data); - return models.HealthStatus.fromMap(res.data); - } + } - /// Check the Appwrite pub-sub servers are up and connection is successful. - Future getPubSub() async { - final String apiPath = '/health/pubsub'; + /// Check the Appwrite database servers are up and connection is successful. + 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.HealthStatus.fromMap(res.data); - } + return models.HealthStatus.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'; + } - final Map apiParams = {'threshold': threshold}; + /// Check the Appwrite pub-sub servers are up and connection is successful. + Future getPubSub() async { + final String apiPath = '/health/pubsub'; - final Map apiHeaders = {}; + final Map apiParams = { + + + }; - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + + }; - return models.HealthQueue.fromMap(res.data); - } + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - /// 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'; + return models.HealthStatus.fromMap(res.data); - final Map apiParams = {'threshold': threshold}; + } - final Map apiHeaders = {}; + /// 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'; - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiParams = { + 'threshold': threshold, - 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'; + final Map apiHeaders = { + + }; - final Map apiParams = { - 'name': name, - 'threshold': threshold, - }; + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - final Map apiHeaders = {}; + return models.HealthQueue.fromMap(res.data); - 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'; - /// 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'; - - final Map apiParams = {'threshold': threshold}; - - final Map 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, - ); + final Map apiParams = { + 'threshold': threshold, - final Map apiParams = {'threshold': threshold}; + + }; - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map 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'; + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - final Map apiParams = {'threshold': threshold}; + return models.HealthQueue.fromMap(res.data); - final Map 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'; - /// 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'; + final Map apiParams = { + 'name': name, +'threshold': threshold, - final Map apiParams = {'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); - } + 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'; + } - final Map apiParams = {'threshold': threshold}; + /// 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'; - final Map apiHeaders = {}; + final Map apiParams = { + 'threshold': threshold, - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + + }; - return models.HealthQueue.fromMap(res.data); - } + final Map apiHeaders = { + + }; - /// 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'; + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - final Map apiParams = {'threshold': threshold}; + return models.HealthQueue.fromMap(res.data); - final Map apiHeaders = {}; + } - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// 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); - return models.HealthQueue.fromMap(res.data); - } + final Map apiParams = { + 'threshold': threshold, - /// 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'; + + }; - final Map apiParams = {'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); - 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'; + /// 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'; - final Map apiParams = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - final Map apiHeaders = {}; + + }; - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + + }; - return models.HealthQueue.fromMap(res.data); - } + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - /// 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'; + return models.HealthQueue.fromMap(res.data); - final Map apiParams = {'threshold': threshold}; + } - final Map apiHeaders = {}; + /// 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'; - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiParams = { + 'threshold': threshold, - 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'; + final Map apiHeaders = { + + }; - final Map apiParams = {'threshold': threshold}; + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - final Map apiHeaders = {}; + return models.HealthQueue.fromMap(res.data); - 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'; - /// Check the Appwrite storage device is up and connection is successful. - Future getStorage() async { - final String apiPath = '/health/storage'; + final Map apiParams = { + 'threshold': threshold, - 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); - } + return models.HealthQueue.fromMap(res.data); - /// Check the Appwrite local storage device is up and connection is successful. - Future getStorageLocal() async { - final String apiPath = '/health/storage/local'; + } - final Map apiParams = {}; + /// 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'; - final Map apiHeaders = {}; + final Map apiParams = { + 'threshold': threshold, - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + + }; - return models.HealthStatus.fromMap(res.data); - } + final Map apiHeaders = { + + }; - /// Check the Appwrite server time is synced with Google remote NTP server. We - /// use this technology to smoothly handle leap seconds with no disruptive - /// events. The [Network Time - /// Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is - /// 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'; + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - final Map apiParams = {}; + return models.HealthQueue.fromMap(res.data); - final Map apiHeaders = {}; + } - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// 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'; - return models.HealthTime.fromMap(res.data); - } -} + final Map apiParams = { + 'threshold': threshold, + + + }; + + final Map 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'; + + final Map apiParams = { + 'threshold': threshold, + + + }; + + final Map 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'; + + final Map apiParams = { + 'threshold': threshold, + + + }; + + final Map 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'; + + final Map apiParams = { + 'threshold': threshold, + + + }; + + final Map 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'; + + final Map apiParams = { + + + }; + + final Map 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'; + + final Map apiParams = { + + + }; + + final Map 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 + /// events. The [Network Time + /// Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + /// 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'; + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.HealthTime.fromMap(res.data); + + } +} \ No newline at end of file diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 4d3cc3e0..b75b4711 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -3,162 +3,170 @@ part of '../dart_appwrite.dart'; /// 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'; + /// 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'; - 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); - } + 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'; + } - final Map apiParams = {}; + /// 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'; - final Map apiHeaders = {}; + final Map apiParams = { + + + }; - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + + }; - return models.LocaleCodeList.fromMap(res.data); - } + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - /// 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'; + return models.LocaleCodeList.fromMap(res.data); - final Map apiParams = {}; + } - final Map apiHeaders = {}; + /// 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'; - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiParams = { + + + }; - return models.ContinentList.fromMap(res.data); - } + final Map apiHeaders = { + + }; - /// 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'; + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - final Map apiParams = {}; + return models.ContinentList.fromMap(res.data); - final Map apiHeaders = {}; + } - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// 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'; - return models.CountryList.fromMap(res.data); - } + final Map apiParams = { + + + }; - /// 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'; + final Map apiHeaders = { + + }; - final Map apiParams = {}; + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - final Map apiHeaders = {}; + return models.CountryList.fromMap(res.data); - 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'; - /// 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'; + 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); - 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'; + /// 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'; - 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); - } + return models.PhoneList.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'; + } - final Map apiParams = {}; + /// 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'; - final Map apiHeaders = {}; + final Map apiParams = { + + + }; - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + + }; - return models.LanguageList.fromMap(res.data); - } -} + 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'; + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.LanguageList.fromMap(res.data); + + } +} \ No newline at end of file diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index afe3ee86..710bb6d4 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -3,1476 +3,1158 @@ part of '../dart_appwrite.dart'; /// The Messaging service allows you to send messages to any provider type /// (SMTP, push notification, SMS, etc.). class Messaging extends Service { - Messaging(super.client); - - /// Get a list of all messages from the current Appwrite project. - Future listMessages({ - List? queries, - String? search, - }) async { - final String apiPath = '/messaging/messages'; - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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'; - - final Map apiParams = { - 'messageId': messageId, - 'subject': subject, - 'content': content, - 'topics': topics, - 'users': users, - 'targets': targets, - 'cc': cc, - 'bcc': bcc, - 'attachments': attachments, - 'draft': draft, - 'html': html, - 'scheduledAt': scheduledAt, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - ); - - 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'messageId': messageId, - 'title': title, - 'body': body, - 'topics': topics, - 'users': users, - 'targets': targets, - '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.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, - ); - - 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - 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'; - - final Map apiParams = { - 'messageId': messageId, - 'content': content, - 'topics': topics, - 'users': users, - 'targets': targets, - 'draft': draft, - 'scheduledAt': scheduledAt, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - /// - 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - ); - - final Map apiParams = {}; - - final Map 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, - ); - - 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 the message activity logs listed by its unique ID. - Future listMessageLogs({ - required String messageId, - List? queries, - }) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map 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, - }) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map 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, - }) async { - final String apiPath = '/messaging/providers'; - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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. - 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, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - 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 = { - 'name': name, - 'enabled': enabled, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - 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 = { - 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'providerId': providerId, - 'name': name, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = { - 'name': name, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'enabled': enabled, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'providerId': providerId, - 'name': name, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - ); - - final Map apiParams = { - 'name': name, - 'enabled': enabled, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'providerId': providerId, - 'name': name, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = { - 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - 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'; - - final Map apiParams = { - 'providerId': providerId, - 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - 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 = { - 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'providerId': providerId, - 'name': name, - 'from': from, - 'customerId': customerId, - 'apiKey': apiKey, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = { - 'name': name, - 'enabled': enabled, - 'customerId': customerId, - 'apiKey': apiKey, - 'from': from, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'providerId': providerId, - 'name': name, - 'from': from, - 'username': username, - 'apiKey': apiKey, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = { - 'name': name, - 'enabled': enabled, - 'username': username, - 'apiKey': apiKey, - 'from': from, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'providerId': providerId, - 'name': name, - 'from': from, - 'accountSid': accountSid, - 'authToken': authToken, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = { - 'name': name, - 'enabled': enabled, - 'accountSid': accountSid, - 'authToken': authToken, - 'from': from, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'providerId': providerId, - 'name': name, - 'from': from, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = { - 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'from': from, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - ); - - final Map apiParams = {}; - - final Map 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, - ); - - 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 the provider activity logs listed by its unique ID. - Future listProviderLogs({ - required String providerId, - List? queries, - }) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( - '{providerId}', - providerId, - ); - - final Map apiParams = {'queries': queries}; - - final Map 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, - }) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs' - .replaceAll('{subscriberId}', subscriberId); - - final Map apiParams = {'queries': queries}; - - final Map 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, - }) async { - final String apiPath = '/messaging/topics'; - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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'; - - final Map apiParams = { - 'topicId': topicId, - 'name': name, - 'subscribe': subscribe, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - ); - - final Map apiParams = {}; - - final Map 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, - ); - - final Map apiParams = { - 'name': name, - 'subscribe': subscribe, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - ); - - 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 the topic activity logs listed by its unique ID. - Future listTopicLogs({ - required String topicId, - List? queries, - }) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( - '{topicId}', - topicId, - ); - - final Map apiParams = {'queries': queries}; - - final Map 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, - }) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( - '{topicId}', - topicId, - ); - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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, - ); - - final Map apiParams = { - 'subscriberId': subscriberId, - 'targetId': targetId, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = {}; - - final Map 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); - - 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; - } -} + Messaging(super.client); + + /// Get a list of all messages from the current Appwrite project. + Future listMessages({List? queries, String? search}) async { + final String apiPath = '/messaging/messages'; + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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'; + + final Map apiParams = { + + 'messageId': messageId, +'subject': subject, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'cc': cc, +'bcc': bcc, +'attachments': attachments, +'draft': draft, +'html': html, +'scheduledAt': scheduledAt, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'messageId': messageId, +'title': title, +'body': body, +'topics': topics, +'users': users, +'targets': targets, +'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.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); + + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, 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'; + + final Map apiParams = { + + 'messageId': messageId, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'draft': draft, +'scheduledAt': scheduledAt, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. + /// + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + 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 the message activity logs listed by its unique ID. + Future listMessageLogs({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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}) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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}) async { + final String apiPath = '/messaging/providers'; + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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. + 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, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. + 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 = { + + 'name': name, +'enabled': enabled, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. + 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 = { + + 'name': name, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'providerId': providerId, +'name': name, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'name': name, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'enabled': enabled, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'providerId': providerId, +'name': name, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'providerId': providerId, +'name': name, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, 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'; + + final Map apiParams = { + + 'providerId': providerId, +'name': name, +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. + 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 = { + + 'name': name, +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'providerId': providerId, +'name': name, +'from': from, +'customerId': customerId, +'apiKey': apiKey, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, +'customerId': customerId, +'apiKey': apiKey, +'from': from, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'providerId': providerId, +'name': name, +'from': from, +'username': username, +'apiKey': apiKey, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, +'username': username, +'apiKey': apiKey, +'from': from, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'providerId': providerId, +'name': name, +'from': from, +'accountSid': accountSid, +'authToken': authToken, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, +'accountSid': accountSid, +'authToken': authToken, +'from': from, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'providerId': providerId, +'name': name, +'from': from, +'apiKey': apiKey, +'apiSecret': apiSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, +'apiKey': apiKey, +'apiSecret': apiSecret, +'from': from, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + 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 the provider activity logs listed by its unique ID. + Future listProviderLogs({required String providerId, List? queries}) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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}) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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}) async { + final String apiPath = '/messaging/topics'; + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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'; + + final Map apiParams = { + + 'topicId': topicId, +'name': name, +'subscribe': subscribe, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + final Map apiParams = { + + 'name': name, +'subscribe': subscribe, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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 the topic activity logs listed by its unique ID. + Future listTopicLogs({required String topicId, List? queries}) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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); + + final Map apiParams = { + + 'subscriberId': subscriberId, +'targetId': targetId, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + 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; + + } +} \ No newline at end of file diff --git a/lib/services/sites.dart b/lib/services/sites.dart index d89f2192..90511473 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -2,703 +2,585 @@ part of '../dart_appwrite.dart'; /// The Sites Service allows you view, create and manage your web applications. class Sites extends Service { - 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}) async { - final String apiPath = '/sites'; - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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? outputDirectory, - enums.Adapter? adapter, - String? installationId, - String? fallbackFile, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) async { - final String apiPath = '/sites'; - - final Map apiParams = { - 'siteId': siteId, - 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime.value, - 'adapter': adapter?.value, - 'installationId': installationId, - 'fallbackFile': fallbackFile, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = {}; - - final Map 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'; - - final Map apiParams = {}; - - final Map 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); - - final Map apiParams = {}; - - final Map 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? outputDirectory, - enums.BuildRuntime? buildRuntime, - enums.Adapter? adapter, - String? fallbackFile, - String? installationId, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) async { - final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime?.value, - 'adapter': adapter?.value, - 'fallbackFile': fallbackFile, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - 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 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, - ); - - 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, - ); - - 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, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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 function's deployment to use your new deployment ID. - Future createDeployment({ - required String siteId, - required InputFile code, - required bool activate, - String? installCommand, - String? buildCommand, - String? outputDirectory, - Function(UploadProgress)? onProgress, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); - - final Map apiParams = { - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'code': code, - 'activate': activate, - }; - - final Map apiHeaders = { - 'content-type': 'multipart/form-data', - }; - - String idParamName = ''; - final paramName = 'code'; - final res = await client.chunkedUpload( - path: apiPath, - params: apiParams, - paramName: paramName, - idParamName: idParamName, - headers: apiHeaders, - onProgress: onProgress, - ); - - 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, - ); - - 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, - ); - - return models.Deployment.fromMap(res.data); - } - - /// Create a deployment based on a template. - /// - /// Use this endpoint with combination of - /// [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to - /// find the template details. - Future createTemplateDeployment({ - required String siteId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - bool? activate, - }) async { - final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll( - '{siteId}', - siteId, - ); - - final Map apiParams = { - 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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.VCSDeploymentType 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, - 'activate': activate, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = {}; - - final Map 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); - - 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 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); - - final Map params = { - '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, - ); - 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); - - 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.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, - }) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll( - '{siteId}', - siteId, - ); - - final Map apiParams = {'queries': queries}; - - final Map 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); - - final Map apiParams = {}; - - final Map 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); - - 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 variables of a specific site. - Future listVariables({required String siteId}) async { - final String apiPath = '/sites/{siteId}/variables'.replaceAll( - '{siteId}', - siteId, - ); - - final Map apiParams = {}; - - 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, - ); - - final Map apiParams = { - 'key': key, - 'value': value, - 'secret': secret, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = {}; - - final Map 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); - - final Map apiParams = { - 'key': key, - 'value': value, - 'secret': secret, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - 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; - } -} + 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}) async { + final String apiPath = '/sites'; + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites'; + + final Map apiParams = { + + 'siteId': siteId, +'name': name, +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime.value, +'adapter': adapter?.value, +'installationId': installationId, +'fallbackFile': fallbackFile, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + + }; + + final Map 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'; + + final Map apiParams = { + + + }; + + final Map 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); + + final Map apiParams = { + + + }; + + final Map 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); + + final Map apiParams = { + + 'name': name, +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime?.value, +'adapter': adapter?.value, +'fallbackFile': fallbackFile, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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 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); + + 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); + + 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}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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 function's deployment to use your new deployment ID. + Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + + final Map apiParams = { + + 'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'code': code, +'activate': activate, + + }; + + final Map apiHeaders = { + 'content-type': 'multipart/form-data', + + }; + + String idParamName = ''; + final paramName = 'code'; + final res = await client.chunkedUpload( + path: apiPath, + params: apiParams, + paramName: paramName, + idParamName: idParamName, + headers: apiHeaders, + onProgress: onProgress, + ); + + 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); + + 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); + + return models.Deployment.fromMap(res.data); + + } + + /// Create a deployment based on a template. + /// + /// Use this endpoint with combination of + /// [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to + /// find the template details. + Future createTemplateDeployment({required String siteId, required String repository, required String owner, required String rootDirectory, required String version, bool? activate}) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll('{siteId}', siteId); + + final Map apiParams = { + + 'repository': repository, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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.VCSDeploymentType 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, +'activate': activate, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + 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 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); + + final Map params = { + '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); + 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); + + 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.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}) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + + final Map apiParams = { + + + }; + + final Map 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); + + 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 variables of a specific site. + Future listVariables({required String siteId}) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); + + final Map apiParams = { + + + }; + + 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); + + final Map apiParams = { + + 'key': key, +'value': value, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + final Map apiParams = { + + 'key': key, +'value': value, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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; + + } +} \ No newline at end of file diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ee630883..9165e91b 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -2,421 +2,329 @@ part of '../dart_appwrite.dart'; /// The Storage service allows you to manage your project files. class Storage extends Service { - 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, - }) async { - final String apiPath = '/storage/buckets'; - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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, - }) async { - final String apiPath = '/storage/buckets'; - - final Map apiParams = { - 'bucketId': bucketId, - 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - ); - - final Map apiParams = {}; - - final Map 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, - }) async { - final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( - '{bucketId}', - bucketId, - ); - - final Map apiParams = { - 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - ); - - 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 the user files. You can use the query params to filter - /// your results. - Future listFiles({ - required String bucketId, - List? queries, - String? search, - }) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( - '{bucketId}', - bucketId, - ); - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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, - ); - - final Map apiParams = { - 'fileId': fileId, - 'file': file, - 'permissions': permissions, - }; - - final Map apiHeaders = { - 'content-type': 'multipart/form-data', - }; - - String idParamName = ''; - idParamName = 'fileId'; - final paramName = 'file'; - final res = await client.chunkedUpload( - path: apiPath, - params: apiParams, - paramName: paramName, - idParamName: idParamName, - headers: apiHeaders, - onProgress: onProgress, - ); - - 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); - - final Map apiParams = {}; - - final Map 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); - - final Map apiParams = { - 'name': name, - 'permissions': permissions, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - 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 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); - - final Map params = { - 'token': token, - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - 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); - - final Map params = { - 'width': width, - 'height': height, - 'gravity': gravity?.value, - 'quality': quality, - 'borderWidth': borderWidth, - 'borderColor': borderColor, - 'borderRadius': borderRadius, - 'opacity': opacity, - 'rotation': rotation, - 'background': background, - 'output': output?.value, - 'token': token, - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - 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); - - final Map params = { - 'token': token, - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: params, - responseType: ResponseType.bytes, - ); - return res.data; - } -} + 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}) async { + final String apiPath = '/storage/buckets'; + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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}) async { + final String apiPath = '/storage/buckets'; + + final Map apiParams = { + + 'bucketId': bucketId, +'name': name, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); + + final Map apiParams = { + + 'name': name, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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 the user files. You can use the query params to filter + /// your results. + Future listFiles({required String bucketId, List? queries, String? search}) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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); + + final Map apiParams = { + + 'fileId': fileId, +'file': file, +'permissions': permissions, + + }; + + final Map apiHeaders = { + 'content-type': 'multipart/form-data', + + }; + + String idParamName = ''; + idParamName = 'fileId'; + final paramName = 'file'; + final res = await client.chunkedUpload( + path: apiPath, + params: apiParams, + paramName: paramName, + idParamName: idParamName, + headers: apiHeaders, + onProgress: onProgress, + ); + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + final Map apiParams = { + + 'name': name, +'permissions': permissions, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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 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); + + final Map params = { + 'token': token, + + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + 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); + + final Map params = { + 'width': width, +'height': height, +'gravity': gravity?.value, +'quality': quality, +'borderWidth': borderWidth, +'borderColor': borderColor, +'borderRadius': borderRadius, +'opacity': opacity, +'rotation': rotation, +'background': background, +'output': output?.value, +'token': token, + + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + 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); + + final Map params = { + 'token': token, + + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); + return res.data; + } +} \ No newline at end of file diff --git a/lib/services/tables-db.dart b/lib/services/tables-db.dart new file mode 100644 index 00000000..05780266 --- /dev/null +++ b/lib/services/tables-db.dart @@ -0,0 +1,1163 @@ +part of '../dart_appwrite.dart'; + +class TablesDb extends Service { + 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}) async { + final String apiPath = '/tablesdb'; + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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, enums.Type? type}) async { + final String apiPath = '/tablesdb'; + + final Map apiParams = { + + 'databaseId': databaseId, +'name': name, +'enabled': enabled, +'type': type?.value, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Database.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); + + final Map apiParams = { + + + }; + + final Map 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, required String name, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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/server/databases#databasesCreateTable) + /// API or directly from your database console. + Future createTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'tableId': tableId, +'name': name, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'name': name, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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; + + } + + /// List columns in the table. + Future listColumns({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + '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); + + 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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + '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); + + 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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + '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); + + 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); + + final Map apiParams = { + + 'key': key, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'elements': elements, +'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); + + 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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'required': xrequired, +'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.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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'required': xrequired, +'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.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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + '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); + + return models.ColumnIp.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); + + final Map apiParams = { + + 'relatedTableId': relatedTableId, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ColumnRelationship.fromMap(res.data); + + } + + /// Create a string column. + /// + 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, +'array': array, +'encrypt': encrypt, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. + /// + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ColumnString.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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + '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); + + return models.ColumnUrl.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); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } + + /// 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); + + 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 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); + + final Map apiParams = { + + 'onDelete': onDelete?.value, +'newKey': newKey, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ColumnRelationship.fromMap(res.data); + + } + + /// List indexes in the collection. + Future listIndexes({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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. + /// Attributes can be `key`, `fulltext`, and `unique`. + Future createIndex({required String databaseId, required String tableId, required String key, required enums.IndexType 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, +'orders': orders, +'lengths': lengths, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + 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 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/databases#databasesCreateTable) + /// API or directly from your database console. + Future createRow({required String databaseId, required String tableId, required String rowId, required Map data, List? permissions}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rowId': rowId, +'data': data, +'permissions': permissions, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/databases#databasesCreateTable) + /// API or directly from your database console. + Future createRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/databases#databasesCreateTable) + /// API or directly from your database console. + /// + Future upsertRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/databases#databasesCreateTable) + /// API or directly from your database console. + Future upsertRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + final Map apiParams = { + + 'data': data, +'permissions': permissions, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + final Map apiParams = { + + 'data': data, +'permissions': permissions, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + 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; + + } + + /// 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}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Row.fromMap(res.data); + + } +} \ No newline at end of file diff --git a/lib/services/teams.dart b/lib/services/teams.dart index 5fd59641..2b492f27 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -3,356 +3,321 @@ 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 class Teams extends Service { - 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}) async { - final String apiPath = '/teams'; - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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'; - - final Map apiParams = { - 'teamId': teamId, - 'name': name, - 'roles': roles, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = {}; - - final Map 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); - - 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, - ); - - 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); - - 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; - } - - /// 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, - }) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll( - '{teamId}', - teamId, - ); - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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 - /// a Client SDK, Appwrite will send an email or sms with a link to join the - /// 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. - /// - /// 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, - ); - - final Map apiParams = { - 'email': email, - 'userId': userId, - 'phone': phone, - 'roles': roles, - 'url': url, - 'name': name, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = {}; - - final Map 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); - - 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, - ); - - 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); - - 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; - } - - /// 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); - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - ); - - final Map apiParams = {}; - - final Map 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, - ); - - 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, - ); - - return models.Preferences.fromMap(res.data); - } -} + 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}) async { + final String apiPath = '/teams'; + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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'; + + final Map apiParams = { + + 'teamId': teamId, +'name': name, +'roles': roles, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + 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); + + 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); + + 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; + + } + + /// 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}) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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 + /// a Client SDK, Appwrite will send an email or sms with a link to join the + /// 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. + /// + /// 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); + + final Map apiParams = { + + 'email': email, +'userId': userId, +'phone': phone, +'roles': roles, +'url': url, +'name': name, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + 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); + + 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); + + 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; + + } + + /// 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); + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + 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); + + return models.Preferences.fromMap(res.data); + + } +} \ No newline at end of file diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index 4e6915dc..366d7135 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,113 +1,109 @@ part of '../dart_appwrite.dart'; class Tokens extends Service { - 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, - }) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); - - final Map apiParams = {'queries': queries}; - - final Map 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); - - 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, - ); - - 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); - - final Map apiParams = {}; - - final Map 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); - - 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, - ); - - 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); - - 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; - } -} + 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}) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + + 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); + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + 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); + + 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); + + 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; + + } +} \ No newline at end of file diff --git a/lib/services/users.dart b/lib/services/users.dart index c98182b7..765ec3e6 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -2,1107 +2,962 @@ part of '../dart_appwrite.dart'; /// The Users service allows you to manage your project users. class Users extends Service { - 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}) async { - final String apiPath = '/users'; - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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'; - - final Map apiParams = { - 'userId': userId, - 'email': email, - 'phone': phone, - 'password': password, - 'name': name, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'userId': userId, - 'email': email, - 'password': password, - 'name': name, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'userId': userId, - 'email': email, - 'password': password, - 'name': name, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - }) async { - final String apiPath = '/users/identities'; - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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, - ); - - 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; - } - - /// 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'; - - final Map apiParams = { - 'userId': userId, - 'email': email, - 'password': password, - 'name': name, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'userId': userId, - 'email': email, - 'password': password, - 'name': name, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'userId': userId, - 'email': email, - 'password': password, - 'passwordSalt': passwordSalt, - 'passwordCpu': passwordCpu, - 'passwordMemory': passwordMemory, - 'passwordParallel': passwordParallel, - 'passwordLength': passwordLength, - 'name': name, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'userId': userId, - 'email': email, - 'password': password, - 'passwordSalt': passwordSalt, - 'passwordSaltSeparator': passwordSaltSeparator, - 'passwordSignerKey': passwordSignerKey, - 'name': name, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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'; - - final Map apiParams = { - 'userId': userId, - 'email': email, - 'password': password, - 'passwordVersion': passwordVersion?.value, - 'name': name, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = {}; - - final Map 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 - /// storage files should be deleted before user deletion. If you want to keep - /// ID reserved, use the - /// [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) - /// endpoint instead. - Future delete({required String userId}) async { - final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); - - 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 user email by its unique ID. - 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, - ); - - 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, - ); - - final Map apiParams = { - 'sessionId': sessionId, - 'duration': duration, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - /// - /// 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, - ); - - 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.User.fromMap(res.data); - } - - /// Get the user activity logs list by its unique ID. - Future listLogs({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/logs'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map 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, - }) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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. - 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, - ); - - return models.User.fromMap(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); - - 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; - } - - /// 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, - ); - - final Map apiParams = {}; - - final Map 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. - Future getMfaRecoveryCodes({ - required String userId, - }) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {}; - - final Map 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. - Future updateMfaRecoveryCodes({ - required String userId, - }) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - Future createMfaRecoveryCodes({ - required String userId, - }) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( - '{userId}', - userId, - ); - - 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.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, - ); - - 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, - ); - - 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, - ); - - 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, - ); - - 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, - ); - - 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, - ); - - 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, - ); - - final Map apiParams = {}; - - final Map 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, - ); - - 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, - ); - - return models.Preferences.fromMap(res.data); - } - - /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {}; - - final Map 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - ); - - 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; - } - - /// 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); - - 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 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, - ); - - 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, - ); - - return models.User.fromMap(res.data); - } - - /// List the messaging targets that are associated with a user. - Future listTargets({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/targets'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map 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, - ); - - final Map apiParams = { - 'targetId': targetId, - 'providerType': providerType.value, - 'identifier': identifier, - 'providerId': providerId, - 'name': name, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = {}; - - final Map 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); - - final Map apiParams = { - 'identifier': identifier, - 'providerId': providerId, - 'name': name, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - 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; - } - - /// 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, - ); - - final Map apiParams = {'length': length, 'expire': expire}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - ); - - 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, - ); - - 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, - ); - - 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, - ); - - return models.User.fromMap(res.data); - } -} + 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}) async { + final String apiPath = '/users'; + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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'; + + final Map apiParams = { + + 'userId': userId, +'email': email, +'phone': phone, +'password': password, +'name': name, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'userId': userId, +'email': email, +'password': password, +'name': name, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'userId': userId, +'email': email, +'password': password, +'name': name, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/users/identities'; + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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); + + 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; + + } + + /// 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'; + + final Map apiParams = { + + 'userId': userId, +'email': email, +'password': password, +'name': name, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'userId': userId, +'email': email, +'password': password, +'name': name, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'userId': userId, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordCpu': passwordCpu, +'passwordMemory': passwordMemory, +'passwordParallel': passwordParallel, +'passwordLength': passwordLength, +'name': name, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'userId': userId, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordSaltSeparator': passwordSaltSeparator, +'passwordSignerKey': passwordSignerKey, +'name': name, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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'; + + final Map apiParams = { + + 'userId': userId, +'email': email, +'password': password, +'passwordVersion': passwordVersion?.value, +'name': name, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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 + /// storage files should be deleted before user deletion. If you want to keep + /// ID reserved, use the + /// [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) + /// endpoint instead. + Future delete({required String userId}) async { + final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); + + 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 user email by its unique ID. + 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); + + 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); + + final Map apiParams = { + + 'sessionId': sessionId, +'duration': duration, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. + /// + /// 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); + + 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.User.fromMap(res.data); + + } + + /// Get the user activity logs list by its unique ID. + Future listLogs({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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}) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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. + 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); + + return models.User.fromMap(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); + + 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; + + } + + /// 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); + + final Map apiParams = { + + + }; + + final Map 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. + Future getMfaRecoveryCodes({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + + final Map apiParams = { + + + }; + + final Map 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. + Future updateMfaRecoveryCodes({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. + Future createMfaRecoveryCodes({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + + 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.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); + + 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); + + 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); + + 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); + + 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); + + 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); + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + 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); + + return models.Preferences.fromMap(res.data); + + } + + /// Get the user sessions list by its unique ID. + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); + + final Map apiParams = { + + + }; + + final Map 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); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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; + + } + + /// 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); + + 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 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); + + 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); + + return models.User.fromMap(res.data); + + } + + /// List the messaging targets that are associated with a user. + Future listTargets({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + + final Map apiParams = { + + 'targetId': targetId, +'providerType': providerType.value, +'identifier': identifier, +'providerId': providerId, +'name': name, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + final Map apiParams = { + + 'identifier': identifier, +'providerId': providerId, +'name': name, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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; + + } + + /// 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); + + final Map apiParams = { + + 'length': length, +'expire': expire, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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); + + 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); + + 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); + + return models.User.fromMap(res.data); + + } +} \ No newline at end of file diff --git a/lib/src/client.dart b/lib/src/client.dart index d82d623a..2fc990a5 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -8,7 +8,7 @@ import 'upload_progress.dart'; /// [Client] that handles requests to Appwrite abstract class Client { /// The size for cunked uploads in bytes. - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; /// Holds configuration such as project. late Map config; @@ -18,16 +18,16 @@ abstract class Client { String get endPoint => _endPoint; /// Initializes a [Client]. - factory Client({ - String endPoint = 'https://cloud.appwrite.io/v1', - bool selfSigned = false, - }) => createClient(endPoint: endPoint, selfSigned: selfSigned); + factory Client( + {String endPoint = 'https://cloud.appwrite.io/v1', + bool selfSigned = false}) => + 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. @@ -81,8 +81,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 08d93b85..cd82d264 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,25 +2,21 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index d84f7f78..ea2cd62a 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,11 +9,14 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -30,67 +33,60 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '16.2.0', - 'X-Appwrite-Response-Format': '1.7.0', + 'x-sdk-version': '17.0.0', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -139,11 +135,7 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -170,19 +162,12 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 544bd12f..f9e695bf 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,11 +10,17 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => - ClientIO(endPoint: endPoint, selfSigned: selfSigned); +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => + ClientIO( + endPoint: endPoint, + selfSigned: selfSigned, + ); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -36,69 +42,61 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '16.2.0', - 'user-agent': - 'AppwriteDartSDK/16.2.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format': '1.7.0', + 'x-sdk-version': '17.0.0', + 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -153,16 +151,11 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, - file.path!, - filename: file.filename, - ); + paramName, file.path!, + filename: file.filename); } else { - 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, @@ -201,19 +194,12 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -258,7 +244,10 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse(res, responseType: responseType); + return prepareResponse( + res, + responseType: responseType, + ); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 06c9ebe3..658b79b6 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest).fields.addAll({ - "$key[$i]": v.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({"$key[$i]": v.toString()}); }); } else { - (request as http.MultipartRequest).fields.addAll({ - key: value.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({key: value.toString()}); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value) { + params = params.map((key, value){ if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,13 +51,12 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port, - ); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -67,9 +66,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); @@ -116,25 +113,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/client_stub.dart b/lib/src/client_stub.dart index 2cb7727e..95e9d217 100644 --- a/lib/src/client_stub.dart +++ b/lib/src/client_stub.dart @@ -3,5 +3,4 @@ import 'client_base.dart'; /// Implemented in `browser_client.dart` and `io_client.dart`. ClientBase createClient({required String endPoint, required bool selfSigned}) => throw UnsupportedError( - 'Cannot create a client without dart:html or dart:io.', - ); + 'Cannot create a client without dart:html or dart:io.'); diff --git a/lib/src/enums.dart b/lib/src/enums.dart index 08fd6068..595afdc2 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -16,6 +16,6 @@ enum ResponseType { /// Transform the response data to a String encoded with UTF8. plain, - /// Get original bytes, the type of response will be List - bytes, + /// Get original bytes, the type of response will be `List` + bytes } diff --git a/lib/src/enums/adapter.dart b/lib/src/enums/adapter.dart index d1af0722..3b92df32 100644 --- a/lib/src/enums/adapter.dart +++ b/lib/src/enums/adapter.dart @@ -1,12 +1,14 @@ part of '../../enums.dart'; enum Adapter { - static(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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 3341912f..2f198d4e 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 1bae5c8a..cd45b6a1 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 42954430..7d2d7016 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,16 +1,18 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 e20f48c6..af5ebaad 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,24 +1,26 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index b101d35f..8d86530d 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({required this.value}); + const IndexType({ + 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/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/name.dart b/lib/src/enums/name.dart index 74823feb..613bf5f1 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,22 +1,24 @@ 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'), - 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'), + 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 383e45b1..076c1c50 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,50 +1,52 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d4fef930..d34440ec 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/type.dart b/lib/src/enums/type.dart new file mode 100644 index 00000000..1dbb0056 --- /dev/null +++ b/lib/src/enums/type.dart @@ -0,0 +1,14 @@ +part of '../../enums.dart'; + +enum Type { + tablesdb(value: 'tablesdb'), + legacy(value: 'legacy'); + + const Type({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index f01fcb01..0bf8e2ad 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({required this.value}); + const VCSDeploymentType({ + 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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index 4145f701..f174d569 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 4e901476..c9f67200 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 35c7b767..2fabb416 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index 7d27adba..fdcee07a 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index fec6f65a..120723df 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 0e80700f..504b5f8f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 bae6618f..5f3e1654 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 0ca54691..20dd7189 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1df01f19..a5b27b4f 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 21f8e9a3..96ce554b 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 298c181a..a4953a0e 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c6eecadd..03ba94c7 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1ef48332..8a5aa89d 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8c8fcb73..d17f414a 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index c5fa6adc..4098a5a1 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "attributes": attributes}; - } + Map toMap() { + return { + "total": total, + "attributes": attributes, + }; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 903c6290..050cbe14 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7374fa78..2202d255 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index f0bc295e..0c3ddf9e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index b8fb5e48..3bb374be 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 224c910d..29c56fe4 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Buckets List class BucketList implements Model { - /// Total number of buckets documents that matched your query. - final int total; + /// Total number of buckets rows 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))), + ); + } - Map toMap() { - return {"total": total, "buckets": buckets.map((p) => p.toMap()).toList()}; - } + 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 72de429d..c55110cf 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 49785e2b..81104b31 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Collections List class CollectionList implements Model { - /// Total number of collections documents that matched your query. - final int total; + /// Total number of collections rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart new file mode 100644 index 00000000..0ffc8fea --- /dev/null +++ b/lib/src/models/column_boolean.dart @@ -0,0 +1,71 @@ +part of '../../models.dart'; + +/// ColumnBoolean +class ColumnBoolean implements Model { + /// Column Key. + final String key; + + /// Column type. + final String type; + + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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; + + /// Default value for attribute when not provided. Cannot be set when attribute 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, + }); + + factory ColumnBoolean.fromMap(Map map) { + return ColumnBoolean( + key: map['key'].toString(), + type: map['type'].toString(), + status: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 new file mode 100644 index 00000000..367686d0 --- /dev/null +++ b/lib/src/models/column_datetime.dart @@ -0,0 +1,77 @@ +part of '../../models.dart'; + +/// ColumnDatetime +class ColumnDatetime implements Model { + /// Column Key. + final String key; + + /// Column type. + final String type; + + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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; + + /// ISO 8601 format. + final String format; + + /// Default value for attribute 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, + }); + + factory ColumnDatetime.fromMap(Map map) { + return ColumnDatetime( + key: map['key'].toString(), + type: map['type'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 new file mode 100644 index 00000000..7deb5e26 --- /dev/null +++ b/lib/src/models/column_email.dart @@ -0,0 +1,77 @@ +part of '../../models.dart'; + +/// ColumnEmail +class ColumnEmail implements Model { + /// Column Key. + final String key; + + /// Column type. + final String type; + + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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; + + /// String format. + final String format; + + /// Default value for attribute when not provided. Cannot be set when attribute 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, + }); + + factory ColumnEmail.fromMap(Map map) { + return ColumnEmail( + key: map['key'].toString(), + type: map['type'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 new file mode 100644 index 00000000..7bb56922 --- /dev/null +++ b/lib/src/models/column_enum.dart @@ -0,0 +1,83 @@ +part of '../../models.dart'; + +/// ColumnEnum +class ColumnEnum implements Model { + /// Column Key. + final String key; + + /// Column type. + final String type; + + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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; + + /// Array of elements in enumerated type. + final List elements; + + /// String format. + final String format; + + /// Default value for attribute when not provided. Cannot be set when attribute 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, + }); + + factory ColumnEnum.fromMap(Map map) { + return ColumnEnum( + key: map['key'].toString(), + type: map['type'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 new file mode 100644 index 00000000..c0547e11 --- /dev/null +++ b/lib/src/models/column_float.dart @@ -0,0 +1,83 @@ +part of '../../models.dart'; + +/// ColumnFloat +class ColumnFloat implements Model { + /// Column Key. + final String key; + + /// Column type. + final String type; + + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 double? min; + + /// 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; + + 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 new file mode 100644 index 00000000..acf0f6df --- /dev/null +++ b/lib/src/models/column_index.dart @@ -0,0 +1,77 @@ +part of '../../models.dart'; + +/// Index +class ColumnIndex implements Model { + /// Index ID. + final String $id; + + /// Index creation date in ISO 8601 format. + final String $createdAt; + + /// Index update date in ISO 8601 format. + final String $updatedAt; + + /// Index Key. + final String key; + + /// Index type. + final String type; + + /// 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; + + /// Index columns. + final List columns; + + /// Index columns length. + final List lengths; + + /// 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, + }); + + 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'] ?? []), + ); + } + + 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 new file mode 100644 index 00000000..66213f0a --- /dev/null +++ b/lib/src/models/column_index_list.dart @@ -0,0 +1,29 @@ +part of '../../models.dart'; + +/// Column Indexes List +class ColumnIndexList implements Model { + /// Total number of indexes rows that matched your query. + final int total; + + /// List of indexes. + final List 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))), + ); + } + + 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 new file mode 100644 index 00000000..3823f425 --- /dev/null +++ b/lib/src/models/column_integer.dart @@ -0,0 +1,83 @@ +part of '../../models.dart'; + +/// ColumnInteger +class ColumnInteger implements Model { + /// Column Key. + final String key; + + /// Column type. + final String type; + + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 attribute when not provided. Cannot be set when attribute 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, + }); + + factory ColumnInteger.fromMap(Map map) { + return ColumnInteger( + key: map['key'].toString(), + type: map['type'].toString(), + status: map['status'].toString(), + 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'], + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 new file mode 100644 index 00000000..4ac1fa12 --- /dev/null +++ b/lib/src/models/column_ip.dart @@ -0,0 +1,77 @@ +part of '../../models.dart'; + +/// ColumnIP +class ColumnIp implements Model { + /// Column Key. + final String key; + + /// Column type. + final String type; + + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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; + + /// String format. + final String format; + + /// Default value for attribute when not provided. Cannot be set when attribute 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, + }); + + factory ColumnIp.fromMap(Map map) { + return ColumnIp( + key: map['key'].toString(), + type: map['type'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } +} diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart new file mode 100644 index 00000000..475c1c40 --- /dev/null +++ b/lib/src/models/column_list.dart @@ -0,0 +1,29 @@ +part of '../../models.dart'; + +/// Columns List +class ColumnList implements Model { + /// Total number of columns in the given table. + final int total; + + /// List of columns. + final List columns; + + ColumnList({ + required this.total, + required this.columns, + }); + + factory ColumnList.fromMap(Map map) { + return ColumnList( + total: map['total'], + columns: List.from(map['columns'] ?? []), + ); + } + + Map toMap() { + return { + "total": total, + "columns": columns, + }; + } +} diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart new file mode 100644 index 00000000..e55d1534 --- /dev/null +++ b/lib/src/models/column_relationship.dart @@ -0,0 +1,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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 new file mode 100644 index 00000000..6fd6a3b0 --- /dev/null +++ b/lib/src/models/column_string.dart @@ -0,0 +1,83 @@ +part of '../../models.dart'; + +/// ColumnString +class ColumnString implements Model { + /// Column Key. + final String key; + + /// Column type. + final String type; + + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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; + + /// Column size. + final int size; + + /// 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; + + 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: map['status'].toString(), + 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'], + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } +} diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart new file mode 100644 index 00000000..94271aa6 --- /dev/null +++ b/lib/src/models/column_url.dart @@ -0,0 +1,77 @@ +part of '../../models.dart'; + +/// ColumnURL +class ColumnUrl implements Model { + /// Column Key. + final String key; + + /// Column type. + final String type; + + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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; + + /// String format. + final String format; + + /// 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, + }); + + factory ColumnUrl.fromMap(Map map) { + return ColumnUrl( + key: map['key'].toString(), + type: map['type'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } +} diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 7318b7ad..1a9c5038 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 2c605d3b..60b008ef 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Continents List class ContinentList implements Model { - /// Total number of continents documents that matched your query. - final int total; + /// Total number of continents rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 c52b50f2..565b1d66 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,19 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 6ef8ec42..3a3acd49 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Countries List class CountryList implements Model { - /// Total number of countries documents that matched your query. - final int total; + /// Total number of countries rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 27eef0c1..deafffe3 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 acb515e3..34274e00 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Currencies List class CurrencyList implements Model { - /// Total number of currencies documents that matched your query. - final int total; + /// Total number of currencies rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 298a46a3..cab95b02 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,46 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - }); - - 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'], - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 5b6df8d4..940a9610 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Databases List class DatabaseList implements Model { - /// Total number of databases documents that matched your query. - final int total; + /// Total number of databases rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 448c62c7..ecf7e791 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 15a93ef4..7a2a38c2 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Deployments List class DeploymentList implements Model { - /// Total number of deployments documents that matched your query. - final int total; + /// Total number of deployments rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index cf85e457..be424a9c 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 126ad805..90bce66f 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,30 +2,31 @@ part of '../../models.dart'; /// Documents List class DocumentList implements Model { - /// Total number of documents documents that matched your query. - final int total; + /// Total number of documents rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 8618bcd6..0cfdbb4e 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,122 +2,118 @@ 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 upate date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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.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(), - trigger: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "trigger": trigger, - "status": status, - "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 upate date in ISO 8601 format. + final String $updatedAt; + + /// Execution roles. + final List $permissions; + + /// Function ID. + final String functionId; + + /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + final String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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.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(), + trigger: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "trigger": trigger, + "status": status, + "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 2a2ef056..c30098a6 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Executions List class ExecutionList implements Model { - /// Total number of executions documents that matched your query. - final int total; + /// Total number of executions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 a6a9fa46..de8439ec 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 9f01530b..164a281f 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Files List class FileList implements Model { - /// Total number of files documents that matched your query. - final int total; + /// Total number of files rows 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))), + ); + } - Map toMap() { - return {"total": total, "files": files.map((p) => p.toMap()).toList()}; - } + 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 693c9b07..ea6b601a 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,48 +2,46 @@ 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)), - ), - ); - } - - 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))), + ); + } + + 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 0b908240..7614616a 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 266d8edf..bd39632e 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Frameworks List class FrameworkList implements Model { - /// Total number of frameworks documents that matched your query. - final int total; + /// Total number of frameworks rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 56c2eded..64401c3f 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index c37f0615..b40dd517 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,25 +2,28 @@ part of '../../models.dart'; /// Functions List class FunctionList implements Model { - /// Total number of functions documents that matched your query. - final int total; + /// Total number of functions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 463cf696..ecf0a178 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "value": value}; - } + Map toMap() { + return { + "name": name, + "value": value, + }; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index fa402e97..54c31e70 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return {"version": version, "status": status}; - } + Map toMap() { + return { + "version": version, + "status": status, + }; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index d412eba9..0a5b6ce9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5f06906b..95da1235 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,16 +2,22 @@ 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'], + ); + } - Map toMap() { - return {"size": size}; - } + Map toMap() { + return { + "size": size, + }; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 59b7092c..0d6e7216 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,26 +2,34 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return {"name": name, "ping": ping, "status": status}; - } + Map toMap() { + return { + "name": name, + "ping": ping, + "status": status, + }; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index dec2d54f..102dfe77 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,30 +2,34 @@ 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'], + ); + } - Map toMap() { - return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; - } + Map toMap() { + return { + "remoteTime": remoteTime, + "localTime": localTime, + "diff": diff, + }; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index 807bdfd0..c43c4d57 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 f38eaf66..52fa04a6 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Identities List class IdentityList implements Model { - /// Total number of identities documents that matched your query. - final int total; + /// Total number of identities rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 961b9e5e..b6717c4e 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,70 +2,76 @@ part of '../../models.dart'; /// Index class Index implements Model { - /// Index Key. - final String key; + /// Index ID. + final String $id; - /// Index type. - final String type; + /// Index creation date in ISO 8601 format. + final String $createdAt; - /// Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final String status; + /// Index update date in ISO 8601 format. + final String $updatedAt; - /// Error message. Displays error generated on failure of creating or deleting an index. - final String error; + /// Index key. + final String key; - /// Index attributes. - final List attributes; + /// Index type. + final String type; - /// Index attributes length. - final List lengths; + /// Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String status; - /// Index orders. - final List? orders; + /// Error message. Displays error generated on failure of creating or deleting an index. + final String error; - /// Index creation date in ISO 8601 format. - final String $createdAt; + /// Index attributes. + final List attributes; - /// Index update date in ISO 8601 format. - final String $updatedAt; + /// Index attributes length. + final List lengths; - Index({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.attributes, - required this.lengths, - this.orders, - required this.$createdAt, - required this.$updatedAt, - }); + /// Index orders. + final List? orders; - factory Index.fromMap(Map map) { - return Index( - key: map['key'].toString(), - type: map['type'].toString(), - status: map['status'].toString(), - error: map['error'].toString(), - attributes: List.from(map['attributes'] ?? []), - lengths: List.from(map['lengths'] ?? []), - orders: List.from(map['orders'] ?? []), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - ); - } + 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, + }); - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - }; - } + 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 dc759dfb..390e9039 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Indexes List class IndexList implements Model { - /// Total number of indexes documents that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 490a1824..1b4ff7de 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"jwt": jwt}; - } + Map toMap() { + return { + "jwt": jwt, + }; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 9c45adb1..43eaad08 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,26 +2,34 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code, "nativeName": nativeName}; - } + 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 046b879e..755c4e29 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Languages List class LanguageList implements Model { - /// Total number of languages documents that matched your query. - final int total; + /// Total number of languages rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 084475bf..b5e9ad1a 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 cd5a1155..10499ef5 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"code": code, "name": name}; - } + 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 662fee4f..9e1e6034 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Locale codes list class LocaleCodeList implements Model { - /// Total number of localeCodes documents that matched your query. - final int total; + /// Total number of localeCodes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 7fb3f364..cb567bd7 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 628237fa..636d9166 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Logs List class LogList implements Model { - /// Total number of logs documents that matched your query. - final int total; + /// Total number of logs rows 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))), + ); + } - Map toMap() { - return {"total": total, "logs": logs.map((p) => p.toMap()).toList()}; - } + 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 8ee142ad..26610e46 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index 46468a3a..566afb17 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Memberships List class MembershipList implements Model { - /// Total number of memberships documents that matched your query. - final int total; + /// Total number of memberships rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 9b93b00d..c4e9e858 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index 7bd0891f..c5082c8e 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Message list class MessageList implements Model { - /// Total number of messages documents that matched your query. - final int total; + /// Total number of messages rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 96bf3c65..46c166fb 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 c930a23e..d49989d8 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 63411988..6c8b4e36 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,18 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"recoveryCodes": recoveryCodes}; - } + Map toMap() { + return { + "recoveryCodes": recoveryCodes, + }; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index fa57cb8b..01cf0857 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"secret": secret, "uri": uri}; - } + Map toMap() { + return { + "secret": secret, + "uri": uri, + }; + } } 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/phone.dart b/lib/src/models/phone.dart index 40f7bcd2..c8bbb95b 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 18d2803d..a40e3591 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Phones List class PhoneList implements Model { - /// Total number of phones documents that matched your query. - final int total; + /// Total number of phones rows 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))), + ); + } - Map toMap() { - return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "phones": phones.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index 7bc3abc9..edb6083e 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,17 +2,23 @@ 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); - } + factory Preferences.fromMap(Map map) { + return Preferences( + data: map, + ); + } - Map toMap() { - return {"data": data}; - } + 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/provider.dart b/lib/src/models/provider.dart index 1a762f85..4295c486 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 aeb28ecd..c71c810d 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Provider list class ProviderList implements Model { - /// Total number of providers documents that matched your query. - final int total; + /// Total number of providers rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index dad35dcc..ed520cc4 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 f30531f4..3c2d985f 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,24 +2,28 @@ part of '../../models.dart'; /// Resource Tokens List class ResourceTokenList implements Model { - /// Total number of tokens documents that matched your query. - final int total; + /// Total number of tokens rows 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))), + ); + } - Map toMap() { - return {"total": total, "tokens": tokens.map((p) => p.toMap()).toList()}; - } + 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 new file mode 100644 index 00000000..62e69e5b --- /dev/null +++ b/lib/src/models/row.dart @@ -0,0 +1,66 @@ +part of '../../models.dart'; + +/// Row +class Row implements Model { + /// Row ID. + final String $id; + + /// Row automatically incrementing ID. + final int $sequence; + + /// Table ID. + final String $tableId; + + /// Database ID. + final String $databaseId; + + /// Row creation date in ISO 8601 format. + final String $createdAt; + + /// Row update date in ISO 8601 format. + final String $updatedAt; + + /// Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; + + 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, + }); + + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } + + 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); +} diff --git a/lib/src/models/row_list.dart b/lib/src/models/row_list.dart new file mode 100644 index 00000000..42bdbfea --- /dev/null +++ b/lib/src/models/row_list.dart @@ -0,0 +1,32 @@ +part of '../../models.dart'; + +/// Rows List +class RowList implements Model { + /// Total number of rows rows that matched your query. + final int total; + + /// List of rows. + final List 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))), + ); + } + + 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(); +} diff --git a/lib/src/models/runtime.dart b/lib/src/models/runtime.dart index 7c9677d8..35f82cfa 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 02c7b2e5..e574c63c 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Runtimes List class RuntimeList implements Model { - /// Total number of runtimes documents that matched your query. - final int total; + /// Total number of runtimes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 d2fe4f64..3a1d955f 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 479272b9..160cb789 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Sessions List class SessionList implements Model { - /// Total number of sessions documents that matched your query. - final int total; + /// Total number of sessions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 1449f8bd..5cda6acc 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index a403dd5b..3164546a 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Sites List class SiteList implements Model { - /// Total number of sites documents that matched your query. - final int total; + /// Total number of sites rows 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))), + ); + } - Map toMap() { - return {"total": total, "sites": sites.map((p) => p.toMap()).toList()}; - } + 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 e8fb8c75..e49d399c 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,35 +2,40 @@ 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(), + ); + } - Map toMap() { - return {"memory": memory, "cpus": cpus, "enabled": enabled, "slug": slug}; - } + 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 e4bef89b..040dbcc7 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Specifications List class SpecificationList implements Model { - /// Total number of specifications documents that matched your query. - final int total; + /// Total number of specifications rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 0c926297..36e18a7e 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 7030fa0a..20ce6ca5 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Subscriber list class SubscriberList implements Model { - /// Total number of subscribers documents that matched your query. - final int total; + /// Total number of subscribers rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 new file mode 100644 index 00000000..1c5b88fb --- /dev/null +++ b/lib/src/models/table.dart @@ -0,0 +1,77 @@ +part of '../../models.dart'; + +/// Table +class Table implements Model { + /// Table ID. + final String $id; + + /// Table creation date in ISO 8601 format. + final String $createdAt; + + /// Table update date in ISO 8601 format. + final String $updatedAt; + + /// Table permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; + + /// Database ID. + final String databaseId; + + /// 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; + + /// Whether row-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool rowSecurity; + + /// Table columns. + final List columns; + + /// Table indexes. + final List indexes; + + 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, + }); + + 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))), + ); + } + + 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(), + }; + } +} diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart new file mode 100644 index 00000000..2c285e55 --- /dev/null +++ b/lib/src/models/table_list.dart @@ -0,0 +1,29 @@ +part of '../../models.dart'; + +/// Tables List +class TableList implements Model { + /// Total number of tables rows that matched your query. + final int total; + + /// List of tables. + final List 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))), + ); + } + + 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 4be8b545..f2b3b6b4 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 1042e5a2..c3c250a5 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Target list class TargetList implements Model { - /// Total number of targets documents that matched your query. - final int total; + /// Total number of targets rows 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))), + ); + } - Map toMap() { - return {"total": total, "targets": targets.map((p) => p.toMap()).toList()}; - } + 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 43df33a8..e9058b5b 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 e604f192..3b8547ca 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Teams List class TeamList implements Model { - /// Total number of teams documents that matched your query. - final int total; + /// Total number of teams rows 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))), + ); + } - Map toMap() { - return {"total": total, "teams": teams.map((p) => p.toMap()).toList()}; - } + 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 35115467..4f6b8454 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 430d44ac..461d5694 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 a4d1f44f..1c0fdb32 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Topic list class TopicList implements Model { - /// Total number of topics documents that matched your query. - final int total; + /// Total number of topics rows 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))), + ); + } - Map toMap() { - return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "topics": topics.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index 50bfb3ce..effc397c 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 03e55cc6..75b8f53b 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Users List class UserList implements Model { - /// Total number of users documents that matched your query. - final int total; + /// Total number of users rows 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))), + ); + } - Map toMap() { - return {"total": total, "users": users.map((p) => p.toMap()).toList()}; - } + 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 2a8e276a..58882a9f 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 4ff3e189..da6e6982 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Variables List class VariableList implements Model { - /// Total number of variables documents that matched your query. - final int total; + /// Total number of variables rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/upload_progress.dart b/lib/src/upload_progress.dart index 5a19b0fc..44cde383 100644 --- a/lib/src/upload_progress.dart +++ b/lib/src/upload_progress.dart @@ -44,7 +44,7 @@ class UploadProgress { "progress": progress, "sizeUploaded": sizeUploaded, "chunksTotal": chunksTotal, - "chunksUploaded": chunksUploaded, + "chunksUploaded": chunksUploaded }; } diff --git a/pubspec.yaml b/pubspec.yaml index b05f52ae..9d102b91 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: dart_appwrite -version: 16.2.0 +version: 17.0.0 description: Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API homepage: https://appwrite.io repository: https://github.com/appwrite/sdk-for-dart @@ -11,6 +11,6 @@ dependencies: http: '>=0.13.6 <2.0.0' dev_dependencies: - lints: ^4.0.0 + lints: ^6.0.0 test: ^1.25.8 mockito: ^5.4.4 diff --git a/test/query_test.dart b/test/query_test.dart index 71d1cf23..ab7bd0e9 100644 --- a/test/query_test.dart +++ b/test/query_test.dart @@ -1,10 +1,12 @@ +import 'dart:convert'; + import 'package:dart_appwrite/dart_appwrite.dart'; import 'package:test/test.dart'; -class BasicFilterQueryTest { +class BasicFilterQueryTest { final String description; - final dynamic value; - final String expectedValues; + final T value; + final List expectedValues; BasicFilterQueryTest({ required this.description, @@ -19,7 +21,7 @@ void main() { BasicFilterQueryTest( description: 'with a string', value: 's', - expectedValues: ["s"], + expectedValues: ['s'], ), BasicFilterQueryTest( description: 'with an integer', @@ -44,14 +46,14 @@ void main() { BasicFilterQueryTest( description: 'with a list', value: ['a', 'b', 'c'], - expectedValues: ["a","b","c"], + expectedValues: ['a', 'b', 'c'], ), ]; group('equal()', () { for (var t in tests) { test(t.description, () { - final query = Query.equal('attr', t.value).toJson(); + final query = jsonDecode(Query.equal('attr', t.value)); expect(query['attribute'], 'attr'); expect(query['values'], t.expectedValues); expect(query['method'], 'equal'); @@ -62,7 +64,7 @@ void main() { group('notEqual()', () { for (var t in tests) { test(t.description, () { - final query = Query.notEqual('attr', t.value).toJson(); + final query = jsonDecode(Query.notEqual('attr', t.value)); expect(query['attribute'], 'attr'); expect(query['values'], t.expectedValues); expect(query['method'], 'notEqual'); @@ -73,7 +75,7 @@ void main() { group('lessThan()', () { for (var t in tests) { test(t.description, () { - final query = Query.lessThan('attr', t.value).toJson(); + final query = jsonDecode(Query.lessThan('attr', t.value)); expect(query['attribute'], 'attr'); expect(query['values'], t.expectedValues); expect(query['method'], 'lessThan'); @@ -84,7 +86,7 @@ void main() { group('lessThanEqual()', () { for (var t in tests) { test(t.description, () { - final query = Query.lessThanEqual('attr', t.value).toJson(); + final query = jsonDecode(Query.lessThanEqual('attr', t.value)); expect(query['attribute'], 'attr'); expect(query['values'], t.expectedValues); expect(query['method'], 'lessThanEqual'); @@ -95,7 +97,7 @@ void main() { group('greaterThan()', () { for (var t in tests) { test(t.description, () { - final query = Query.greaterThan('attr', t.value).toJson(); + final query = jsonDecode(Query.greaterThan('attr', t.value)); expect(query['attribute'], 'attr'); expect(query['values'], t.expectedValues); expect(query['method'], 'greaterThan'); @@ -106,7 +108,7 @@ void main() { group('greaterThanEqual()', () { for (var t in tests) { test(t.description, () { - final query = Query.greaterThanEqual('attr', t.value).toJson(); + final query = jsonDecode(Query.greaterThanEqual('attr', t.value)); expect(query['attribute'], 'attr'); expect(query['values'], t.expectedValues); expect(query['method'], 'greaterThanEqual'); @@ -116,21 +118,21 @@ void main() { }); test('returns search', () { - final query = Query.search('attr', 'keyword1 keyword2').toJson(); + final query = jsonDecode(Query.search('attr', 'keyword1 keyword2')); expect(query['attribute'], 'attr'); expect(query['values'], ['keyword1 keyword2']); expect(query['method'], 'search'); }); test('returns isNull', () { - final query = Query.isNull('attr').toJson(); + final query = jsonDecode(Query.isNull('attr')); expect(query['attribute'], 'attr'); expect(query['values'], null); expect(query['method'], 'isNull'); }); test('returns isNotNull', () { - final query = Query.isNotNull('attr', 'keyword1 keyword2').toJson(); + final query = jsonDecode(Query.isNotNull('attr')); expect(query['attribute'], 'attr'); expect(query['values'], null); expect(query['method'], 'isNotNull'); @@ -138,21 +140,21 @@ void main() { group('between()', () { test('with integers', () { - final query = Query.between('attr', 1, 2).toJson(); + final query = jsonDecode(Query.between('attr', 1, 2)); expect(query['attribute'], 'attr'); expect(query['values'], [1, 2]); expect(query['method'], 'between'); }); test('with doubles', () { - final query = Query.between('attr', 1.0, 2.0).toJson(); + final query = jsonDecode(Query.between('attr', 1.0, 2.0)); expect(query['attribute'], 'attr'); expect(query['values'], [1.0, 2.0]); expect(query['method'], 'between'); }); test('with strings', () { - final query = Query.between('attr', 'a', 'z').toJson(); + final query = jsonDecode(Query.between('attr', 'a', 'z')); expect(query['attribute'], 'attr'); expect(query['values'], ['a', 'z']); expect(query['method'], 'between'); @@ -160,52 +162,131 @@ void main() { }); test('returns select', () { - final query = Query.select(['attr1', 'attr2']).toJson(); + final query = jsonDecode(Query.select(['attr1', 'attr2'])); expect(query['attribute'], null); expect(query['values'], ['attr1', 'attr2']); expect(query['method'], 'select'); }); test('returns orderAsc', () { - final query = Query.orderAsc('attr').toJson(); + final query = jsonDecode(Query.orderAsc('attr')); expect(query['attribute'], 'attr'); expect(query['values'], null); expect(query['method'], 'orderAsc'); }); test('returns orderDesc', () { - final query = Query.orderDesc('attr').toJson(); + final query = jsonDecode(Query.orderDesc('attr')); expect(query['attribute'], 'attr'); expect(query['values'], null); expect(query['method'], 'orderDesc'); }); test('returns cursorBefore', () { - final query = Query.cursorBefore('custom').toJson(); + final query = jsonDecode(Query.cursorBefore('custom')); expect(query['attribute'], null); expect(query['values'], 'custom'); expect(query['method'], 'cursorBefore'); }); test('returns cursorAfter', () { - final query = Query.cursorAfter('custom').toJson(); + final query = jsonDecode(Query.cursorAfter('custom')); expect(query['attribute'], null); expect(query['values'], 'custom'); expect(query['method'], 'cursorAfter'); }); test('returns limit', () { - final query = Query.limit(1).toJson(); + final query = jsonDecode(Query.limit(1)); expect(query['attribute'], null); expect(query['values'], 1); expect(query['method'], 'limit'); }); test('returns offset', () { - final query = Query.offset(1).toJson(); + final query = jsonDecode(Query.offset(1)); expect(query['attribute'], null); expect(query['values'], 1); expect(query['method'], 'offset'); }); + + test('returns notContains', () { + final query = jsonDecode(Query.notContains('attr', 'value')); + expect(query['attribute'], 'attr'); + expect(query['values'], ['value']); + expect(query['method'], 'notContains'); + }); + + test('returns notSearch', () { + final query = jsonDecode(Query.notSearch('attr', 'keyword1 keyword2')); + expect(query['attribute'], 'attr'); + expect(query['values'], ['keyword1 keyword2']); + expect(query['method'], 'notSearch'); + }); + + group('notBetween()', () { + test('with integers', () { + final query = jsonDecode(Query.notBetween('attr', 1, 2)); + expect(query['attribute'], 'attr'); + expect(query['values'], [1, 2]); + expect(query['method'], 'notBetween'); + }); + + test('with doubles', () { + final query = jsonDecode(Query.notBetween('attr', 1.0, 2.0)); + expect(query['attribute'], 'attr'); + expect(query['values'], [1.0, 2.0]); + expect(query['method'], 'notBetween'); + }); + + test('with strings', () { + final query = jsonDecode(Query.notBetween('attr', 'a', 'z')); + expect(query['attribute'], 'attr'); + expect(query['values'], ['a', 'z']); + expect(query['method'], 'notBetween'); + }); + }); + + test('returns notStartsWith', () { + final query = jsonDecode(Query.notStartsWith('attr', 'prefix')); + expect(query['attribute'], 'attr'); + expect(query['values'], ['prefix']); + expect(query['method'], 'notStartsWith'); + }); + + test('returns notEndsWith', () { + final query = jsonDecode(Query.notEndsWith('attr', 'suffix')); + expect(query['attribute'], 'attr'); + expect(query['values'], ['suffix']); + expect(query['method'], 'notEndsWith'); + }); + + test('returns createdBefore', () { + final query = jsonDecode(Query.createdBefore('2023-01-01')); + expect(query['attribute'], null); + expect(query['values'], '2023-01-01'); + expect(query['method'], 'createdBefore'); + }); + + test('returns createdAfter', () { + final query = jsonDecode(Query.createdAfter('2023-01-01')); + expect(query['attribute'], null); + expect(query['values'], '2023-01-01'); + expect(query['method'], 'createdAfter'); + }); + + test('returns updatedBefore', () { + final query = jsonDecode(Query.updatedBefore('2023-01-01')); + expect(query['attribute'], null); + expect(query['values'], '2023-01-01'); + expect(query['method'], 'updatedBefore'); + }); + + test('returns updatedAfter', () { + final query = jsonDecode(Query.updatedAfter('2023-01-01')); + expect(query['attribute'], null); + expect(query['values'], '2023-01-01'); + expect(query['method'], 'updatedAfter'); + }); } diff --git a/test/services/databases_test.dart b/test/services/databases_test.dart index 1c2652ef..c6bc5a24 100644 --- a/test/services/databases_test.dart +++ b/test/services/databases_test.dart @@ -77,7 +77,8 @@ void main() { 'name': 'My Database', '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true,}; + 'enabled': true, + 'type': 'legacy',}; when(client.call( @@ -99,7 +100,8 @@ void main() { 'name': 'My Database', '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true,}; + 'enabled': true, + 'type': 'legacy',}; when(client.call( @@ -120,7 +122,8 @@ void main() { 'name': 'My Database', '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true,}; + 'enabled': true, + 'type': 'legacy',}; when(client.call( @@ -1157,14 +1160,15 @@ void main() { 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': [], - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + 'lengths': [],}; when(client.call( @@ -1185,14 +1189,15 @@ void main() { 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': [], - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + 'lengths': [],}; when(client.call( diff --git a/test/services/tables-db_test.dart b/test/services/tables-db_test.dart new file mode 100644 index 00000000..25590572 --- /dev/null +++ b/test/services/tables-db_test.dart @@ -0,0 +1,1232 @@ +import 'package:test/test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:dart_appwrite/models.dart' as models; +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, + { + String? callbackUrlScheme, + } + ) 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('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',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDb.create( + databaseId: '', + name: '', + ); + 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',}; + + + 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',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDb.update( + databaseId: '', + name: '', + ); + 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': [],}; + + + 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': [],}; + + + 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': [],}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDb.updateTable( + databaseId: '', + tableId: '', + name: '', + ); + 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 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: '', + ); + 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 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: '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 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 getColumn()', () async { + final data = ''; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDb.getColumn( + databaseId: '', + tableId: '', + key: '', + ); + }); + + 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: '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()); + + }); + + }); +} \ No newline at end of file diff --git a/test/src/enums_test.dart b/test/src/enums_test.dart index 120ab2c9..d62900b4 100644 --- a/test/src/enums_test.dart +++ b/test/src/enums_test.dart @@ -4,9 +4,11 @@ import 'package:test/test.dart'; void main() { group('name()', () { for (final method in HttpMethod.values) { - test('returns ${method.toString().split('.').last.toUpperCase()} for $method', () { + test( + 'returns ${method.toString().split('.').last.toUpperCase()} for $method', + () { expect(method.name(), method.toString().split('.').last.toUpperCase()); }); } }); -} \ No newline at end of file +} diff --git a/test/src/exception_test.dart b/test/src/exception_test.dart index f55782cf..500059e3 100644 --- a/test/src/exception_test.dart +++ b/test/src/exception_test.dart @@ -8,10 +8,13 @@ void main() { expect(exception1.toString(), equals('AppwriteException')); final exception2 = AppwriteException('Some error message'); - expect(exception2.toString(), equals('AppwriteException: , Some error message (0)')); + expect(exception2.toString(), + equals('AppwriteException: , Some error message (0)')); - final exception3 = AppwriteException('Invalid request', 400, 'ValidationError'); - expect(exception3.toString(), equals('AppwriteException: ValidationError, Invalid request (400)')); + final exception3 = + AppwriteException('Invalid request', 400, 'ValidationError'); + expect(exception3.toString(), + equals('AppwriteException: ValidationError, Invalid request (400)')); }); }); } diff --git a/test/src/input_file_test.dart b/test/src/input_file_test.dart index ccbd4387..a5277d8e 100644 --- a/test/src/input_file_test.dart +++ b/test/src/input_file_test.dart @@ -36,7 +36,8 @@ void main() { }); test('creates InputFile from bytes', () { - final inputFile = InputFile.fromBytes(bytes: [1, 2, 3], filename: 'file.txt'); + final inputFile = + InputFile.fromBytes(bytes: [1, 2, 3], filename: 'file.txt'); expect(inputFile.path, isNull); expect(inputFile.filename, 'file.txt'); diff --git a/test/src/models/algo_argon2_test.dart b/test/src/models/algo_argon2_test.dart index 13a1bbb0..d55be87a 100644 --- a/test/src/models/algo_argon2_test.dart +++ b/test/src/models/algo_argon2_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AlgoArgon2', () { - test('model', () { final model = AlgoArgon2( type: 'argon2', diff --git a/test/src/models/algo_bcrypt_test.dart b/test/src/models/algo_bcrypt_test.dart index 3b3735a8..3046b077 100644 --- a/test/src/models/algo_bcrypt_test.dart +++ b/test/src/models/algo_bcrypt_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AlgoBcrypt', () { - test('model', () { final model = AlgoBcrypt( type: 'bcrypt', diff --git a/test/src/models/algo_md5_test.dart b/test/src/models/algo_md5_test.dart index beb757ab..01bb0836 100644 --- a/test/src/models/algo_md5_test.dart +++ b/test/src/models/algo_md5_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AlgoMd5', () { - test('model', () { final model = AlgoMd5( type: 'md5', diff --git a/test/src/models/algo_phpass_test.dart b/test/src/models/algo_phpass_test.dart index 4dd25578..50c43860 100644 --- a/test/src/models/algo_phpass_test.dart +++ b/test/src/models/algo_phpass_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AlgoPhpass', () { - test('model', () { final model = AlgoPhpass( type: 'phpass', diff --git a/test/src/models/algo_scrypt_modified_test.dart b/test/src/models/algo_scrypt_modified_test.dart index fe32160d..d7af2ef9 100644 --- a/test/src/models/algo_scrypt_modified_test.dart +++ b/test/src/models/algo_scrypt_modified_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AlgoScryptModified', () { - test('model', () { final model = AlgoScryptModified( type: 'scryptMod', diff --git a/test/src/models/algo_scrypt_test.dart b/test/src/models/algo_scrypt_test.dart index 12ea9fa2..aa3128c5 100644 --- a/test/src/models/algo_scrypt_test.dart +++ b/test/src/models/algo_scrypt_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AlgoScrypt', () { - test('model', () { final model = AlgoScrypt( type: 'scrypt', diff --git a/test/src/models/algo_sha_test.dart b/test/src/models/algo_sha_test.dart index 1f7a7817..ea1ec869 100644 --- a/test/src/models/algo_sha_test.dart +++ b/test/src/models/algo_sha_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AlgoSha', () { - test('model', () { final model = AlgoSha( type: 'sha', diff --git a/test/src/models/attribute_boolean_test.dart b/test/src/models/attribute_boolean_test.dart index 58c7a3c1..6b594877 100644 --- a/test/src/models/attribute_boolean_test.dart +++ b/test/src/models/attribute_boolean_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AttributeBoolean', () { - test('model', () { final model = AttributeBoolean( key: 'isEnabled', diff --git a/test/src/models/attribute_datetime_test.dart b/test/src/models/attribute_datetime_test.dart index c5e91ad7..ad1fd7e7 100644 --- a/test/src/models/attribute_datetime_test.dart +++ b/test/src/models/attribute_datetime_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AttributeDatetime', () { - test('model', () { final model = AttributeDatetime( key: 'birthDay', diff --git a/test/src/models/attribute_email_test.dart b/test/src/models/attribute_email_test.dart index b13a4f56..ecbe20c4 100644 --- a/test/src/models/attribute_email_test.dart +++ b/test/src/models/attribute_email_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AttributeEmail', () { - test('model', () { final model = AttributeEmail( key: 'userEmail', diff --git a/test/src/models/attribute_enum_test.dart b/test/src/models/attribute_enum_test.dart index b7952fb6..d8b3348c 100644 --- a/test/src/models/attribute_enum_test.dart +++ b/test/src/models/attribute_enum_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AttributeEnum', () { - test('model', () { final model = AttributeEnum( key: 'status', diff --git a/test/src/models/attribute_float_test.dart b/test/src/models/attribute_float_test.dart index 359784b7..3f18dd42 100644 --- a/test/src/models/attribute_float_test.dart +++ b/test/src/models/attribute_float_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AttributeFloat', () { - test('model', () { final model = AttributeFloat( key: 'percentageCompleted', diff --git a/test/src/models/attribute_integer_test.dart b/test/src/models/attribute_integer_test.dart index 4ccb94f0..3e82c55d 100644 --- a/test/src/models/attribute_integer_test.dart +++ b/test/src/models/attribute_integer_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AttributeInteger', () { - test('model', () { final model = AttributeInteger( key: 'count', diff --git a/test/src/models/attribute_ip_test.dart b/test/src/models/attribute_ip_test.dart index 42a23d9f..89d230f6 100644 --- a/test/src/models/attribute_ip_test.dart +++ b/test/src/models/attribute_ip_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AttributeIp', () { - test('model', () { final model = AttributeIp( key: 'ipAddress', diff --git a/test/src/models/attribute_list_test.dart b/test/src/models/attribute_list_test.dart index e4af0248..93e033ee 100644 --- a/test/src/models/attribute_list_test.dart +++ b/test/src/models/attribute_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AttributeList', () { - test('model', () { final model = AttributeList( total: 5, diff --git a/test/src/models/attribute_relationship_test.dart b/test/src/models/attribute_relationship_test.dart index 1a75dbdd..d2c7c6c5 100644 --- a/test/src/models/attribute_relationship_test.dart +++ b/test/src/models/attribute_relationship_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AttributeRelationship', () { - test('model', () { final model = AttributeRelationship( key: 'fullName', diff --git a/test/src/models/attribute_string_test.dart b/test/src/models/attribute_string_test.dart index ca1008ac..4528c470 100644 --- a/test/src/models/attribute_string_test.dart +++ b/test/src/models/attribute_string_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AttributeString', () { - test('model', () { final model = AttributeString( key: 'fullName', diff --git a/test/src/models/attribute_url_test.dart b/test/src/models/attribute_url_test.dart index 3ef3e40a..8ac97572 100644 --- a/test/src/models/attribute_url_test.dart +++ b/test/src/models/attribute_url_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('AttributeUrl', () { - test('model', () { final model = AttributeUrl( key: 'githubUrl', diff --git a/test/src/models/bucket_list_test.dart b/test/src/models/bucket_list_test.dart index 3290c390..bb1ae4c6 100644 --- a/test/src/models/bucket_list_test.dart +++ b/test/src/models/bucket_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('BucketList', () { - test('model', () { final model = BucketList( total: 5, diff --git a/test/src/models/bucket_test.dart b/test/src/models/bucket_test.dart index 3ead5259..143eeb19 100644 --- a/test/src/models/bucket_test.dart +++ b/test/src/models/bucket_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Bucket', () { - test('model', () { final model = Bucket( $id: '5e5ea5c16897e', diff --git a/test/src/models/collection_list_test.dart b/test/src/models/collection_list_test.dart index 0842a382..ef952c70 100644 --- a/test/src/models/collection_list_test.dart +++ b/test/src/models/collection_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('CollectionList', () { - test('model', () { final model = CollectionList( total: 5, diff --git a/test/src/models/collection_test.dart b/test/src/models/collection_test.dart index 9eeb507f..ad6c2878 100644 --- a/test/src/models/collection_test.dart +++ b/test/src/models/collection_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Collection', () { - test('model', () { final model = Collection( $id: '5e5ea5c16897e', diff --git a/test/src/models/column_boolean_test.dart b/test/src/models/column_boolean_test.dart new file mode 100644 index 00000000..074fbc1e --- /dev/null +++ b/test/src/models/column_boolean_test.dart @@ -0,0 +1,29 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('ColumnBoolean', () { + test('model', () { + final model = ColumnBoolean( + key: 'isEnabled', + type: 'boolean', + status: '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 = ColumnBoolean.fromMap(map); + + expect(result.key, 'isEnabled'); + expect(result.type, 'boolean'); + expect(result.status, '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 new file mode 100644 index 00000000..681e9325 --- /dev/null +++ b/test/src/models/column_datetime_test.dart @@ -0,0 +1,31 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('ColumnDatetime', () { + test('model', () { + final model = ColumnDatetime( + key: 'birthDay', + type: 'datetime', + status: 'available', + error: 'string', + xrequired: true, + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + format: 'datetime', + ); + + final map = model.toMap(); + final result = ColumnDatetime.fromMap(map); + + expect(result.key, 'birthDay'); + expect(result.type, 'datetime'); + expect(result.status, '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 new file mode 100644 index 00000000..261fbb50 --- /dev/null +++ b/test/src/models/column_email_test.dart @@ -0,0 +1,31 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('ColumnEmail', () { + test('model', () { + final model = ColumnEmail( + key: 'userEmail', + type: 'string', + status: 'available', + error: 'string', + xrequired: true, + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + format: 'email', + ); + + final map = model.toMap(); + final result = ColumnEmail.fromMap(map); + + expect(result.key, 'userEmail'); + expect(result.type, 'string'); + expect(result.status, '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 new file mode 100644 index 00000000..cbf435d9 --- /dev/null +++ b/test/src/models/column_enum_test.dart @@ -0,0 +1,33 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('ColumnEnum', () { + test('model', () { + final model = ColumnEnum( + key: 'status', + type: 'string', + status: 'available', + error: 'string', + xrequired: true, + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + elements: [], + format: 'enum', + ); + + final map = model.toMap(); + final result = ColumnEnum.fromMap(map); + + expect(result.key, 'status'); + expect(result.type, 'string'); + expect(result.status, '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 new file mode 100644 index 00000000..e179f2c3 --- /dev/null +++ b/test/src/models/column_float_test.dart @@ -0,0 +1,29 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('ColumnFloat', () { + test('model', () { + final model = ColumnFloat( + key: 'percentageCompleted', + type: 'double', + status: '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 = ColumnFloat.fromMap(map); + + expect(result.key, 'percentageCompleted'); + expect(result.type, 'double'); + expect(result.status, '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 new file mode 100644 index 00000000..aae59124 --- /dev/null +++ b/test/src/models/column_index_list_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('ColumnIndexList', () { + test('model', () { + final model = ColumnIndexList( + total: 5, + indexes: [], + ); + + final map = model.toMap(); + final result = ColumnIndexList.fromMap(map); + + 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 new file mode 100644 index 00000000..8277048d --- /dev/null +++ b/test/src/models/column_index_test.dart @@ -0,0 +1,33 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('ColumnIndex', () { + test('model', () { + final model = ColumnIndex( + $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: [], + ); + + 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, []); + }); + }); +} diff --git a/test/src/models/column_integer_test.dart b/test/src/models/column_integer_test.dart new file mode 100644 index 00000000..f786e54a --- /dev/null +++ b/test/src/models/column_integer_test.dart @@ -0,0 +1,29 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('ColumnInteger', () { + test('model', () { + final model = ColumnInteger( + key: 'count', + type: 'integer', + status: '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 = ColumnInteger.fromMap(map); + + expect(result.key, 'count'); + expect(result.type, 'integer'); + expect(result.status, '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 new file mode 100644 index 00000000..aa2b38df --- /dev/null +++ b/test/src/models/column_ip_test.dart @@ -0,0 +1,31 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('ColumnIp', () { + test('model', () { + final model = ColumnIp( + key: 'ipAddress', + type: 'string', + status: 'available', + error: 'string', + xrequired: true, + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + format: 'ip', + ); + + final map = model.toMap(); + final result = ColumnIp.fromMap(map); + + expect(result.key, 'ipAddress'); + expect(result.type, 'string'); + expect(result.status, '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_list_test.dart b/test/src/models/column_list_test.dart new file mode 100644 index 00000000..c06d8a23 --- /dev/null +++ b/test/src/models/column_list_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('ColumnList', () { + test('model', () { + final model = ColumnList( + total: 5, + columns: [], + ); + + final map = model.toMap(); + final result = ColumnList.fromMap(map); + + expect(result.total, 5); + expect(result.columns, []); + }); + }); +} diff --git a/test/src/models/column_relationship_test.dart b/test/src/models/column_relationship_test.dart new file mode 100644 index 00000000..852e4ec3 --- /dev/null +++ b/test/src/models/column_relationship_test.dart @@ -0,0 +1,41 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('ColumnRelationship', () { + test('model', () { + final model = ColumnRelationship( + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + xrequired: 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', + ); + + final map = model.toMap(); + final result = ColumnRelationship.fromMap(map); + + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, '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 new file mode 100644 index 00000000..dfd78790 --- /dev/null +++ b/test/src/models/column_string_test.dart @@ -0,0 +1,31 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('ColumnString', () { + test('model', () { + final model = ColumnString( + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + xrequired: true, + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + size: 128, + ); + + final map = model.toMap(); + final result = ColumnString.fromMap(map); + + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, '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_url_test.dart b/test/src/models/column_url_test.dart new file mode 100644 index 00000000..8943d6a6 --- /dev/null +++ b/test/src/models/column_url_test.dart @@ -0,0 +1,31 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('ColumnUrl', () { + test('model', () { + final model = ColumnUrl( + key: 'githubUrl', + type: 'string', + status: 'available', + error: 'string', + xrequired: true, + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + format: 'url', + ); + + final map = model.toMap(); + final result = ColumnUrl.fromMap(map); + + expect(result.key, 'githubUrl'); + expect(result.type, 'string'); + expect(result.status, '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/continent_list_test.dart b/test/src/models/continent_list_test.dart index 095989f7..6b139f4d 100644 --- a/test/src/models/continent_list_test.dart +++ b/test/src/models/continent_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('ContinentList', () { - test('model', () { final model = ContinentList( total: 5, diff --git a/test/src/models/continent_test.dart b/test/src/models/continent_test.dart index 90b1a6bd..656cc010 100644 --- a/test/src/models/continent_test.dart +++ b/test/src/models/continent_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Continent', () { - test('model', () { final model = Continent( name: 'Europe', diff --git a/test/src/models/country_list_test.dart b/test/src/models/country_list_test.dart index 5aa53423..71b0d477 100644 --- a/test/src/models/country_list_test.dart +++ b/test/src/models/country_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('CountryList', () { - test('model', () { final model = CountryList( total: 5, diff --git a/test/src/models/country_test.dart b/test/src/models/country_test.dart index 2465bbd3..f4eec5ee 100644 --- a/test/src/models/country_test.dart +++ b/test/src/models/country_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Country', () { - test('model', () { final model = Country( name: 'United States', diff --git a/test/src/models/currency_list_test.dart b/test/src/models/currency_list_test.dart index 93215f53..36add198 100644 --- a/test/src/models/currency_list_test.dart +++ b/test/src/models/currency_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('CurrencyList', () { - test('model', () { final model = CurrencyList( total: 5, diff --git a/test/src/models/currency_test.dart b/test/src/models/currency_test.dart index 1fa35e61..05fef236 100644 --- a/test/src/models/currency_test.dart +++ b/test/src/models/currency_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Currency', () { - test('model', () { final model = Currency( symbol: '\$', diff --git a/test/src/models/database_list_test.dart b/test/src/models/database_list_test.dart index eaa0cb53..ec1c0150 100644 --- a/test/src/models/database_list_test.dart +++ b/test/src/models/database_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('DatabaseList', () { - test('model', () { final model = DatabaseList( total: 5, diff --git a/test/src/models/database_test.dart b/test/src/models/database_test.dart index 17fdef8c..1389d5a7 100644 --- a/test/src/models/database_test.dart +++ b/test/src/models/database_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Database', () { - test('model', () { final model = Database( $id: '5e5ea5c16897e', @@ -11,6 +10,7 @@ void main() { $createdAt: '2020-10-15T06:38:00.000+00:00', $updatedAt: '2020-10-15T06:38:00.000+00:00', enabled: true, + type: 'legacy', ); final map = model.toMap(); @@ -21,6 +21,7 @@ void main() { 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, 'legacy'); }); }); } diff --git a/test/src/models/deployment_list_test.dart b/test/src/models/deployment_list_test.dart index 1021fb7b..64f2e6b9 100644 --- a/test/src/models/deployment_list_test.dart +++ b/test/src/models/deployment_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('DeploymentList', () { - test('model', () { final model = DeploymentList( total: 5, diff --git a/test/src/models/deployment_test.dart b/test/src/models/deployment_test.dart index 46d7200c..5693c863 100644 --- a/test/src/models/deployment_test.dart +++ b/test/src/models/deployment_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Deployment', () { - test('model', () { final model = Deployment( $id: '5e5ea5c16897e', diff --git a/test/src/models/document_list_test.dart b/test/src/models/document_list_test.dart index f25a98fc..18ed1c09 100644 --- a/test/src/models/document_list_test.dart +++ b/test/src/models/document_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('DocumentList', () { - test('model', () { final model = DocumentList( total: 5, diff --git a/test/src/models/document_test.dart b/test/src/models/document_test.dart index 487a1b6e..971b58de 100644 --- a/test/src/models/document_test.dart +++ b/test/src/models/document_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Document', () { - test('model', () { final model = Document( $id: '5e5ea5c16897e', diff --git a/test/src/models/execution_list_test.dart b/test/src/models/execution_list_test.dart index fe10bf3f..ba36364e 100644 --- a/test/src/models/execution_list_test.dart +++ b/test/src/models/execution_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('ExecutionList', () { - test('model', () { final model = ExecutionList( total: 5, diff --git a/test/src/models/execution_test.dart b/test/src/models/execution_test.dart index 67e108b0..ff2939ee 100644 --- a/test/src/models/execution_test.dart +++ b/test/src/models/execution_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Execution', () { - test('model', () { final model = Execution( $id: '5e5ea5c16897e', diff --git a/test/src/models/file_list_test.dart b/test/src/models/file_list_test.dart index 5bd1c5ad..132c43b3 100644 --- a/test/src/models/file_list_test.dart +++ b/test/src/models/file_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('FileList', () { - test('model', () { final model = FileList( total: 5, diff --git a/test/src/models/file_test.dart b/test/src/models/file_test.dart index 8d1321ea..65bea117 100644 --- a/test/src/models/file_test.dart +++ b/test/src/models/file_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('File', () { - test('model', () { final model = File( $id: '5e5ea5c16897e', diff --git a/test/src/models/framework_adapter_test.dart b/test/src/models/framework_adapter_test.dart index bf7e3ff3..e892cf0d 100644 --- a/test/src/models/framework_adapter_test.dart +++ b/test/src/models/framework_adapter_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('FrameworkAdapter', () { - test('model', () { final model = FrameworkAdapter( key: 'static', diff --git a/test/src/models/framework_list_test.dart b/test/src/models/framework_list_test.dart index aeade175..faeae12a 100644 --- a/test/src/models/framework_list_test.dart +++ b/test/src/models/framework_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('FrameworkList', () { - test('model', () { final model = FrameworkList( total: 5, diff --git a/test/src/models/framework_test.dart b/test/src/models/framework_test.dart index 48ea96d2..07ce1e79 100644 --- a/test/src/models/framework_test.dart +++ b/test/src/models/framework_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Framework', () { - test('model', () { final model = Framework( key: 'sveltekit', diff --git a/test/src/models/function_list_test.dart b/test/src/models/function_list_test.dart index 4ed251f5..81a86955 100644 --- a/test/src/models/function_list_test.dart +++ b/test/src/models/function_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('FunctionList', () { - test('model', () { final model = FunctionList( total: 5, diff --git a/test/src/models/function_test.dart b/test/src/models/function_test.dart index 653aadce..204e18f3 100644 --- a/test/src/models/function_test.dart +++ b/test/src/models/function_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Func', () { - test('model', () { final model = Func( $id: '5e5ea5c16897e', diff --git a/test/src/models/headers_test.dart b/test/src/models/headers_test.dart index 2791e126..1d79dcad 100644 --- a/test/src/models/headers_test.dart +++ b/test/src/models/headers_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Headers', () { - test('model', () { final model = Headers( name: 'Content-Type', diff --git a/test/src/models/health_antivirus_test.dart b/test/src/models/health_antivirus_test.dart index 38209b33..0ab03404 100644 --- a/test/src/models/health_antivirus_test.dart +++ b/test/src/models/health_antivirus_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('HealthAntivirus', () { - test('model', () { final model = HealthAntivirus( version: '1.0.0', diff --git a/test/src/models/health_certificate_test.dart b/test/src/models/health_certificate_test.dart index 2277d92f..3a6f1d4c 100644 --- a/test/src/models/health_certificate_test.dart +++ b/test/src/models/health_certificate_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('HealthCertificate', () { - test('model', () { final model = HealthCertificate( name: '/CN=www.google.com', diff --git a/test/src/models/health_queue_test.dart b/test/src/models/health_queue_test.dart index 934df1bf..3cb77741 100644 --- a/test/src/models/health_queue_test.dart +++ b/test/src/models/health_queue_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('HealthQueue', () { - test('model', () { final model = HealthQueue( size: 8, diff --git a/test/src/models/health_status_test.dart b/test/src/models/health_status_test.dart index bb01aa46..3dad07ea 100644 --- a/test/src/models/health_status_test.dart +++ b/test/src/models/health_status_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('HealthStatus', () { - test('model', () { final model = HealthStatus( name: 'database', diff --git a/test/src/models/health_time_test.dart b/test/src/models/health_time_test.dart index a6c8d853..12998d00 100644 --- a/test/src/models/health_time_test.dart +++ b/test/src/models/health_time_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('HealthTime', () { - test('model', () { final model = HealthTime( remoteTime: 1639490751, diff --git a/test/src/models/identity_list_test.dart b/test/src/models/identity_list_test.dart index 1ecb0831..d3bf6876 100644 --- a/test/src/models/identity_list_test.dart +++ b/test/src/models/identity_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('IdentityList', () { - test('model', () { final model = IdentityList( total: 5, diff --git a/test/src/models/identity_test.dart b/test/src/models/identity_test.dart index 14e8ee4b..680b7497 100644 --- a/test/src/models/identity_test.dart +++ b/test/src/models/identity_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Identity', () { - test('model', () { final model = Identity( $id: '5e5ea5c16897e', diff --git a/test/src/models/index_list_test.dart b/test/src/models/index_list_test.dart index 83f5900c..07b7e4d1 100644 --- a/test/src/models/index_list_test.dart +++ b/test/src/models/index_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('IndexList', () { - test('model', () { final model = IndexList( total: 5, diff --git a/test/src/models/index_test.dart b/test/src/models/index_test.dart index fd8b9fc9..63766829 100644 --- a/test/src/models/index_test.dart +++ b/test/src/models/index_test.dart @@ -3,30 +3,31 @@ import 'package:test/test.dart'; void main() { group('Index', () { - test('model', () { final model = Index( + $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: [], - $createdAt: '2020-10-15T06:38:00.000+00:00', - $updatedAt: '2020-10-15T06:38:00.000+00:00', ); 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, 'available'); expect(result.error, 'string'); expect(result.attributes, []); expect(result.lengths, []); - 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/jwt_test.dart b/test/src/models/jwt_test.dart index db56a032..b9b04120 100644 --- a/test/src/models/jwt_test.dart +++ b/test/src/models/jwt_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Jwt', () { - test('model', () { final model = Jwt( jwt: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', diff --git a/test/src/models/language_list_test.dart b/test/src/models/language_list_test.dart index 8b39a179..fd0dd58c 100644 --- a/test/src/models/language_list_test.dart +++ b/test/src/models/language_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('LanguageList', () { - test('model', () { final model = LanguageList( total: 5, diff --git a/test/src/models/language_test.dart b/test/src/models/language_test.dart index 214a6ee8..6db0ddbf 100644 --- a/test/src/models/language_test.dart +++ b/test/src/models/language_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Language', () { - test('model', () { final model = Language( name: 'Italian', diff --git a/test/src/models/locale_code_list_test.dart b/test/src/models/locale_code_list_test.dart index 54826544..c086cdd1 100644 --- a/test/src/models/locale_code_list_test.dart +++ b/test/src/models/locale_code_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('LocaleCodeList', () { - test('model', () { final model = LocaleCodeList( total: 5, diff --git a/test/src/models/locale_code_test.dart b/test/src/models/locale_code_test.dart index 579c254a..26116578 100644 --- a/test/src/models/locale_code_test.dart +++ b/test/src/models/locale_code_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('LocaleCode', () { - test('model', () { final model = LocaleCode( code: 'en-us', diff --git a/test/src/models/locale_test.dart b/test/src/models/locale_test.dart index 55515a36..0b65d14a 100644 --- a/test/src/models/locale_test.dart +++ b/test/src/models/locale_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Locale', () { - test('model', () { final model = Locale( ip: '127.0.0.1', diff --git a/test/src/models/log_list_test.dart b/test/src/models/log_list_test.dart index cb84b9f8..a66cdabf 100644 --- a/test/src/models/log_list_test.dart +++ b/test/src/models/log_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('LogList', () { - test('model', () { final model = LogList( total: 5, diff --git a/test/src/models/log_test.dart b/test/src/models/log_test.dart index f1fe1e97..c4e740c9 100644 --- a/test/src/models/log_test.dart +++ b/test/src/models/log_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Log', () { - test('model', () { final model = Log( event: 'account.sessions.create', diff --git a/test/src/models/membership_list_test.dart b/test/src/models/membership_list_test.dart index 47bec4b8..0f0f0d60 100644 --- a/test/src/models/membership_list_test.dart +++ b/test/src/models/membership_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('MembershipList', () { - test('model', () { final model = MembershipList( total: 5, diff --git a/test/src/models/membership_test.dart b/test/src/models/membership_test.dart index 23cfbd6c..b28fcff6 100644 --- a/test/src/models/membership_test.dart +++ b/test/src/models/membership_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Membership', () { - test('model', () { final model = Membership( $id: '5e5ea5c16897e', diff --git a/test/src/models/message_list_test.dart b/test/src/models/message_list_test.dart index 73cbf14f..cd22ec3a 100644 --- a/test/src/models/message_list_test.dart +++ b/test/src/models/message_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('MessageList', () { - test('model', () { final model = MessageList( total: 5, diff --git a/test/src/models/message_test.dart b/test/src/models/message_test.dart index 44125833..22b83fef 100644 --- a/test/src/models/message_test.dart +++ b/test/src/models/message_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Message', () { - test('model', () { final model = Message( $id: '5e5ea5c16897e', diff --git a/test/src/models/mfa_challenge_test.dart b/test/src/models/mfa_challenge_test.dart index fff934ef..568d6e83 100644 --- a/test/src/models/mfa_challenge_test.dart +++ b/test/src/models/mfa_challenge_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('MfaChallenge', () { - test('model', () { final model = MfaChallenge( $id: 'bb8ea5c16897e', diff --git a/test/src/models/mfa_factors_test.dart b/test/src/models/mfa_factors_test.dart index 59eaa005..59b7e2c7 100644 --- a/test/src/models/mfa_factors_test.dart +++ b/test/src/models/mfa_factors_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('MfaFactors', () { - test('model', () { final model = MfaFactors( totp: true, diff --git a/test/src/models/mfa_recovery_codes_test.dart b/test/src/models/mfa_recovery_codes_test.dart index 56555ca6..36eb4701 100644 --- a/test/src/models/mfa_recovery_codes_test.dart +++ b/test/src/models/mfa_recovery_codes_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('MfaRecoveryCodes', () { - test('model', () { final model = MfaRecoveryCodes( recoveryCodes: [], diff --git a/test/src/models/mfa_type_test.dart b/test/src/models/mfa_type_test.dart index cbb9e4ee..fd71f87d 100644 --- a/test/src/models/mfa_type_test.dart +++ b/test/src/models/mfa_type_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('MfaType', () { - test('model', () { final model = MfaType( secret: '1', diff --git a/test/src/models/phone_list_test.dart b/test/src/models/phone_list_test.dart index 1ee77396..6b5ff57e 100644 --- a/test/src/models/phone_list_test.dart +++ b/test/src/models/phone_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('PhoneList', () { - test('model', () { final model = PhoneList( total: 5, diff --git a/test/src/models/phone_test.dart b/test/src/models/phone_test.dart index 64ff093a..03ba35f6 100644 --- a/test/src/models/phone_test.dart +++ b/test/src/models/phone_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Phone', () { - test('model', () { final model = Phone( code: '+1', diff --git a/test/src/models/preferences_test.dart b/test/src/models/preferences_test.dart index f2e654dc..7f0e6ba0 100644 --- a/test/src/models/preferences_test.dart +++ b/test/src/models/preferences_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Preferences', () { - test('model', () { final model = Preferences( data: {}, diff --git a/test/src/models/provider_list_test.dart b/test/src/models/provider_list_test.dart index 954c442d..8100c9dc 100644 --- a/test/src/models/provider_list_test.dart +++ b/test/src/models/provider_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('ProviderList', () { - test('model', () { final model = ProviderList( total: 5, diff --git a/test/src/models/provider_test.dart b/test/src/models/provider_test.dart index a1ecd414..d3b1a8ab 100644 --- a/test/src/models/provider_test.dart +++ b/test/src/models/provider_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Provider', () { - test('model', () { final model = Provider( $id: '5e5ea5c16897e', diff --git a/test/src/models/resource_token_list_test.dart b/test/src/models/resource_token_list_test.dart index 1c1cd293..1cda3569 100644 --- a/test/src/models/resource_token_list_test.dart +++ b/test/src/models/resource_token_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('ResourceTokenList', () { - test('model', () { final model = ResourceTokenList( total: 5, diff --git a/test/src/models/resource_token_test.dart b/test/src/models/resource_token_test.dart index 1334f1e0..d792db7e 100644 --- a/test/src/models/resource_token_test.dart +++ b/test/src/models/resource_token_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('ResourceToken', () { - test('model', () { final model = ResourceToken( $id: 'bb8ea5c16897e', diff --git a/test/src/models/row_list_test.dart b/test/src/models/row_list_test.dart new file mode 100644 index 00000000..ce334d8b --- /dev/null +++ b/test/src/models/row_list_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('RowList', () { + test('model', () { + final model = RowList( + total: 5, + rows: [], + ); + + final map = model.toMap(); + final result = RowList.fromMap(map); + + expect(result.total, 5); + expect(result.rows, []); + }); + }); +} diff --git a/test/src/models/row_test.dart b/test/src/models/row_test.dart new file mode 100644 index 00000000..9770d87f --- /dev/null +++ b/test/src/models/row_test.dart @@ -0,0 +1,30 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('Row', () { + test('model', () { + final model = Row( + $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: [], + data: {}, + ); + + 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, []); + }); + }); +} diff --git a/test/src/models/runtime_list_test.dart b/test/src/models/runtime_list_test.dart index 1a5a266e..59f6f94d 100644 --- a/test/src/models/runtime_list_test.dart +++ b/test/src/models/runtime_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('RuntimeList', () { - test('model', () { final model = RuntimeList( total: 5, diff --git a/test/src/models/runtime_test.dart b/test/src/models/runtime_test.dart index 47b66744..4949b0cc 100644 --- a/test/src/models/runtime_test.dart +++ b/test/src/models/runtime_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Runtime', () { - test('model', () { final model = Runtime( $id: 'python-3.8', diff --git a/test/src/models/session_list_test.dart b/test/src/models/session_list_test.dart index 1430b151..b7bc83cc 100644 --- a/test/src/models/session_list_test.dart +++ b/test/src/models/session_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('SessionList', () { - test('model', () { final model = SessionList( total: 5, diff --git a/test/src/models/session_test.dart b/test/src/models/session_test.dart index aba72b36..adda7c0d 100644 --- a/test/src/models/session_test.dart +++ b/test/src/models/session_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Session', () { - test('model', () { final model = Session( $id: '5e5ea5c16897e', diff --git a/test/src/models/site_list_test.dart b/test/src/models/site_list_test.dart index 8aa8e225..4bfbbcb8 100644 --- a/test/src/models/site_list_test.dart +++ b/test/src/models/site_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('SiteList', () { - test('model', () { final model = SiteList( total: 5, diff --git a/test/src/models/site_test.dart b/test/src/models/site_test.dart index 234eef88..d73d1003 100644 --- a/test/src/models/site_test.dart +++ b/test/src/models/site_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Site', () { - test('model', () { final model = Site( $id: '5e5ea5c16897e', diff --git a/test/src/models/specification_list_test.dart b/test/src/models/specification_list_test.dart index 57892bf1..569f8cab 100644 --- a/test/src/models/specification_list_test.dart +++ b/test/src/models/specification_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('SpecificationList', () { - test('model', () { final model = SpecificationList( total: 5, diff --git a/test/src/models/specification_test.dart b/test/src/models/specification_test.dart index a70667d1..a174559f 100644 --- a/test/src/models/specification_test.dart +++ b/test/src/models/specification_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Specification', () { - test('model', () { final model = Specification( memory: 512, diff --git a/test/src/models/subscriber_list_test.dart b/test/src/models/subscriber_list_test.dart index d46f0559..2ef39800 100644 --- a/test/src/models/subscriber_list_test.dart +++ b/test/src/models/subscriber_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('SubscriberList', () { - test('model', () { final model = SubscriberList( total: 5, diff --git a/test/src/models/subscriber_test.dart b/test/src/models/subscriber_test.dart index ed906512..18fbf0e5 100644 --- a/test/src/models/subscriber_test.dart +++ b/test/src/models/subscriber_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Subscriber', () { - test('model', () { final model = Subscriber( $id: '259125845563242502', diff --git a/test/src/models/table_list_test.dart b/test/src/models/table_list_test.dart new file mode 100644 index 00000000..1330ab89 --- /dev/null +++ b/test/src/models/table_list_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('TableList', () { + test('model', () { + final model = TableList( + total: 5, + tables: [], + ); + + final map = model.toMap(); + final result = TableList.fromMap(map); + + expect(result.total, 5); + expect(result.tables, []); + }); + }); +} diff --git a/test/src/models/table_test.dart b/test/src/models/table_test.dart new file mode 100644 index 00000000..d16033bf --- /dev/null +++ b/test/src/models/table_test.dart @@ -0,0 +1,35 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('Table', () { + test('model', () { + final model = Table( + $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: [], + ); + + 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, []); + }); + }); +} diff --git a/test/src/models/target_list_test.dart b/test/src/models/target_list_test.dart index 5f96366d..7920cc85 100644 --- a/test/src/models/target_list_test.dart +++ b/test/src/models/target_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('TargetList', () { - test('model', () { final model = TargetList( total: 5, diff --git a/test/src/models/target_test.dart b/test/src/models/target_test.dart index 891a939b..655a840c 100644 --- a/test/src/models/target_test.dart +++ b/test/src/models/target_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Target', () { - test('model', () { final model = Target( $id: '259125845563242502', diff --git a/test/src/models/team_list_test.dart b/test/src/models/team_list_test.dart index f2f044d9..875bd1af 100644 --- a/test/src/models/team_list_test.dart +++ b/test/src/models/team_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('TeamList', () { - test('model', () { final model = TeamList( total: 5, diff --git a/test/src/models/team_test.dart b/test/src/models/team_test.dart index 904f0eea..45d12b7f 100644 --- a/test/src/models/team_test.dart +++ b/test/src/models/team_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Team', () { - test('model', () { final model = Team( $id: '5e5ea5c16897e', diff --git a/test/src/models/token_test.dart b/test/src/models/token_test.dart index 9e6cdb54..90ae6415 100644 --- a/test/src/models/token_test.dart +++ b/test/src/models/token_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Token', () { - test('model', () { final model = Token( $id: 'bb8ea5c16897e', diff --git a/test/src/models/topic_list_test.dart b/test/src/models/topic_list_test.dart index 4d4fc12d..bae2557b 100644 --- a/test/src/models/topic_list_test.dart +++ b/test/src/models/topic_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('TopicList', () { - test('model', () { final model = TopicList( total: 5, diff --git a/test/src/models/topic_test.dart b/test/src/models/topic_test.dart index 666097f3..b5cf9bdd 100644 --- a/test/src/models/topic_test.dart +++ b/test/src/models/topic_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Topic', () { - test('model', () { final model = Topic( $id: '259125845563242502', diff --git a/test/src/models/user_list_test.dart b/test/src/models/user_list_test.dart index 954daa37..3503253d 100644 --- a/test/src/models/user_list_test.dart +++ b/test/src/models/user_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('UserList', () { - test('model', () { final model = UserList( total: 5, diff --git a/test/src/models/user_test.dart b/test/src/models/user_test.dart index 1f411e3d..9827da38 100644 --- a/test/src/models/user_test.dart +++ b/test/src/models/user_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('User', () { - test('model', () { final model = User( $id: '5e5ea5c16897e', diff --git a/test/src/models/variable_list_test.dart b/test/src/models/variable_list_test.dart index 55e8f4ab..b9de10b3 100644 --- a/test/src/models/variable_list_test.dart +++ b/test/src/models/variable_list_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('VariableList', () { - test('model', () { final model = VariableList( total: 5, diff --git a/test/src/models/variable_test.dart b/test/src/models/variable_test.dart index 0d86ef00..322de49b 100644 --- a/test/src/models/variable_test.dart +++ b/test/src/models/variable_test.dart @@ -3,7 +3,6 @@ import 'package:test/test.dart'; void main() { group('Variable', () { - test('model', () { final model = Variable( $id: '5e5ea5c16897e', diff --git a/test/src/response_test.dart b/test/src/response_test.dart index 8accb45f..32b4c58f 100644 --- a/test/src/response_test.dart +++ b/test/src/response_test.dart @@ -15,4 +15,4 @@ void main() { expect(response.toString(), '{"x":1}'); }); }); -} \ No newline at end of file +} From 790c5efc5db7740500f6f094012ed0b7299f36cb Mon Sep 17 00:00:00 2001 From: abnegate Date: Tue, 19 Aug 2025 15:15:42 +0000 Subject: [PATCH 02/22] Commit from GitHub Actions (Format and push) --- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/dart_appwrite.dart | 2 +- lib/id.dart | 3 +- lib/query.dart | 69 +- lib/role.dart | 106 +- lib/services/account.dart | 2163 +++++++------- lib/services/avatars.dart | 434 +-- lib/services/databases.dart | 2890 +++++++++++-------- lib/services/functions.dart | 1385 +++++---- lib/services/graphql.dart | 90 +- lib/services/health.dart | 683 +++-- lib/services/locale.dart | 246 +- lib/services/messaging.dart | 2628 +++++++++-------- lib/services/sites.dart | 1282 ++++---- lib/services/storage.dart | 744 ++--- lib/services/tables-db.dart | 2679 +++++++++-------- lib/services/teams.dart | 671 +++-- lib/services/tokens.dart | 216 +- lib/services/users.dart | 2063 +++++++------ lib/src/client.dart | 15 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/client_stub.dart | 3 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/type.dart | 14 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 232 +- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 +-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 +-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 +-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- lib/src/upload_progress.dart | 2 +- 169 files changed, 15744 insertions(+), 14239 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/dart_appwrite.dart b/lib/dart_appwrite.dart index f3b8837b..9d35ec51 100644 --- a/lib/dart_appwrite.dart +++ b/lib/dart_appwrite.dart @@ -1,6 +1,6 @@ /// Appwrite Dart SDK /// -/// This SDK is compatible with Appwrite server version 1.8.x. +/// This SDK is compatible with Appwrite server version 1.8.x. /// For older versions, please check /// [previous releases](https://github.com/appwrite/sdk-for-dart/releases). library dart_appwrite; diff --git a/lib/id.dart b/lib/id.dart index 72e26a23..28ff15e8 100644 --- a/lib/id.dart +++ b/lib/id.dart @@ -10,8 +10,7 @@ class ID { final now = DateTime.now(); final sec = (now.millisecondsSinceEpoch / 1000).floor(); final usec = now.microsecondsSinceEpoch - (sec * 1000000); - return sec.toRadixString(16) + - usec.toRadixString(16).padLeft(5, '0'); + return sec.toRadixString(16) + usec.toRadixString(16).padLeft(5, '0'); } // Generate a unique ID with padding to have a longer ID diff --git a/lib/query.dart b/lib/query.dart index 37179593..c9a2fc91 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -1,6 +1,5 @@ part of 'dart_appwrite.dart'; - /// Helper class to generate query strings. class Query { final String method; @@ -10,15 +9,13 @@ class Query { Query._(this.method, [this.attribute = null, this.values = null]); Map toJson() { - final map = { - 'method': method, - }; + final map = {'method': method}; - if(attribute != null) { + if (attribute != null) { map['attribute'] = attribute; } - - if(values != null) { + + if (values != null) { map['values'] = values is List ? values : [values]; } @@ -29,7 +26,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. @@ -61,10 +58,12 @@ class Query { Query._('search', attribute, value).toString(); /// Filter resources where [attribute] is null. - static String isNull(String attribute) => Query._('isNull', attribute).toString(); + static String isNull(String attribute) => + Query._('isNull', attribute).toString(); /// Filter resources where [attribute] is not null. - static String isNotNull(String attribute) => Query._('isNotNull', attribute).toString(); + static String isNotNull(String attribute) => + Query._('isNotNull', attribute).toString(); /// Filter resources where [attribute] is between [start] and [end] (inclusive). static String between(String attribute, dynamic start, dynamic end) => @@ -105,52 +104,66 @@ class Query { Query._('notEndsWith', attribute, value).toString(); /// Filter resources where document was created before [value]. - static String createdBefore(String value) => Query._('createdBefore', null, value).toString(); + static String createdBefore(String value) => + Query._('createdBefore', null, value).toString(); /// Filter resources where document was created after [value]. - static String createdAfter(String value) => Query._('createdAfter', null, value).toString(); + static String createdAfter(String value) => + Query._('createdAfter', null, value).toString(); /// Filter resources where document was updated before [value]. - static String updatedBefore(String value) => Query._('updatedBefore', null, value).toString(); + static String updatedBefore(String value) => + Query._('updatedBefore', null, value).toString(); /// Filter resources where document was updated after [value]. - static String updatedAfter(String value) => Query._('updatedAfter', null, value).toString(); + static String updatedAfter(String value) => + Query._('updatedAfter', null, value).toString(); - static String or(List queries) => - Query._('or', null, queries.map((query) => jsonDecode(query)).toList()).toString(); + static String or(List queries) => Query._( + 'or', + null, + queries.map((query) => jsonDecode(query)).toList(), + ).toString(); - static String and(List queries) => - Query._('and', null, queries.map((query) => jsonDecode(query)).toList()).toString(); + static String and(List queries) => Query._( + 'and', + null, + queries.map((query) => jsonDecode(query)).toList(), + ).toString(); /// Specify which attributes should be returned by the API call. static String select(List attributes) => Query._('select', null, attributes).toString(); /// Sort results by [attribute] ascending. - static String orderAsc(String attribute) => Query._('orderAsc', attribute).toString(); + static String orderAsc(String attribute) => + Query._('orderAsc', attribute).toString(); /// Sort results by [attribute] descending. - static String orderDesc(String attribute) => Query._('orderDesc', attribute).toString(); + static String orderDesc(String attribute) => + Query._('orderDesc', attribute).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(); + 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) => Query._('cursorAfter', null, id).toString(); + static String cursorAfter(String id) => + Query._('cursorAfter', null, id).toString(); /// Return only [limit] results. 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(); - -} \ No newline at end of file + static String offset(int offset) => + Query._('offset', null, offset).toString(); +} diff --git a/lib/role.dart b/lib/role.dart index 6552df47..dafeb78d 100644 --- a/lib/role.dart +++ b/lib/role.dart @@ -2,65 +2,65 @@ part of 'dart_appwrite.dart'; /// Helper class to generate role strings for [Permission]. class Role { - Role._(); - - /// Grants access to anyone. - /// - /// This includes authenticated and unauthenticated users. - static String any() { - return 'any'; - } + Role._(); - /// Grants access to a specific user by user ID. - /// - /// You can optionally pass verified or unverified for - /// [status] to target specific types of users. - static String user(String id, [String status = '']) { - if(status.isEmpty) { - return 'user:$id'; - } - return 'user:$id/$status'; - } + /// Grants access to anyone. + /// + /// This includes authenticated and unauthenticated users. + static String any() { + return 'any'; + } - /// Grants access to any authenticated or anonymous user. - /// - /// You can optionally pass verified or unverified for - /// [status] to target specific types of users. - static String users([String status = '']) { - if(status.isEmpty) { - return 'users'; - } - return 'users/$status'; + /// Grants access to a specific user by user ID. + /// + /// You can optionally pass verified or unverified for + /// [status] to target specific types of users. + static String user(String id, [String status = '']) { + if (status.isEmpty) { + return 'user:$id'; } + return 'user:$id/$status'; + } - /// Grants access to any guest user without a session. - /// - /// Authenticated users don't have access to this role. - static String guests() { - return 'guests'; + /// Grants access to any authenticated or anonymous user. + /// + /// You can optionally pass verified or unverified for + /// [status] to target specific types of users. + static String users([String status = '']) { + if (status.isEmpty) { + return 'users'; } + return 'users/$status'; + } - /// Grants access to a team by team ID. - /// - /// You can optionally pass a role for [role] to target - /// team members with the specified role. - static String team(String id, [String role = '']) { - if(role.isEmpty) { - return 'team:$id'; - } - return 'team:$id/$role'; - } + /// Grants access to any guest user without a session. + /// + /// Authenticated users don't have access to this role. + static String guests() { + return 'guests'; + } - /// Grants access to a specific member of a team. - /// - /// When the member is removed from the team, they will - /// no longer have access. - static String member(String id) { - return 'member:$id'; + /// Grants access to a team by team ID. + /// + /// You can optionally pass a role for [role] to target + /// team members with the specified role. + static String team(String id, [String role = '']) { + if (role.isEmpty) { + return 'team:$id'; } + return 'team:$id/$role'; + } - /// Grants access to a user with the specified label. - static String label(String name) { - return 'label:$name'; - } -} \ No newline at end of file + /// Grants access to a specific member of a team. + /// + /// When the member is removed from the team, they will + /// no longer have access. + static String member(String id) { + return 'member:$id'; + } + + /// Grants access to a user with the specified label. + static String label(String name) { + return 'label:$name'; + } +} diff --git a/lib/services/account.dart b/lib/services/account.dart index ab1684de..b1358d47 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -2,1083 +2,1086 @@ part of '../dart_appwrite.dart'; /// The Account service allows you to authenticate and manage a user account. class Account extends Service { - Account(super.client); - - /// Get the currently logged in user. - Future get() async { - final String apiPath = '/account'; - - final Map apiParams = { - - - }; - - final Map 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 - /// the - /// [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) - /// 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'; - - final Map apiParams = { - - 'userId': userId, -'email': email, -'password': password, -'name': name, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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 - /// email is not sent automatically however you can use the send confirmation - /// email endpoint again to send the confirmation email. For security measures, - /// 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'; - - final Map apiParams = { - - 'email': email, -'password': password, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) async { - final String apiPath = '/account/identities'; - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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); - - 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; - - } - - /// 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() async { - final String apiPath = '/account/jwts'; - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) async { - final String apiPath = '/account/logs'; - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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'; - - 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); - - 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. - Future createMfaAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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. - 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); - - return models.User.fromMap(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); - - 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; - - } - - /// 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/challenge'; - - 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); - - 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. - Future updateMfaChallenge({required String challengeId, required String otp}) async { - final String apiPath = '/account/mfa/challenge'; - - final Map apiParams = { - - 'challengeId': challengeId, -'otp': otp, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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. - Future listMfaFactors() async { - final String apiPath = '/account/mfa/factors'; - - final Map apiParams = { - - - }; - - final Map 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. - Future getMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; - - final Map apiParams = { - - - }; - - final Map 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. - Future createMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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. - Future updateMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; - - 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.MfaRecoveryCodes.fromMap(res.data); - - } - - /// Update currently logged in user 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); - - 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'; - - final Map apiParams = { - - 'password': password, -'oldPassword': oldPassword, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'phone': phone, -'password': password, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - - }; - - final Map 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'; - - 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); - - 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 - /// app password reset URL with the secret key and email address values - /// attached to the URL query string. Use the query string params to submit a - /// request to the [PUT - /// /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'; - - final Map apiParams = { - - 'email': email, -'url': url, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, -'password': password, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - - }; - - final Map 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'; - - 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; - - } - - /// 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 - /// allow the new user to convert an anonymous account to a normal account, you - /// need to update its [email and - /// 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'; - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'email': email, -'password': password, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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.') - Future updateMagicURLSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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.') - Future updatePhoneSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - 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.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); - - 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; - - } - - /// 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'; - - 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.User.fromMap(res.data); - - } - - /// Sends the user an email 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 - /// returned user ID and secret and submit a request to the [POST - /// /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'; - - final Map apiParams = { - - 'userId': userId, -'email': email, -'phrase': phrase, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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 - /// the user clicks the link in the email, the user is redirected back to the - /// URL you provided with the secret key and userId values attached to the URL - /// query string. Use the query string parameters to submit a request to the - /// [POST - /// /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'; - - final Map apiParams = { - - 'userId': userId, -'email': email, -'url': url, -'phrase': phrase, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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. - /// - /// 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); - - final Map params = { - 'success': success, -'failure': failure, -'scopes': scopes, - - - 'project': client.config['project'], - }; - - final List query = []; - - params.forEach((key, value) { - if (value is List) { - for (var item in value) { - query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); - } - } else if(value != null) { - query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); - } - }); - - 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('&') - ); - - 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 - /// returned user ID and secret and submit a request to the [POST - /// /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'; - - final Map apiParams = { - - 'userId': userId, -'phone': phone, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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** - /// and **secret** arguments will be passed as query parameters to the URL you - /// have provided to be attached to the verification email. The provided URL - /// should redirect the user back to your app and allow you to complete the - /// verification process by verifying both the **userId** and **secret** - /// 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; - - 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); - - 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 updateVerification({required String userId, required String secret}) async { - final String apiPath = '/account/verification'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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 - /// using the - /// [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) - /// endpoint. Learn more about how to [complete the verification - /// 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/verification/phone'; - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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/verification/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); - - return models.Token.fromMap(res.data); - - } -} \ No newline at end of file + Account(super.client); + + /// Get the currently logged in user. + Future get() async { + final String apiPath = '/account'; + + final Map apiParams = {}; + + final Map 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 + /// the + /// [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) + /// 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'; + + final Map apiParams = { + 'userId': userId, + 'email': email, + 'password': password, + 'name': name, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 + /// email is not sent automatically however you can use the send confirmation + /// email endpoint again to send the confirmation email. For security measures, + /// 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'; + + final Map apiParams = { + 'email': email, + 'password': password, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { + final String apiPath = '/account/identities'; + + final Map apiParams = {'queries': queries}; + + final Map 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, + ); + + 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; + } + + /// 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() async { + final String apiPath = '/account/jwts'; + + final Map apiParams = {}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { + final String apiPath = '/account/logs'; + + final Map apiParams = {'queries': queries}; + + final Map 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'; + + 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, + ); + + 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. + Future createMfaAuthenticator({ + required enums.AuthenticatorType type, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); + + final Map apiParams = {}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. + 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, + ); + + return models.User.fromMap(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, + ); + + 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; + } + + /// 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/challenge'; + + 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, + ); + + 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. + Future updateMfaChallenge({ + required String challengeId, + required String otp, + }) async { + final String apiPath = '/account/mfa/challenge'; + + final Map apiParams = { + 'challengeId': challengeId, + 'otp': otp, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. + Future listMfaFactors() async { + final String apiPath = '/account/mfa/factors'; + + final Map apiParams = {}; + + final Map 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. + Future getMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; + + final Map apiParams = {}; + + final Map 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. + Future createMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; + + final Map apiParams = {}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. + Future updateMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; + + 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.MfaRecoveryCodes.fromMap(res.data); + } + + /// Update currently logged in user 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, + ); + + 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'; + + final Map apiParams = { + 'password': password, + 'oldPassword': oldPassword, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'phone': phone, + 'password': password, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = {}; + + final Map 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'; + + 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, + ); + + 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 + /// app password reset URL with the secret key and email address values + /// attached to the URL query string. Use the query string params to submit a + /// request to the [PUT + /// /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'; + + final Map apiParams = {'email': email, 'url': url}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'userId': userId, + 'secret': secret, + 'password': password, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = {}; + + final Map 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'; + + 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; + } + + /// 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 + /// allow the new user to convert an anonymous account to a normal account, you + /// need to update its [email and + /// 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'; + + final Map apiParams = {}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'email': email, + 'password': password, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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.') + Future updateMagicURLSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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.') + Future updatePhoneSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + ); + + final Map apiParams = {}; + + final Map 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, + ); + + 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.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, + ); + + 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; + } + + /// 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'; + + 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.User.fromMap(res.data); + } + + /// Sends the user an email 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 + /// returned user ID and secret and submit a request to the [POST + /// /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'; + + final Map apiParams = { + 'userId': userId, + 'email': email, + 'phrase': phrase, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 + /// the user clicks the link in the email, the user is redirected back to the + /// URL you provided with the secret key and userId values attached to the URL + /// query string. Use the query string parameters to submit a request to the + /// [POST + /// /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'; + + final Map apiParams = { + 'userId': userId, + 'email': email, + 'url': url, + 'phrase': phrase, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. + /// + /// 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, + ); + + final Map params = { + 'success': success, + 'failure': failure, + 'scopes': scopes, + + 'project': client.config['project'], + }; + + final List query = []; + + params.forEach((key, value) { + if (value is List) { + for (var item in value) { + query.add( + Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item), + ); + } + } else if (value != null) { + query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); + } + }); + + 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('&'), + ); + + 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 + /// returned user ID and secret and submit a request to the [POST + /// /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'; + + final Map apiParams = {'userId': userId, 'phone': phone}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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** + /// and **secret** arguments will be passed as query parameters to the URL you + /// have provided to be attached to the verification email. The provided URL + /// should redirect the user back to your app and allow you to complete the + /// verification process by verifying both the **userId** and **secret** + /// 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 createVerification({required String url}) async { + final String apiPath = '/account/verification'; + + 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, + ); + + 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 updateVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 + /// using the + /// [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) + /// endpoint. Learn more about how to [complete the verification + /// 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/verification/phone'; + + final Map apiParams = {}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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/verification/phone'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.put, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return models.Token.fromMap(res.data); + } +} diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index 381146d4..8033f1cd 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -3,187 +3,253 @@ part of '../dart_appwrite.dart'; /// 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); - - /// 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); - - final Map params = { - 'width': width, -'height': height, -'quality': quality, - - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - 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); - - final Map params = { - 'width': width, -'height': height, -'quality': quality, - - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - 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'; - - 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); - 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); - - final Map params = { - 'width': width, -'height': height, -'quality': quality, - - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - 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'; - - final Map params = { - 'url': url, -'width': width, -'height': height, - - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - 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'; - - final Map params = { - 'name': name, -'width': width, -'height': height, -'background': background, - - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - 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'; - - final Map params = { - 'text': text, -'size': size, -'margin': margin, -'download': download, - - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); - return res.data; - } -} \ No newline at end of file + 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, + ); + + final Map params = { + 'width': width, + 'height': height, + 'quality': quality, + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + 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, + ); + + final Map params = { + 'width': width, + 'height': height, + 'quality': quality, + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + 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'; + + 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, + ); + 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, + ); + + final Map params = { + 'width': width, + 'height': height, + 'quality': quality, + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + 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'; + + final Map params = { + 'url': url, + 'width': width, + 'height': height, + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + 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'; + + final Map params = { + 'name': name, + 'width': width, + 'height': height, + 'background': background, + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + 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'; + + final Map params = { + 'text': text, + 'size': size, + 'margin': margin, + 'download': download, + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: params, + responseType: ResponseType.bytes, + ); + return res.data; + } +} diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 3d1e095d..74dd60f0 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -3,1214 +3,1682 @@ part of '../dart_appwrite.dart'; /// The Databases service allows you to create structured collections of /// documents, query and filter lists of documents class Databases extends Service { - 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}) async { - final String apiPath = '/databases'; - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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.createDatabase` instead.') - Future create({required String databaseId, required String name, bool? enabled, enums.Type? type}) async { - final String apiPath = '/databases'; - - final Map apiParams = { - - 'databaseId': databaseId, -'name': name, -'enabled': enabled, -'type': type?.value, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); - - return models.Database.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); - - final Map apiParams = { - - - }; - - final Map 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, required String name, bool? enabled}) async { - final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - 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 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}) async { - final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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}) async { - final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'collectionId': collectionId, -'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - 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; - - } - - /// 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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); - - final Map apiParams = { - - 'key': key, -'required': xrequired, -'default': xdefault, -'array': array, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - '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); - - 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); - - final Map apiParams = { - - 'key': key, -'required': xrequired, -'default': xdefault, -'array': array, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - '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); - - 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); - - final Map apiParams = { - - 'key': key, -'required': xrequired, -'default': xdefault, -'array': array, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - '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); - - 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); - - final Map apiParams = { - - 'key': key, -'elements': elements, -'required': xrequired, -'default': xdefault, -'array': array, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - 'elements': elements, -'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); - - 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); - - final Map apiParams = { - - 'key': key, -'required': xrequired, -'min': min, -'max': max, -'default': xdefault, -'array': array, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - 'required': xrequired, -'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.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); - - final Map apiParams = { - - 'key': key, -'required': xrequired, -'min': min, -'max': max, -'default': xdefault, -'array': array, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - 'required': xrequired, -'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.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); - - final Map apiParams = { - - 'key': key, -'required': xrequired, -'default': xdefault, -'array': array, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - '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); - - return models.AttributeIp.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); - - final Map apiParams = { - - 'relatedCollectionId': relatedCollectionId, -'type': type.value, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, 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); - - final Map apiParams = { - - 'key': key, -'size': size, -'required': xrequired, -'default': xdefault, -'array': array, -'encrypt': encrypt, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - 'required': xrequired, -'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); - - return models.AttributeString.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); - - final Map apiParams = { - - 'key': key, -'required': xrequired, -'default': xdefault, -'array': array, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - '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); - - return models.AttributeUrl.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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } - - /// 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); - - 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 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/{key}/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); - - final Map apiParams = { - - 'onDelete': onDelete?.value, -'newKey': newKey, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - - return models.AttributeRelationship.fromMap(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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documentId': documentId, -'data': data, -'permissions': permissions, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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, required Map data, List? permissions}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - final Map apiParams = { - - 'data': data, -'permissions': permissions, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - final Map apiParams = { - - 'data': data, -'permissions': permissions, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - 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; - - } - - /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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.IndexType 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, -'orders': orders, -'lengths': lengths, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); - - return models.Index.fromMap(res.data); - - } - - /// Get index by 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); - - final Map apiParams = { - - - }; - - final Map 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); - - 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; - - } -} \ No newline at end of file + 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, + }) async { + final String apiPath = '/databases'; + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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.createDatabase` instead.', + ) + Future create({ + required String databaseId, + required String name, + bool? enabled, + enums.Type? type, + }) async { + final String apiPath = '/databases'; + + final Map apiParams = { + 'databaseId': databaseId, + 'name': name, + 'enabled': enabled, + 'type': type?.value, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.post, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return models.Database.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, + ); + + final Map apiParams = {}; + + final Map 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, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + ); + + 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 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = { + 'collectionId': collectionId, + 'name': name, + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = {}; + + final Map 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, + required String name, + List? permissions, + bool? documentSecurity, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'name': name, + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + 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; + } + + /// 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + + final Map apiParams = { + 'key': key, + 'required': xrequired, + 'default': xdefault, + 'array': array, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + '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, + ); + + 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); + + final Map apiParams = { + 'key': key, + 'required': xrequired, + 'default': xdefault, + 'array': array, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + '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, + ); + + 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); + + final Map apiParams = { + 'key': key, + 'required': xrequired, + 'default': xdefault, + 'array': array, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + '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, + ); + + 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); + + final Map apiParams = { + 'key': key, + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + 'elements': elements, + '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, + ); + + 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); + + final Map apiParams = { + 'key': key, + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + 'required': xrequired, + '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.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); + + final Map apiParams = { + 'key': key, + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + 'required': xrequired, + '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.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); + + final Map apiParams = { + 'key': key, + 'required': xrequired, + 'default': xdefault, + 'array': array, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + '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, + ); + + return models.AttributeIp.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); + + final Map apiParams = { + 'relatedCollectionId': relatedCollectionId, + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.post, + 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); + + final Map apiParams = { + 'key': key, + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + 'required': xrequired, + '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, + ); + + return models.AttributeString.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); + + final Map apiParams = { + 'key': key, + 'required': xrequired, + 'default': xdefault, + 'array': array, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + '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, + ); + + return models.AttributeUrl.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); + + final Map apiParams = {}; + + final Map apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } + + /// 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); + + 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 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/{key}/relationship' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); + + final Map apiParams = { + 'onDelete': onDelete?.value, + 'newKey': newKey, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.patch, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return models.AttributeRelationship.fromMap(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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'documentId': documentId, + 'data': data, + 'permissions': permissions, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + final Map apiParams = {'queries': queries}; + + final Map 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, + required Map data, + List? permissions, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + final Map apiParams = { + 'data': data, + 'permissions': permissions, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + final Map apiParams = { + 'data': data, + 'permissions': permissions, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + 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; + } + + /// 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, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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, + 'orders': orders, + 'lengths': lengths, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.post, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return models.Index.fromMap(res.data); + } + + /// Get index by 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); + + final Map apiParams = {}; + + final Map 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); + + 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/functions.dart b/lib/services/functions.dart index ad261abf..e86f1afe 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -3,623 +3,768 @@ part of '../dart_appwrite.dart'; /// The Functions Service allows you view, create and manage your Cloud /// Functions. class Functions extends Service { - 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}) async { - final String apiPath = '/functions'; - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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? specification}) async { - final String apiPath = '/functions'; - - final Map apiParams = { - - 'functionId': functionId, -'name': name, -'runtime': runtime.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - - }; - - final Map 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'; - - final Map apiParams = { - - - }; - - final Map 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); - - final Map apiParams = { - - - }; - - final Map 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? specification}) async { - final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); - - final Map apiParams = { - - 'name': name, -'runtime': runtime?.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - 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 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); - - 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); - - 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}) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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); - - final Map apiParams = { - - 'entrypoint': entrypoint, -'commands': commands, -'code': code, -'activate': activate, - - }; - - final Map apiHeaders = { - 'content-type': 'multipart/form-data', - - }; - - String idParamName = ''; - final paramName = 'code'; - final res = await client.chunkedUpload( - path: apiPath, - params: apiParams, - paramName: paramName, - idParamName: idParamName, - headers: apiHeaders, - onProgress: onProgress, - ); - - 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, -'buildId': buildId, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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/server/functions#listTemplates) to - /// find the template details. - Future createTemplateDeployment({required String functionId, required String repository, required String owner, required String rootDirectory, required String version, bool? activate}) async { - final String apiPath = '/functions/{functionId}/deployments/template'.replaceAll('{functionId}', functionId); - - final Map apiParams = { - - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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.VCSDeploymentType 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, -'activate': activate, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - 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 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); - - final Map params = { - '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); - 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); - - 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.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}) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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); - - final Map apiParams = { - - 'body': body, -'async': xasync, -'path': path, -'method': method?.value, -'headers': headers, -'scheduledAt': scheduledAt, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - 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 variables of a specific function. - Future listVariables({required String functionId}) async { - final String apiPath = '/functions/{functionId}/variables'.replaceAll('{functionId}', functionId); - - final Map apiParams = { - - - }; - - 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); - - final Map apiParams = { - - 'key': key, -'value': value, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - final Map apiParams = { - - 'key': key, -'value': value, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - 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; - - } -} \ No newline at end of file + 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, + }) async { + final String apiPath = '/functions'; + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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? specification, + }) async { + final String apiPath = '/functions'; + + final Map apiParams = { + 'functionId': functionId, + 'name': name, + 'runtime': runtime.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = {}; + + final Map 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'; + + final Map apiParams = {}; + + final Map 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, + ); + + final Map apiParams = {}; + + final Map 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? specification, + }) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); + + final Map apiParams = { + 'name': name, + 'runtime': runtime?.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + ); + + 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 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, + ); + + 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, + ); + + 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, + }) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll( + '{functionId}', + functionId, + ); + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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, + ); + + final Map apiParams = { + 'entrypoint': entrypoint, + 'commands': commands, + 'code': code, + 'activate': activate, + }; + + final Map apiHeaders = { + 'content-type': 'multipart/form-data', + }; + + String idParamName = ''; + final paramName = 'code'; + final res = await client.chunkedUpload( + path: apiPath, + params: apiParams, + paramName: paramName, + idParamName: idParamName, + headers: apiHeaders, + onProgress: onProgress, + ); + + 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); + + final Map apiParams = { + 'deploymentId': deploymentId, + 'buildId': buildId, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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/server/functions#listTemplates) to + /// find the template details. + Future createTemplateDeployment({ + required String functionId, + required String repository, + required String owner, + required String rootDirectory, + required String version, + bool? activate, + }) async { + final String apiPath = '/functions/{functionId}/deployments/template' + .replaceAll('{functionId}', functionId); + + final Map apiParams = { + 'repository': repository, + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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.VCSDeploymentType 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, + 'activate': activate, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = {}; + + final Map 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); + + 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 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); + + final Map params = { + '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, + ); + 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); + + 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.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, + }) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll( + '{functionId}', + functionId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, + ); + + final Map apiParams = { + 'body': body, + 'async': xasync, + 'path': path, + 'method': method?.value, + 'headers': headers, + 'scheduledAt': scheduledAt, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = {}; + + final Map 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); + + 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 variables of a specific function. + Future listVariables({ + required String functionId, + }) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll( + '{functionId}', + functionId, + ); + + final Map apiParams = {}; + + 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, + ); + + final Map apiParams = { + 'key': key, + 'value': value, + 'secret': secret, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = {}; + + final Map 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); + + final Map apiParams = { + 'key': key, + 'value': value, + 'secret': secret, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + 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/graphql.dart b/lib/services/graphql.dart index 92cc591f..18eb54f1 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -3,49 +3,47 @@ part of '../dart_appwrite.dart'; /// The GraphQL API allows you to query and mutate your Appwrite server using /// GraphQL. class Graphql extends Service { - Graphql(super.client); - - /// Execute a GraphQL mutation. - 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', - - }; - - 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'; - - final Map apiParams = { - - 'query': query, - - }; - - final Map apiHeaders = { - 'x-sdk-graphql': 'true', -'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } -} \ No newline at end of file + Graphql(super.client); + + /// Execute a GraphQL mutation. + 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', + }; + + 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'; + + final Map apiParams = {'query': query}; + + final Map apiHeaders = { + 'x-sdk-graphql': 'true', + 'content-type': 'application/json', + }; + + 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 3bfeba6b..5250c91d 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -3,459 +3,434 @@ part of '../dart_appwrite.dart'; /// 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'; + /// Check the Appwrite HTTP server is up and responsive. + 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); + 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'; - /// Check the Appwrite Antivirus server is up and connection is successful. - 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); + } - 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'; - } + final Map apiParams = {}; - /// Check the Appwrite in-memory cache servers are up and connection is - /// successful. - Future getCache() async { - final String apiPath = '/health/cache'; + final Map apiHeaders = {}; - final Map apiParams = { - - - }; + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - final Map apiHeaders = { - - }; + return models.HealthStatus.fromMap(res.data); + } - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// Get the SSL certificate for a domain + Future getCertificate({String? domain}) async { + final String apiPath = '/health/certificate'; - return models.HealthStatus.fromMap(res.data); + final Map apiParams = {'domain': domain}; - } + final Map apiHeaders = {}; - /// Get the SSL certificate for a domain - Future getCertificate({String? domain}) async { - final String apiPath = '/health/certificate'; + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - final Map apiParams = { - 'domain': domain, + return models.HealthCertificate.fromMap(res.data); + } - - }; + /// Check the Appwrite database servers are up and connection is successful. + Future getDB() async { + final String apiPath = '/health/db'; - final Map apiHeaders = { - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {}; - return models.HealthCertificate.fromMap(res.data); + 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'; + /// Check the Appwrite pub-sub servers are up and connection is successful. + 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.HealthStatus.fromMap(res.data); + return models.HealthStatus.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'; - /// Check the Appwrite pub-sub servers are up and connection is successful. - Future getPubSub() async { - final String apiPath = '/health/pubsub'; + final Map apiParams = {'threshold': threshold}; - 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.HealthQueue.fromMap(res.data); + } - return models.HealthStatus.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'; - } + final Map apiParams = {'threshold': threshold}; - /// 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'; + final Map apiHeaders = {}; - final Map apiParams = { - 'threshold': threshold, + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - - }; + return models.HealthQueue.fromMap(res.data); + } - final Map apiHeaders = { - - }; + /// 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'; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiParams = { + 'name': name, + 'threshold': threshold, + }; - return models.HealthQueue.fromMap(res.data); + final Map apiHeaders = {}; - } + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - /// 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'; + return models.HealthQueue.fromMap(res.data); + } - final Map apiParams = { - 'threshold': threshold, + /// 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'; + + final Map apiParams = {'threshold': threshold}; + + final Map 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, + ); - - }; + final Map apiParams = {'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'; - return models.HealthQueue.fromMap(res.data); + final Map apiParams = {'threshold': threshold}; - } + final Map apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - /// 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'; + return models.HealthQueue.fromMap(res.data); + } - final Map apiParams = { - 'name': name, -'threshold': threshold, + /// 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'; - - }; + final Map apiParams = {'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); + 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'; - /// 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'; + final Map apiParams = {'threshold': threshold}; - final Map apiParams = { - 'threshold': threshold, + final Map apiHeaders = {}; - - }; + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - final Map apiHeaders = { - - }; + return models.HealthQueue.fromMap(res.data); + } - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// 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'; - return models.HealthQueue.fromMap(res.data); + final Map apiParams = {'threshold': threshold}; - } + final Map apiHeaders = {}; - /// 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); + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - final Map apiParams = { - 'threshold': threshold, + 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'; - final Map apiHeaders = { - - }; + final Map apiParams = {'threshold': threshold}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {}; - return models.HealthQueue.fromMap(res.data); + 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'; + /// 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'; - final Map apiParams = { - 'threshold': threshold, + final Map apiParams = {'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); + } - 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'; - } + final Map apiParams = {'threshold': threshold}; - /// 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'; + final Map apiHeaders = {}; - final Map apiParams = { - 'threshold': threshold, + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - - }; + return models.HealthQueue.fromMap(res.data); + } - final Map apiHeaders = { - - }; + /// 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'; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiParams = {'threshold': threshold}; - return models.HealthQueue.fromMap(res.data); + final Map apiHeaders = {}; - } + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - /// 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'; + return models.HealthQueue.fromMap(res.data); + } - final Map apiParams = { - 'threshold': threshold, + /// Check the Appwrite storage device is up and connection is successful. + Future getStorage() async { + final String apiPath = '/health/storage'; - - }; + 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.HealthQueue.fromMap(res.data); + 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'; - /// 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'; + final Map apiParams = {}; - final Map apiParams = { - 'threshold': threshold, + final Map apiHeaders = {}; - - }; + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - final Map apiHeaders = { - - }; + return models.HealthStatus.fromMap(res.data); + } - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// Check the Appwrite server time is synced with Google remote NTP server. We + /// use this technology to smoothly handle leap seconds with no disruptive + /// events. The [Network Time + /// Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + /// 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'; - return models.HealthQueue.fromMap(res.data); + final Map apiParams = {}; - } + final Map apiHeaders = {}; - /// 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'; + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - final Map apiParams = { - 'threshold': threshold, - - - }; - - final Map 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'; - - final Map apiParams = { - 'threshold': threshold, - - - }; - - final Map 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'; - - final Map apiParams = { - 'threshold': threshold, - - - }; - - final Map 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'; - - final Map apiParams = { - 'threshold': threshold, - - - }; - - final Map 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'; - - final Map apiParams = { - - - }; - - final Map 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'; - - final Map apiParams = { - - - }; - - final Map 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 - /// events. The [Network Time - /// Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is - /// 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'; - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return models.HealthTime.fromMap(res.data); - - } -} \ No newline at end of file + return models.HealthTime.fromMap(res.data); + } +} diff --git a/lib/services/locale.dart b/lib/services/locale.dart index b75b4711..4d3cc3e0 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -3,170 +3,162 @@ part of '../dart_appwrite.dart'; /// 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'; + /// 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'; - 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); + 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'; - /// 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'; + 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); + } - 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'; - } + final Map apiParams = {}; - /// 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'; + final Map apiHeaders = {}; - final Map apiParams = { - - - }; + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - final Map apiHeaders = { - - }; + return models.ContinentList.fromMap(res.data); + } - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// 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'; - return models.ContinentList.fromMap(res.data); + final Map apiParams = {}; - } + final Map apiHeaders = {}; - /// 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'; + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - final Map apiParams = { - - - }; + return models.CountryList.fromMap(res.data); + } - final Map apiHeaders = { - - }; + /// 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'; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiParams = {}; - return models.CountryList.fromMap(res.data); + final Map apiHeaders = {}; - } + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - /// 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'; + return models.CountryList.fromMap(res.data); + } - final Map apiParams = { - - - }; + /// 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'; - final Map apiHeaders = { - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {}; - return models.CountryList.fromMap(res.data); + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } + return models.PhoneList.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'; + /// 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'; - 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); + 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'; - /// 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'; + 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'; - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return models.LanguageList.fromMap(res.data); - - } -} \ No newline at end of file + return models.LanguageList.fromMap(res.data); + } +} diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 710bb6d4..afe3ee86 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -3,1158 +3,1476 @@ part of '../dart_appwrite.dart'; /// The Messaging service allows you to send messages to any provider type /// (SMTP, push notification, SMS, etc.). class Messaging extends Service { - Messaging(super.client); - - /// Get a list of all messages from the current Appwrite project. - Future listMessages({List? queries, String? search}) async { - final String apiPath = '/messaging/messages'; - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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'; - - final Map apiParams = { - - 'messageId': messageId, -'subject': subject, -'content': content, -'topics': topics, -'users': users, -'targets': targets, -'cc': cc, -'bcc': bcc, -'attachments': attachments, -'draft': draft, -'html': html, -'scheduledAt': scheduledAt, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'messageId': messageId, -'title': title, -'body': body, -'topics': topics, -'users': users, -'targets': targets, -'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.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); - - 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, 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'; - - final Map apiParams = { - - 'messageId': messageId, -'content': content, -'topics': topics, -'users': users, -'targets': targets, -'draft': draft, -'scheduledAt': scheduledAt, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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. - /// - 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - 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 the message activity logs listed by its unique ID. - Future listMessageLogs({required String messageId, List? queries}) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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}) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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}) async { - final String apiPath = '/messaging/providers'; - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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. - 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, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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. - 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 = { - - 'name': name, -'enabled': enabled, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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. - 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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. - 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 = { - - 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'providerId': providerId, -'name': name, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - 'name': name, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'enabled': enabled, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'providerId': providerId, -'name': name, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'providerId': providerId, -'name': name, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, 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'; - - final Map apiParams = { - - 'providerId': providerId, -'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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. - 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 = { - - 'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'providerId': providerId, -'name': name, -'from': from, -'customerId': customerId, -'apiKey': apiKey, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, -'customerId': customerId, -'apiKey': apiKey, -'from': from, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'providerId': providerId, -'name': name, -'from': from, -'username': username, -'apiKey': apiKey, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, -'username': username, -'apiKey': apiKey, -'from': from, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'providerId': providerId, -'name': name, -'from': from, -'accountSid': accountSid, -'authToken': authToken, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, -'accountSid': accountSid, -'authToken': authToken, -'from': from, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'providerId': providerId, -'name': name, -'from': from, -'apiKey': apiKey, -'apiSecret': apiSecret, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'apiSecret': apiSecret, -'from': from, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - 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 the provider activity logs listed by its unique ID. - Future listProviderLogs({required String providerId, List? queries}) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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}) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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}) async { - final String apiPath = '/messaging/topics'; - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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'; - - final Map apiParams = { - - 'topicId': topicId, -'name': name, -'subscribe': subscribe, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - final Map apiParams = { - - 'name': name, -'subscribe': subscribe, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - 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 the topic activity logs listed by its unique ID. - Future listTopicLogs({required String topicId, List? queries}) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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); - - final Map apiParams = { - - 'subscriberId': subscriberId, -'targetId': targetId, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - 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; - - } -} \ No newline at end of file + Messaging(super.client); + + /// Get a list of all messages from the current Appwrite project. + Future listMessages({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/messages'; + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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'; + + final Map apiParams = { + 'messageId': messageId, + 'subject': subject, + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'cc': cc, + 'bcc': bcc, + 'attachments': attachments, + 'draft': draft, + 'html': html, + 'scheduledAt': scheduledAt, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + ); + + 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, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'messageId': messageId, + 'title': title, + 'body': body, + 'topics': topics, + 'users': users, + 'targets': targets, + '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.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, + ); + + 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, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.patch, + 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'; + + final Map apiParams = { + 'messageId': messageId, + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'draft': draft, + 'scheduledAt': scheduledAt, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. + /// + 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, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + ); + + final Map apiParams = {}; + + final Map 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, + ); + + 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 the message activity logs listed by its unique ID. + Future listMessageLogs({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, + }) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, + }) async { + final String apiPath = '/messaging/providers'; + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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. + 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, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. + 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 = { + 'name': name, + 'enabled': enabled, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. + 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, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. + 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 = { + 'name': name, + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'providerId': providerId, + 'name': name, + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + 'name': name, + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'enabled': enabled, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'providerId': providerId, + 'name': name, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + ); + + final Map apiParams = { + 'name': name, + 'enabled': enabled, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'providerId': providerId, + 'name': name, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + 'name': name, + 'enabled': enabled, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.patch, + 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'; + + final Map apiParams = { + 'providerId': providerId, + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. + 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 = { + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'providerId': providerId, + 'name': name, + 'from': from, + 'customerId': customerId, + 'apiKey': apiKey, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + 'name': name, + 'enabled': enabled, + 'customerId': customerId, + 'apiKey': apiKey, + 'from': from, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'providerId': providerId, + 'name': name, + 'from': from, + 'username': username, + 'apiKey': apiKey, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + 'name': name, + 'enabled': enabled, + 'username': username, + 'apiKey': apiKey, + 'from': from, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'providerId': providerId, + 'name': name, + 'from': from, + 'accountSid': accountSid, + 'authToken': authToken, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + 'name': name, + 'enabled': enabled, + 'accountSid': accountSid, + 'authToken': authToken, + 'from': from, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'providerId': providerId, + 'name': name, + 'from': from, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + 'name': name, + 'enabled': enabled, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'from': from, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + ); + + final Map apiParams = {}; + + final Map 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, + ); + + 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 the provider activity logs listed by its unique ID. + Future listProviderLogs({ + required String providerId, + List? queries, + }) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( + '{providerId}', + providerId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, + }) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs' + .replaceAll('{subscriberId}', subscriberId); + + final Map apiParams = {'queries': queries}; + + final Map 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, + }) async { + final String apiPath = '/messaging/topics'; + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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'; + + final Map apiParams = { + 'topicId': topicId, + 'name': name, + 'subscribe': subscribe, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + ); + + final Map apiParams = {}; + + final Map 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, + ); + + final Map apiParams = { + 'name': name, + 'subscribe': subscribe, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + ); + + 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 the topic activity logs listed by its unique ID. + Future listTopicLogs({ + required String topicId, + List? queries, + }) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( + '{topicId}', + topicId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, + }) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( + '{topicId}', + topicId, + ); + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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, + ); + + final Map apiParams = { + 'subscriberId': subscriberId, + 'targetId': targetId, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = {}; + + final Map 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); + + 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/sites.dart b/lib/services/sites.dart index 90511473..d89f2192 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -2,585 +2,703 @@ part of '../dart_appwrite.dart'; /// The Sites Service allows you view, create and manage your web applications. class Sites extends Service { - 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}) async { - final String apiPath = '/sites'; - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { - final String apiPath = '/sites'; - - final Map apiParams = { - - 'siteId': siteId, -'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime.value, -'adapter': adapter?.value, -'installationId': installationId, -'fallbackFile': fallbackFile, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - - }; - - final Map 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'; - - final Map apiParams = { - - - }; - - final Map 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); - - final Map apiParams = { - - - }; - - final Map 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { - final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - - 'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime?.value, -'adapter': adapter?.value, -'fallbackFile': fallbackFile, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - 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 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); - - 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); - - 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}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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 function's deployment to use your new deployment ID. - Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - - 'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'code': code, -'activate': activate, - - }; - - final Map apiHeaders = { - 'content-type': 'multipart/form-data', - - }; - - String idParamName = ''; - final paramName = 'code'; - final res = await client.chunkedUpload( - path: apiPath, - params: apiParams, - paramName: paramName, - idParamName: idParamName, - headers: apiHeaders, - onProgress: onProgress, - ); - - 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); - - 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); - - return models.Deployment.fromMap(res.data); - - } - - /// Create a deployment based on a template. - /// - /// Use this endpoint with combination of - /// [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to - /// find the template details. - Future createTemplateDeployment({required String siteId, required String repository, required String owner, required String rootDirectory, required String version, bool? activate}) async { - final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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.VCSDeploymentType 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, -'activate': activate, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - 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 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); - - final Map params = { - '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); - 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); - - 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.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}) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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); - - final Map apiParams = { - - - }; - - final Map 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); - - 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 variables of a specific site. - Future listVariables({required String siteId}) async { - final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - - - }; - - 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); - - final Map apiParams = { - - 'key': key, -'value': value, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - final Map apiParams = { - - 'key': key, -'value': value, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - 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; - - } -} \ No newline at end of file + 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}) async { + final String apiPath = '/sites'; + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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? outputDirectory, + enums.Adapter? adapter, + String? installationId, + String? fallbackFile, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites'; + + final Map apiParams = { + 'siteId': siteId, + 'name': name, + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime.value, + 'adapter': adapter?.value, + 'installationId': installationId, + 'fallbackFile': fallbackFile, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = {}; + + final Map 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'; + + final Map apiParams = {}; + + final Map 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); + + final Map apiParams = {}; + + final Map 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? outputDirectory, + enums.BuildRuntime? buildRuntime, + enums.Adapter? adapter, + String? fallbackFile, + String? installationId, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); + + final Map apiParams = { + 'name': name, + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime?.value, + 'adapter': adapter?.value, + 'fallbackFile': fallbackFile, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + 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 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, + ); + + 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, + ); + + 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, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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 function's deployment to use your new deployment ID. + Future createDeployment({ + required String siteId, + required InputFile code, + required bool activate, + String? installCommand, + String? buildCommand, + String? outputDirectory, + Function(UploadProgress)? onProgress, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); + + final Map apiParams = { + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'code': code, + 'activate': activate, + }; + + final Map apiHeaders = { + 'content-type': 'multipart/form-data', + }; + + String idParamName = ''; + final paramName = 'code'; + final res = await client.chunkedUpload( + path: apiPath, + params: apiParams, + paramName: paramName, + idParamName: idParamName, + headers: apiHeaders, + onProgress: onProgress, + ); + + 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, + ); + + 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, + ); + + return models.Deployment.fromMap(res.data); + } + + /// Create a deployment based on a template. + /// + /// Use this endpoint with combination of + /// [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to + /// find the template details. + Future createTemplateDeployment({ + required String siteId, + required String repository, + required String owner, + required String rootDirectory, + required String version, + bool? activate, + }) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll( + '{siteId}', + siteId, + ); + + final Map apiParams = { + 'repository': repository, + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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.VCSDeploymentType 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, + 'activate': activate, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = {}; + + final Map 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); + + 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 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); + + final Map params = { + '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, + ); + 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); + + 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.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, + }) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll( + '{siteId}', + siteId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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); + + final Map apiParams = {}; + + final Map 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); + + 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 variables of a specific site. + Future listVariables({required String siteId}) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll( + '{siteId}', + siteId, + ); + + final Map apiParams = {}; + + 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, + ); + + final Map apiParams = { + 'key': key, + 'value': value, + 'secret': secret, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = {}; + + final Map 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); + + final Map apiParams = { + 'key': key, + 'value': value, + 'secret': secret, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + 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/storage.dart b/lib/services/storage.dart index 9165e91b..ee630883 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -2,329 +2,421 @@ part of '../dart_appwrite.dart'; /// The Storage service allows you to manage your project files. class Storage extends Service { - 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}) async { - final String apiPath = '/storage/buckets'; - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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}) async { - final String apiPath = '/storage/buckets'; - - final Map apiParams = { - - 'bucketId': bucketId, -'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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}) async { - final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); - - final Map apiParams = { - - 'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - 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 the user files. You can use the query params to filter - /// your results. - Future listFiles({required String bucketId, List? queries, String? search}) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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); - - final Map apiParams = { - - 'fileId': fileId, -'file': file, -'permissions': permissions, - - }; - - final Map apiHeaders = { - 'content-type': 'multipart/form-data', - - }; - - String idParamName = ''; - idParamName = 'fileId'; - final paramName = 'file'; - final res = await client.chunkedUpload( - path: apiPath, - params: apiParams, - paramName: paramName, - idParamName: idParamName, - headers: apiHeaders, - onProgress: onProgress, - ); - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - final Map apiParams = { - - 'name': name, -'permissions': permissions, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - 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 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); - - final Map params = { - 'token': token, - - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - 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); - - final Map params = { - 'width': width, -'height': height, -'gravity': gravity?.value, -'quality': quality, -'borderWidth': borderWidth, -'borderColor': borderColor, -'borderRadius': borderRadius, -'opacity': opacity, -'rotation': rotation, -'background': background, -'output': output?.value, -'token': token, - - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - 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); - - final Map params = { - 'token': token, - - - 'project': client.config['project'], - 'session': client.config['session'], - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); - return res.data; - } -} \ No newline at end of file + 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, + }) async { + final String apiPath = '/storage/buckets'; + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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, + }) async { + final String apiPath = '/storage/buckets'; + + final Map apiParams = { + 'bucketId': bucketId, + 'name': name, + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + ); + + final Map apiParams = {}; + + final Map 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, + }) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); + + final Map apiParams = { + 'name': name, + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + ); + + 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 the user files. You can use the query params to filter + /// your results. + Future listFiles({ + required String bucketId, + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( + '{bucketId}', + bucketId, + ); + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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, + ); + + final Map apiParams = { + 'fileId': fileId, + 'file': file, + 'permissions': permissions, + }; + + final Map apiHeaders = { + 'content-type': 'multipart/form-data', + }; + + String idParamName = ''; + idParamName = 'fileId'; + final paramName = 'file'; + final res = await client.chunkedUpload( + path: apiPath, + params: apiParams, + paramName: paramName, + idParamName: idParamName, + headers: apiHeaders, + onProgress: onProgress, + ); + + 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); + + final Map apiParams = {}; + + final Map 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); + + final Map apiParams = { + 'name': name, + 'permissions': permissions, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + 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 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); + + final Map params = { + 'token': token, + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + 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); + + final Map params = { + 'width': width, + 'height': height, + 'gravity': gravity?.value, + 'quality': quality, + 'borderWidth': borderWidth, + 'borderColor': borderColor, + 'borderRadius': borderRadius, + 'opacity': opacity, + 'rotation': rotation, + 'background': background, + 'output': output?.value, + 'token': token, + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + 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); + + final Map params = { + 'token': token, + + 'project': client.config['project'], + 'session': client.config['session'], + }; + + 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 05780266..a6760c13 100644 --- a/lib/services/tables-db.dart +++ b/lib/services/tables-db.dart @@ -1,1163 +1,1522 @@ part of '../dart_appwrite.dart'; class TablesDb extends Service { - 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}) async { - final String apiPath = '/tablesdb'; - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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, enums.Type? type}) async { - final String apiPath = '/tablesdb'; - - final Map apiParams = { - - 'databaseId': databaseId, -'name': name, -'enabled': enabled, -'type': type?.value, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); - - return models.Database.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); - - final Map apiParams = { - - - }; - - final Map 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, required String name, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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/server/databases#databasesCreateTable) - /// API or directly from your database console. - Future createTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'tableId': tableId, -'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - 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; - - } - - /// List columns in the table. - Future listColumns({required String databaseId, required String tableId, List? queries}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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); - - final Map apiParams = { - - 'key': key, -'required': xrequired, -'default': xdefault, -'array': array, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - '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); - - 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); - - final Map apiParams = { - - 'key': key, -'required': xrequired, -'default': xdefault, -'array': array, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - '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); - - 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); - - final Map apiParams = { - - 'key': key, -'required': xrequired, -'default': xdefault, -'array': array, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - '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); - - 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); - - final Map apiParams = { - - 'key': key, -'elements': elements, -'required': xrequired, -'default': xdefault, -'array': array, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - 'elements': elements, -'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); - - 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); - - final Map apiParams = { - - 'key': key, -'required': xrequired, -'min': min, -'max': max, -'default': xdefault, -'array': array, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - 'required': xrequired, -'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.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); - - final Map apiParams = { - - 'key': key, -'required': xrequired, -'min': min, -'max': max, -'default': xdefault, -'array': array, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - 'required': xrequired, -'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.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); - - final Map apiParams = { - - 'key': key, -'required': xrequired, -'default': xdefault, -'array': array, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - '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); - - return models.ColumnIp.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); - - final Map apiParams = { - - 'relatedTableId': relatedTableId, -'type': type.value, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); - - return models.ColumnRelationship.fromMap(res.data); - - } - - /// Create a string column. - /// - 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, -'array': array, -'encrypt': encrypt, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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. - /// - 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - - return models.ColumnString.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); - - final Map apiParams = { - - 'key': key, -'required': xrequired, -'default': xdefault, -'array': array, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - '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); - - return models.ColumnUrl.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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } - - /// 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); - - 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 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); - - final Map apiParams = { - - 'onDelete': onDelete?.value, -'newKey': newKey, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - - return models.ColumnRelationship.fromMap(res.data); - - } - - /// List indexes in the collection. - Future listIndexes({required String databaseId, required String tableId, List? queries}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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. - /// Attributes can be `key`, `fulltext`, and `unique`. - Future createIndex({required String databaseId, required String tableId, required String key, required enums.IndexType 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, -'orders': orders, -'lengths': lengths, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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/server/databases#databasesCreateTable) - /// API or directly from your database console. - Future createRow({required String databaseId, required String tableId, required String rowId, required Map data, List? permissions}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rowId': rowId, -'data': data, -'permissions': permissions, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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/server/databases#databasesCreateTable) - /// API or directly from your database console. - Future createRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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/server/databases#databasesCreateTable) - /// API or directly from your database console. - /// - Future upsertRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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/server/databases#databasesCreateTable) - /// API or directly from your database console. - Future upsertRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - final Map apiParams = { - - 'data': data, -'permissions': permissions, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - final Map apiParams = { - - 'data': data, -'permissions': permissions, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - 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; - - } - - /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - - return models.Row.fromMap(res.data); - - } -} \ No newline at end of file + 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, + }) async { + final String apiPath = '/tablesdb'; + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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, + enums.Type? type, + }) async { + final String apiPath = '/tablesdb'; + + final Map apiParams = { + 'databaseId': databaseId, + 'name': name, + 'enabled': enabled, + 'type': type?.value, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.post, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return models.Database.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, + ); + + final Map apiParams = {}; + + final Map 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, + required String name, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + ); + + 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 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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/server/databases#databasesCreateTable) + /// API or directly from your database console. + Future createTable({ + required String databaseId, + required String tableId, + required String name, + List? permissions, + bool? rowSecurity, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = { + 'tableId': tableId, + 'name': name, + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = {}; + + final Map 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, + required String name, + List? permissions, + bool? rowSecurity, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'name': name, + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + 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; + } + + /// List columns in the table. + Future listColumns({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + + final Map apiParams = { + 'key': key, + 'required': xrequired, + 'default': xdefault, + 'array': array, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + '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, + ); + + 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); + + final Map apiParams = { + 'key': key, + 'required': xrequired, + 'default': xdefault, + 'array': array, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + '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, + ); + + 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); + + final Map apiParams = { + 'key': key, + 'required': xrequired, + 'default': xdefault, + 'array': array, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + '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, + ); + + 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); + + final Map apiParams = { + 'key': key, + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + 'elements': elements, + '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, + ); + + 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); + + final Map apiParams = { + 'key': key, + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + 'required': xrequired, + '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.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); + + final Map apiParams = { + 'key': key, + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + 'required': xrequired, + '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.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); + + final Map apiParams = { + 'key': key, + 'required': xrequired, + 'default': xdefault, + 'array': array, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + '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, + ); + + return models.ColumnIp.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); + + final Map apiParams = { + 'relatedTableId': relatedTableId, + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.post, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return models.ColumnRelationship.fromMap(res.data); + } + + /// Create a string column. + /// + 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, + 'array': array, + 'encrypt': encrypt, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. + /// + 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, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.patch, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return models.ColumnString.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); + + final Map apiParams = { + 'key': key, + 'required': xrequired, + 'default': xdefault, + 'array': array, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = { + '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, + ); + + return models.ColumnUrl.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); + + final Map apiParams = {}; + + final Map apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } + + /// 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); + + 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 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); + + final Map apiParams = { + 'onDelete': onDelete?.value, + 'newKey': newKey, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.patch, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return models.ColumnRelationship.fromMap(res.data); + } + + /// List indexes in the collection. + Future listIndexes({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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. + /// Attributes can be `key`, `fulltext`, and `unique`. + Future createIndex({ + required String databaseId, + required String tableId, + required String key, + required enums.IndexType 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, + 'orders': orders, + 'lengths': lengths, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = {}; + + final Map 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); + + 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 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/databases#databasesCreateTable) + /// API or directly from your database console. + Future createRow({ + required String databaseId, + required String tableId, + required String rowId, + required Map data, + List? permissions, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'rowId': rowId, + 'data': data, + 'permissions': permissions, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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/server/databases#databasesCreateTable) + /// API or directly from your database console. + Future createRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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/server/databases#databasesCreateTable) + /// API or directly from your database console. + /// + Future upsertRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/databases#databasesCreateTable) + /// API or directly from your database console. + Future upsertRow({ + required String databaseId, + required String tableId, + required String rowId, + Map? data, + List? permissions, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + final Map apiParams = { + 'data': data, + 'permissions': permissions, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + final Map apiParams = { + 'data': data, + 'permissions': permissions, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + 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; + } + + /// 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, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 2b492f27..5fd59641 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -3,321 +3,356 @@ 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 class Teams extends Service { - 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}) async { - final String apiPath = '/teams'; - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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'; - - final Map apiParams = { - - 'teamId': teamId, -'name': name, -'roles': roles, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - 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); - - 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); - - 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; - - } - - /// 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}) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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 - /// a Client SDK, Appwrite will send an email or sms with a link to join the - /// 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. - /// - /// 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); - - final Map apiParams = { - - 'email': email, -'userId': userId, -'phone': phone, -'roles': roles, -'url': url, -'name': name, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - 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); - - 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); - - 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; - - } - - /// 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); - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - 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); - - return models.Preferences.fromMap(res.data); - - } -} \ No newline at end of file + 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}) async { + final String apiPath = '/teams'; + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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'; + + final Map apiParams = { + 'teamId': teamId, + 'name': name, + 'roles': roles, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = {}; + + final Map 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); + + 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, + ); + + 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); + + 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; + } + + /// 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, + }) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll( + '{teamId}', + teamId, + ); + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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 + /// a Client SDK, Appwrite will send an email or sms with a link to join the + /// 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. + /// + /// 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, + ); + + final Map apiParams = { + 'email': email, + 'userId': userId, + 'phone': phone, + 'roles': roles, + 'url': url, + 'name': name, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = {}; + + final Map 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); + + 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, + ); + + 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); + + 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; + } + + /// 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); + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + ); + + final Map apiParams = {}; + + final Map 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, + ); + + 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, + ); + + return models.Preferences.fromMap(res.data); + } +} diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index 366d7135..4e6915dc 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,109 +1,113 @@ part of '../dart_appwrite.dart'; class Tokens extends Service { - 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}) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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); - - 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); - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - 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); - - 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); - - 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; - - } -} \ No newline at end of file + 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, + }) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + + 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, + ); + + 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); + + final Map apiParams = {}; + + final Map 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); + + 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, + ); + + 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); + + 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/users.dart b/lib/services/users.dart index 765ec3e6..c98182b7 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -2,962 +2,1107 @@ part of '../dart_appwrite.dart'; /// The Users service allows you to manage your project users. class Users extends Service { - 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}) async { - final String apiPath = '/users'; - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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'; - - final Map apiParams = { - - 'userId': userId, -'email': email, -'phone': phone, -'password': password, -'name': name, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'userId': userId, -'email': email, -'password': password, -'name': name, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'userId': userId, -'email': email, -'password': password, -'name': name, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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}) async { - final String apiPath = '/users/identities'; - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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); - - 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; - - } - - /// 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'; - - final Map apiParams = { - - 'userId': userId, -'email': email, -'password': password, -'name': name, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'userId': userId, -'email': email, -'password': password, -'name': name, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'userId': userId, -'email': email, -'password': password, -'passwordSalt': passwordSalt, -'passwordCpu': passwordCpu, -'passwordMemory': passwordMemory, -'passwordParallel': passwordParallel, -'passwordLength': passwordLength, -'name': name, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'userId': userId, -'email': email, -'password': password, -'passwordSalt': passwordSalt, -'passwordSaltSeparator': passwordSaltSeparator, -'passwordSignerKey': passwordSignerKey, -'name': name, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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'; - - final Map apiParams = { - - 'userId': userId, -'email': email, -'password': password, -'passwordVersion': passwordVersion?.value, -'name': name, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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 - /// storage files should be deleted before user deletion. If you want to keep - /// ID reserved, use the - /// [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) - /// endpoint instead. - Future delete({required String userId}) async { - final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); - - 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 user email by its unique ID. - 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); - - 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); - - final Map apiParams = { - - 'sessionId': sessionId, -'duration': duration, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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. - /// - /// 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); - - 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.User.fromMap(res.data); - - } - - /// Get the user activity logs list by its unique ID. - Future listLogs({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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}) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, -'search': search, - - - }; - - final Map 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. - 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); - - return models.User.fromMap(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); - - 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; - - } - - /// 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); - - final Map apiParams = { - - - }; - - final Map 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. - Future getMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; - - final Map 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. - Future updateMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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. - Future createMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - 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.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); - - 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); - - 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); - - 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); - - 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); - - 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); - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - 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); - - return models.Preferences.fromMap(res.data); - - } - - /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; - - final Map 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - 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; - - } - - /// 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); - - 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 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); - - 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); - - return models.User.fromMap(res.data); - - } - - /// List the messaging targets that are associated with a user. - Future listTargets({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map 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); - - final Map apiParams = { - - 'targetId': targetId, -'providerType': providerType.value, -'identifier': identifier, -'providerId': providerId, -'name': name, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - final Map apiParams = { - - - }; - - final Map 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); - - final Map apiParams = { - - 'identifier': identifier, -'providerId': providerId, -'name': name, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - 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; - - } - - /// 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); - - final Map apiParams = { - - 'length': length, -'expire': expire, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - 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); - - 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); - - 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); - - 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); - - return models.User.fromMap(res.data); - - } -} \ No newline at end of file + 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}) async { + final String apiPath = '/users'; + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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'; + + final Map apiParams = { + 'userId': userId, + 'email': email, + 'phone': phone, + 'password': password, + 'name': name, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'userId': userId, + 'email': email, + 'password': password, + 'name': name, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'userId': userId, + 'email': email, + 'password': password, + 'name': name, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + }) async { + final String apiPath = '/users/identities'; + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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, + ); + + 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; + } + + /// 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'; + + final Map apiParams = { + 'userId': userId, + 'email': email, + 'password': password, + 'name': name, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'userId': userId, + 'email': email, + 'password': password, + 'name': name, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'userId': userId, + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordCpu': passwordCpu, + 'passwordMemory': passwordMemory, + 'passwordParallel': passwordParallel, + 'passwordLength': passwordLength, + 'name': name, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'userId': userId, + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordSaltSeparator': passwordSaltSeparator, + 'passwordSignerKey': passwordSignerKey, + 'name': name, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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'; + + final Map apiParams = { + 'userId': userId, + 'email': email, + 'password': password, + 'passwordVersion': passwordVersion?.value, + 'name': name, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = {}; + + final Map 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 + /// storage files should be deleted before user deletion. If you want to keep + /// ID reserved, use the + /// [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) + /// endpoint instead. + Future delete({required String userId}) async { + final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); + + 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 user email by its unique ID. + 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, + ); + + 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, + ); + + final Map apiParams = { + 'sessionId': sessionId, + 'duration': duration, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. + /// + /// 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, + ); + + 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.User.fromMap(res.data); + } + + /// Get the user activity logs list by its unique ID. + Future listLogs({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/logs'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, + }) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = { + 'queries': queries, + 'search': search, + }; + + final Map 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. + 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, + ); + + return models.User.fromMap(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); + + 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; + } + + /// 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, + ); + + final Map apiParams = {}; + + final Map 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. + Future getMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {}; + + final Map 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. + Future updateMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. + Future createMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); + + 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.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, + ); + + 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, + ); + + 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, + ); + + 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, + ); + + 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, + ); + + 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, + ); + + 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, + ); + + final Map apiParams = {}; + + final Map 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, + ); + + 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, + ); + + return models.Preferences.fromMap(res.data); + } + + /// Get the user sessions list by its unique ID. + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {}; + + final Map 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, + ); + + final Map apiParams = {}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + ); + + 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; + } + + /// 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); + + 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 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, + ); + + 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, + ); + + return models.User.fromMap(res.data); + } + + /// List the messaging targets that are associated with a user. + Future listTargets({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/targets'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, + ); + + final Map apiParams = { + 'targetId': targetId, + 'providerType': providerType.value, + 'identifier': identifier, + 'providerId': providerId, + 'name': name, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + final Map apiParams = {}; + + final Map 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); + + final Map apiParams = { + 'identifier': identifier, + 'providerId': providerId, + 'name': name, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); + + 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; + } + + /// 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, + ); + + final Map apiParams = {'length': length, 'expire': expire}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + ); + + 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, + ); + + 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, + ); + + 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, + ); + + return models.User.fromMap(res.data); + } +} diff --git a/lib/src/client.dart b/lib/src/client.dart index 2fc990a5..d82d623a 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -8,7 +8,7 @@ import 'upload_progress.dart'; /// [Client] that handles requests to Appwrite abstract class Client { /// The size for cunked uploads in bytes. - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; /// Holds configuration such as project. late Map config; @@ -18,16 +18,16 @@ abstract class Client { String get endPoint => _endPoint; /// Initializes a [Client]. - factory Client( - {String endPoint = 'https://cloud.appwrite.io/v1', - bool selfSigned = false}) => - createClient(endPoint: endPoint, selfSigned: selfSigned); + factory Client({ + String endPoint = 'https://cloud.appwrite.io/v1', + bool selfSigned = false, + }) => 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. @@ -81,7 +81,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 cd82d264..08d93b85 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,21 +2,25 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index ea2cd62a..c961873f 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,14 +9,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => +ClientBase createClient({required String endPoint, required bool selfSigned}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -34,59 +31,66 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format' : '1.8.0', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -135,7 +139,11 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -162,12 +170,19 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index f9e695bf..2bd7d639 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,17 +10,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => - ClientIO( - endPoint: endPoint, - selfSigned: selfSigned, - ); +ClientBase createClient({required String endPoint, required bool selfSigned}) => + ClientIO(endPoint: endPoint, selfSigned: selfSigned); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -43,60 +37,68 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format' : '1.8.0', + 'user-agent': + 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -151,11 +153,16 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, file.path!, - filename: file.filename); + paramName, + file.path!, + filename: file.filename, + ); } else { - 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, @@ -194,12 +201,19 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -244,10 +258,7 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse( - res, - responseType: responseType, - ); + return prepareResponse(res, responseType: responseType); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 658b79b6..06c9ebe3 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest) - .fields - .addAll({"$key[$i]": v.toString()}); + (request as http.MultipartRequest).fields.addAll({ + "$key[$i]": v.toString(), + }); }); } else { - (request as http.MultipartRequest) - .fields - .addAll({key: value.toString()}); + (request as http.MultipartRequest).fields.addAll({ + key: value.toString(), + }); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value){ + params = params.map((key, value) { if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,12 +51,13 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port, + ); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -66,7 +67,9 @@ 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); @@ -113,18 +116,25 @@ 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/client_stub.dart b/lib/src/client_stub.dart index 95e9d217..2cb7727e 100644 --- a/lib/src/client_stub.dart +++ b/lib/src/client_stub.dart @@ -3,4 +3,5 @@ import 'client_base.dart'; /// Implemented in `browser_client.dart` and `io_client.dart`. ClientBase createClient({required String endPoint, required bool selfSigned}) => throw UnsupportedError( - 'Cannot create a client without dart:html or dart:io.'); + 'Cannot create a client without dart:html or dart:io.', + ); diff --git a/lib/src/enums.dart b/lib/src/enums.dart index 595afdc2..0f250ea3 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes + bytes, } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 2f198d4e..3341912f 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 cd45b6a1..1bae5c8a 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 7d2d7016..42954430 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,18 +1,16 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 af5ebaad..e20f48c6 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,26 +1,24 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index 8d86530d..b101d35f 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({ - required this.value - }); + const IndexType({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/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/name.dart b/lib/src/enums/name.dart index 613bf5f1..74823feb 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,24 +1,22 @@ 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'), - 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'), + 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 076c1c50..383e45b1 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,52 +1,50 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d34440ec..d4fef930 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/type.dart b/lib/src/enums/type.dart index 1dbb0056..99bbf308 100644 --- a/lib/src/enums/type.dart +++ b/lib/src/enums/type.dart @@ -1,14 +1,12 @@ part of '../../enums.dart'; enum Type { - tablesdb(value: 'tablesdb'), - legacy(value: 'legacy'); + tablesdb(value: 'tablesdb'), + legacy(value: 'legacy'); - const Type({ - required this.value - }); + const Type({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_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index 0bf8e2ad..f01fcb01 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({ - required this.value - }); + const VCSDeploymentType({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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index f174d569..4145f701 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 c9f67200..4e901476 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 2fabb416..35c7b767 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index fdcee07a..7d27adba 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index 120723df..fec6f65a 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 504b5f8f..0e80700f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 5f3e1654..bae6618f 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 20dd7189..0ca54691 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a5b27b4f..1df01f19 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 96ce554b..21f8e9a3 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a4953a0e..298c181a 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 03ba94c7..c6eecadd 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8a5aa89d..1ef48332 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 d17f414a..8c8fcb73 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index 4098a5a1..c5fa6adc 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "attributes": attributes, - }; - } + Map toMap() { + return {"total": total, "attributes": attributes}; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 050cbe14..903c6290 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 2202d255..7374fa78 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index 0c3ddf9e..f0bc295e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index 3bb374be..b8fb5e48 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 29c56fe4..9d5b771b 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Buckets List class BucketList implements Model { - /// Total number of buckets rows that matched your query. - final int total; + /// Total number of buckets rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "buckets": buckets.map((p) => p.toMap()).toList(), - }; - } + 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 c55110cf..72de429d 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 81104b31..b5ff3518 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Collections List class CollectionList implements Model { - /// Total number of collections rows that matched your query. - final int total; + /// Total number of collections rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 0ffc8fea..60fcfa48 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 367686d0..c21a2260 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7deb5e26..15d80695 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7bb56922..558b7d43 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c0547e11..3b2f1335 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 acf0f6df..9d637d92 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 66213f0a..7bea7426 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,28 +2,24 @@ part of '../../models.dart'; /// Column Indexes List class ColumnIndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 3823f425..2ba463cd 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 4ac1fa12..6672d7ce 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 475c1c40..8eb0171f 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "columns": columns, - }; - } + Map toMap() { + return {"total": total, "columns": columns}; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index e55d1534..6221c01e 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6fd6a3b0..7b560989 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 94271aa6..66c0ce7b 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 1a9c5038..7318b7ad 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 60b008ef..651b5ae4 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Continents List class ContinentList implements Model { - /// Total number of continents rows that matched your query. - final int total; + /// Total number of continents rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 565b1d66..c52b50f2 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,28 +2,19 @@ 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()); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 3a3acd49..ea839b51 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Countries List class CountryList implements Model { - /// Total number of countries rows that matched your query. - final int total; + /// Total number of countries rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 deafffe3..27eef0c1 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 34274e00..2ff28c61 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Currencies List class CurrencyList implements Model { - /// Total number of currencies rows that matched your query. - final int total; + /// Total number of currencies rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 cab95b02..8d79e052 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 940a9610..01e092f2 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Databases List class DatabaseList implements Model { - /// Total number of databases rows that matched your query. - final int total; + /// Total number of databases rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 ecf7e791..448c62c7 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 7a2a38c2..1ca87150 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Deployments List class DeploymentList implements Model { - /// Total number of deployments rows that matched your query. - final int total; + /// Total number of deployments rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index be424a9c..cf85e457 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 90bce66f..b897a877 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,31 +2,30 @@ part of '../../models.dart'; /// Documents List class DocumentList implements Model { - /// Total number of documents rows that matched your query. - final int total; + /// Total number of documents rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 0cfdbb4e..8618bcd6 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,118 +2,122 @@ 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 upate date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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.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(), - trigger: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "trigger": trigger, - "status": status, - "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 upate date in ISO 8601 format. + final String $updatedAt; + + /// Execution roles. + final List $permissions; + + /// Function ID. + final String functionId; + + /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + final String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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.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(), + trigger: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "trigger": trigger, + "status": status, + "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 c30098a6..583d9fab 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Executions List class ExecutionList implements Model { - /// Total number of executions rows that matched your query. - final int total; + /// Total number of executions rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 de8439ec..a6a9fa46 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 164a281f..e7ca1bd5 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Files List class FileList implements Model { - /// Total number of files rows that matched your query. - final int total; + /// Total number of files rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "files": files.map((p) => p.toMap()).toList(), - }; - } + 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 ea6b601a..693c9b07 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,46 +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))), - ); - } - - 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)), + ), + ); + } + + 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 7614616a..0b908240 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 bd39632e..5661bec4 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Frameworks List class FrameworkList implements Model { - /// Total number of frameworks rows that matched your query. - final int total; + /// Total number of frameworks rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 64401c3f..56c2eded 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index b40dd517..24b199b1 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,28 +2,25 @@ part of '../../models.dart'; /// Functions List class FunctionList implements Model { - /// Total number of functions rows that matched your query. - final int total; + /// Total number of functions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 ecf0a178..463cf696 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "value": value, - }; - } + Map toMap() { + return {"name": name, "value": value}; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index 54c31e70..fa402e97 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "version": version, - "status": status, - }; - } + Map toMap() { + return {"version": version, "status": status}; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index 0a5b6ce9..d412eba9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 95da1235..5f06906b 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,22 +2,16 @@ 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']); + } - Map toMap() { - return { - "size": size, - }; - } + Map toMap() { + return {"size": size}; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 0d6e7216..59b7092c 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,34 +2,26 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "name": name, - "ping": ping, - "status": status, - }; - } + Map toMap() { + return {"name": name, "ping": ping, "status": status}; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index 102dfe77..dec2d54f 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,34 +2,30 @@ 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'], + ); + } - Map toMap() { - return { - "remoteTime": remoteTime, - "localTime": localTime, - "diff": diff, - }; - } + Map toMap() { + return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index c43c4d57..807bdfd0 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 52fa04a6..51ddb64a 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Identities List class IdentityList implements Model { - /// Total number of identities rows that matched your query. - final int total; + /// Total number of identities rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 b6717c4e..9d6d7aec 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 390e9039..65207b94 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Indexes List class IndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 1b4ff7de..490a1824 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "jwt": jwt, - }; - } + Map toMap() { + return {"jwt": jwt}; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 43eaad08..9c45adb1 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,34 +2,26 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - "nativeName": nativeName, - }; - } + 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 755c4e29..76a3f548 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Languages List class LanguageList implements Model { - /// Total number of languages rows that matched your query. - final int total; + /// Total number of languages rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 b5e9ad1a..084475bf 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 10499ef5..cd5a1155 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "name": name, - }; - } + 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 9e1e6034..5fa5c0ce 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Locale codes list class LocaleCodeList implements Model { - /// Total number of localeCodes rows that matched your query. - final int total; + /// Total number of localeCodes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 cb567bd7..7fb3f364 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 636d9166..4a771585 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Logs List class LogList implements Model { - /// Total number of logs rows that matched your query. - final int total; + /// Total number of logs rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "logs": logs.map((p) => p.toMap()).toList(), - }; - } + 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 26610e46..8ee142ad 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index 566afb17..993f7206 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Memberships List class MembershipList implements Model { - /// Total number of memberships rows that matched your query. - final int total; + /// Total number of memberships rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 c4e9e858..9b93b00d 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index c5082c8e..c577ccc1 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Message list class MessageList implements Model { - /// Total number of messages rows that matched your query. - final int total; + /// Total number of messages rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 46c166fb..96bf3c65 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 d49989d8..c930a23e 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 6c8b4e36..63411988 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,22 +2,18 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "recoveryCodes": recoveryCodes, - }; - } + Map toMap() { + return {"recoveryCodes": recoveryCodes}; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index 01cf0857..fa57cb8b 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "secret": secret, - "uri": uri, - }; - } + Map toMap() { + return {"secret": secret, "uri": uri}; + } } 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/phone.dart b/lib/src/models/phone.dart index c8bbb95b..40f7bcd2 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 a40e3591..497aa36c 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Phones List class PhoneList implements Model { - /// Total number of phones rows that matched your query. - final int total; + /// Total number of phones rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "phones": phones.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index edb6083e..7bc3abc9 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,23 +2,17 @@ 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, - ); - } + factory Preferences.fromMap(Map map) { + return Preferences(data: map); + } - Map toMap() { - return { - "data": data, - }; - } + 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/provider.dart b/lib/src/models/provider.dart index 4295c486..1a762f85 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 c71c810d..6d579bd0 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Provider list class ProviderList implements Model { - /// Total number of providers rows that matched your query. - final int total; + /// Total number of providers rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index ed520cc4..dad35dcc 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 3c2d985f..fcbcbc3a 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,28 +2,24 @@ part of '../../models.dart'; /// Resource Tokens List class ResourceTokenList implements Model { - /// Total number of tokens rows that matched your query. - final int total; + /// Total number of tokens rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "tokens": tokens.map((p) => p.toMap()).toList(), - }; - } + 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 62e69e5b..3700e577 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 42bdbfea..ae3f851d 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,31 +2,25 @@ part of '../../models.dart'; /// Rows List class RowList implements Model { - /// Total number of rows rows that matched your query. - final int total; + /// Total number of rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "rows": rows.map((p) => p.toMap()).toList(), - }; - } + 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 35f82cfa..7c9677d8 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 e574c63c..b93dbb8f 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Runtimes List class RuntimeList implements Model { - /// Total number of runtimes rows that matched your query. - final int total; + /// Total number of runtimes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 3a1d955f..d2fe4f64 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 160cb789..563b04a4 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Sessions List class SessionList implements Model { - /// Total number of sessions rows that matched your query. - final int total; + /// Total number of sessions rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 5cda6acc..1449f8bd 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index 3164546a..eb1a5457 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Sites List class SiteList implements Model { - /// Total number of sites rows that matched your query. - final int total; + /// Total number of sites rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "sites": sites.map((p) => p.toMap()).toList(), - }; - } + 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 e49d399c..e8fb8c75 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,40 +2,35 @@ 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(), + ); + } - Map toMap() { - return { - "memory": memory, - "cpus": cpus, - "enabled": enabled, - "slug": slug, - }; - } + 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 040dbcc7..9a7d0154 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Specifications List class SpecificationList implements Model { - /// Total number of specifications rows that matched your query. - final int total; + /// Total number of specifications rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 36e18a7e..0c926297 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 20ce6ca5..d5c6c01d 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Subscriber list class SubscriberList implements Model { - /// Total number of subscribers rows that matched your query. - final int total; + /// Total number of subscribers rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 1c5b88fb..7ce86b9d 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,76 +2,78 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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)), + ), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 2c285e55..7398c48f 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Tables List class TableList implements Model { - /// Total number of tables rows that matched your query. - final int total; + /// Total number of tables rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "tables": tables.map((p) => p.toMap()).toList(), - }; - } + 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 f2b3b6b4..4be8b545 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 c3c250a5..29667c94 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Target list class TargetList implements Model { - /// Total number of targets rows that matched your query. - final int total; + /// Total number of targets rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "targets": targets.map((p) => p.toMap()).toList(), - }; - } + 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 e9058b5b..43df33a8 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 3b8547ca..b70f12c1 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Teams List class TeamList implements Model { - /// Total number of teams rows that matched your query. - final int total; + /// Total number of teams rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "teams": teams.map((p) => p.toMap()).toList(), - }; - } + 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 4f6b8454..35115467 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 461d5694..430d44ac 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 1c0fdb32..69a17ebc 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Topic list class TopicList implements Model { - /// Total number of topics rows that matched your query. - final int total; + /// Total number of topics rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "topics": topics.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index effc397c..50bfb3ce 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 75b8f53b..56cc1b5b 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Users List class UserList implements Model { - /// Total number of users rows that matched your query. - final int total; + /// Total number of users rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "users": users.map((p) => p.toMap()).toList(), - }; - } + 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 58882a9f..2a8e276a 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 da6e6982..cd90d85f 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Variables List class VariableList implements Model { - /// Total number of variables rows that matched your query. - final int total; + /// Total number of variables rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/upload_progress.dart b/lib/src/upload_progress.dart index 44cde383..5a19b0fc 100644 --- a/lib/src/upload_progress.dart +++ b/lib/src/upload_progress.dart @@ -44,7 +44,7 @@ class UploadProgress { "progress": progress, "sizeUploaded": sizeUploaded, "chunksTotal": chunksTotal, - "chunksUploaded": chunksUploaded + "chunksUploaded": chunksUploaded, }; } From 1b9303747ad63e00b8fe23139310226a3bc8b0ab Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 20 Aug 2025 18:26:09 +1200 Subject: [PATCH 03/22] Add 1.8.x support --- .github/workflows/test.yml | 16 + CHANGELOG.md | 22 + docs/examples/databases/create.md | 1 - docs/examples/tablesdb/create.md | 1 - example/README.md | 58 + lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/enums.dart | 1 - lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1191 +++++----- lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2085 +++++++---------- lib/services/functions.dart | 869 +++---- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 +++-- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 1852 ++++++--------- lib/services/sites.dart | 822 +++---- lib/services/storage.dart | 428 ++-- lib/services/tables-db.dart | 1522 ------------ lib/services/tables_db.dart | 1162 +++++++++ lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1349 +++++------ lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/type.dart | 12 - lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 232 +- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 +-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 +-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 +-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- test/query_test.dart | 32 +- test/services/account_test.dart | 18 +- test/services/avatars_test.dart | 14 +- test/services/databases_test.dart | 12 +- test/services/functions_test.dart | 12 +- test/services/graphql_test.dart | 8 +- test/services/health_test.dart | 10 +- test/services/locale_test.dart | 8 +- test/services/messaging_test.dart | 30 +- test/services/sites_test.dart | 16 +- test/services/storage_test.dart | 8 +- ...ables-db_test.dart => tables_db_test.dart} | 12 +- test/services/teams_test.dart | 8 +- test/services/tokens_test.dart | 8 +- test/services/users_test.dart | 12 +- test/src/enums_test.dart | 12 +- test/src/exception_test.dart | 21 +- test/src/input_file_test.dart | 6 +- 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 | 10 +- test/src/models/algo_scrypt_test.dart | 12 +- test/src/models/algo_sha_test.dart | 4 +- 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_list_test.dart | 6 +- .../models/attribute_relationship_test.dart | 28 +- test/src/models/attribute_string_test.dart | 18 +- test/src/models/attribute_url_test.dart | 18 +- test/src/models/bucket_list_test.dart | 6 +- test/src/models/bucket_test.dart | 26 +- test/src/models/collection_list_test.dart | 6 +- test/src/models/collection_test.dart | 22 +- 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_list_test.dart | 6 +- test/src/models/column_relationship_test.dart | 28 +- test/src/models/column_string_test.dart | 18 +- test/src/models/column_url_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 | 14 +- test/src/models/deployment_list_test.dart | 6 +- test/src/models/deployment_test.dart | 56 +- test/src/models/document_list_test.dart | 6 +- test/src/models/document_test.dart | 16 +- test/src/models/execution_list_test.dart | 6 +- test/src/models/execution_test.dart | 34 +- test/src/models/file_list_test.dart | 6 +- test/src/models/file_test.dart | 24 +- 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 | 58 +- 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_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 | 4 +- 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 | 44 +- test/src/models/membership_list_test.dart | 6 +- test/src/models/membership_test.dart | 28 +- 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 | 6 +- test/src/models/phone_list_test.dart | 6 +- test/src/models/phone_test.dart | 8 +- test/src/models/provider_list_test.dart | 6 +- test/src/models/provider_test.dart | 18 +- test/src/models/resource_token_list_test.dart | 6 +- test/src/models/resource_token_test.dart | 16 +- 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 | 60 +- 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 | 30 +- test/src/models/table_list_test.dart | 6 +- test/src/models/table_test.dart | 22 +- 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 | 13 +- 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/user_list_test.dart | 6 +- test/src/models/user_test.dart | 33 +- test/src/models/variable_list_test.dart | 6 +- test/src/models/variable_test.dart | 18 +- 303 files changed, 12488 insertions(+), 13916 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 lib/services/tables-db.dart create mode 100644 lib/services/tables_db.dart delete mode 100644 lib/src/enums/type.dart rename test/services/{tables-db_test.dart => tables_db_test.dart} (99%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..d27a65b5 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,16 @@ +name: Analyze and test + +on: pull_request + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dart-lang/setup-dart@v1 + - name: Install dependencies + run: dart pub get + - name: Analyze + run: dart analyze --no-fatal-warnings + - name: Test + run: dart test \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1972a122..392eaf2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Change Log +## 17.0.0 + +* Support for Appwrite 1.8 +* Add TablesDB service +* Add new query types: + * `notContains` + * `notSearch` + * `notBetween` + * `notStartsWith` + * `notEndsWith` + * `createdBefore` + * `createdAfter` + * `updatedBefore` + * `updatedAfter` +* Deprecated `updateMagicURLSession` +* Deprecated `updatePhoneSession` +* Deprecated Databases service +> The TablesDB service is the new recommended way to work with databases. +> Existing databases/collections can be managed using the TablesDB service. +> Existing Databases service will continue to work, but new features will only be added to the TablesDB service. + + ## 16.2.0 * Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index 79b8af6e..a2e978bd 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -11,5 +11,4 @@ Database result = await databases.create( databaseId: '', name: '', enabled: false, // (optional) - type: .tablesdb, // (optional) ); diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index 486e5220..830b5898 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -11,5 +11,4 @@ Database result = await tablesDb.create( databaseId: '', name: '', enabled: false, // (optional) - type: .tablesdb, // (optional) ); diff --git a/example/README.md b/example/README.md index e69de29b..6de05748 100644 --- a/example/README.md +++ b/example/README.md @@ -0,0 +1,58 @@ +@@ -1,62 +0,0 @@ +# Examples + +Init your Appwrite client: + +```dart +Client client = Client(); + +client + .setProject('') + .setKey(''); +``` + +Create a new user: + +```dart +Users users = Users(client); + +User result = await users.create( + userId: ID.unique(), + email: "email@example.com", + phone: "+123456789", + password: "password", + name: "Walter O'Brien" +); +``` + +Get user: + +```dart +Users users = Users(client); + +User user = await users.get( + userId: '[USER_ID]', +); +``` + +Upload File: + +```dart +Storage storage = Storage(client); + +InputFile input = InputFile( + path: './path-to-file/image.jpg', + filename: 'image.jpg', +); + +File file = await storage.createFile( + bucketId: '', + fileId: ID.unique(), + file: input, + permissions: [ + Permission.read(Role.any()), + ], +); +``` + +All examples and API features are available at the [official Appwrite docs](https://appwrite.io/docs) 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/enums.dart b/lib/enums.dart index 838ca018..dd69b671 100644 --- a/lib/enums.dart +++ b/lib/enums.dart @@ -7,7 +7,6 @@ part 'src/enums/o_auth_provider.dart'; part 'src/enums/browser.dart'; part 'src/enums/credit_card.dart'; part 'src/enums/flag.dart'; -part 'src/enums/type.dart'; part 'src/enums/relationship_type.dart'; part 'src/enums/relation_mutate.dart'; part 'src/enums/index_type.dart'; diff --git a/lib/query.dart b/lib/query.dart index c9a2fc91..281aa756 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if (attribute != null) { + if(attribute != null) { map['attribute'] = attribute; } - - if (values != null) { + + if(values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} +} \ 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 b1358d47..89246ea7 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,26 +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 @@ -29,32 +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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -63,442 +60,449 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 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; - 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() async { - final String apiPath = '/account/jwts'; + Future createJWT() async { + final String apiPath = '/account/jwts'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 apiParams = {'mfa': mfa}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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 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. - 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 apiParams = { + + 'otp': otp, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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. - Future createMfaChallenge({ - required enums.AuthenticationFactor factor, - }) async { - final String apiPath = '/account/mfa/challenge'; + Future createMfaChallenge({required enums.AuthenticationFactor factor}) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = {'factor': factor.value}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - Future updateMfaChallenge({ - required String challengeId, - required String otp, - }) async { - final String apiPath = '/account/mfa/challenge'; + Future updateMfaChallenge({required String challengeId, required String otp}) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { + 'challengeId': challengeId, - 'otp': otp, +'otp': otp, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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. - 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. - 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 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. - 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 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 apiParams = { + + 'name': name, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'oldPassword': oldPassword, +'oldPassword': oldPassword, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 apiParams = { + + 'prefs': prefs, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 @@ -508,98 +512,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}; + final Map apiParams = { + + 'email': email, +'url': url, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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; - } + 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 @@ -608,212 +613,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 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 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.') - Future updateMagicURLSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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.') - Future updatePhoneSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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; - } + 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 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 /// provided user ID has not be registered, a new user will be created. Use the @@ -821,34 +827,31 @@ 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, - 'phrase': phrase, +'email': email, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -859,79 +862,66 @@ 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, - 'url': url, - 'phrase': phrase, +'email': email, +'url': url, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { 'success': success, - 'failure': failure, - 'scopes': scopes, +'failure': failure, +'scopes': scopes, + 'project': client.config['project'], }; 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), - ); + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -939,16 +929,15 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri( - scheme: endpoint.scheme, + Uri url = Uri(scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&'), + 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 @@ -956,29 +945,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}; + final Map apiParams = { + + 'userId': userId, +'phone': phone, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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** @@ -989,52 +979,56 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'url': url}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 updateVerification({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/verification'; + Future updateVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 @@ -1044,44 +1038,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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/verification/phone'; + Future updatePhoneVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index 8033f1cd..a91d6d3f 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,255 +1,189 @@ 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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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, - 'width': width, - 'height': height, +'width': width, +'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 = { 'name': name, - 'width': width, - 'height': height, - 'background': background, +'width': width, +'height': height, +'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, - 'size': size, - 'margin': margin, - 'download': download, +'size': size, +'margin': margin, +'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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 74dd60f0..22e279fc 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1684 +1,1215 @@ 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, - }) 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}) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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.createDatabase` instead.', - ) - Future create({ - required String databaseId, - required String name, - bool? enabled, - enums.Type? type, - }) async { - final String apiPath = '/databases'; + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDb.createDatabase` instead.') + Future create({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases'; final Map apiParams = { + 'databaseId': databaseId, - 'name': name, - 'enabled': enabled, - 'type': type?.value, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/databases/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDb.update` instead.') + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'collectionId': collectionId, - 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - List? permissions, - bool? documentSecurity, - bool? enabled, - }) 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + @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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + @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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return 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/{key}/relationship' - .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/{key}/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'onDelete': onDelete?.value, - 'newKey': newKey, +'newKey': newKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'documentId': documentId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - required Map data, - List? permissions, - }) 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, required Map data, List? permissions}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - 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; - } + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'attributes': attributes, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 index by 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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); - - 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; - } -} + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/functions.dart b/lib/services/functions.dart index e86f1afe..05a7d5f7 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,316 +1,256 @@ 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, - }) async { - final String apiPath = '/functions'; + Future list({List? queries, String? search}) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? specification, - }) 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? specification}) async { + final String apiPath = '/functions'; final Map apiParams = { + 'functionId': functionId, - 'name': name, - 'runtime': runtime.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'name': name, +'runtime': runtime.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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? specification, - }) 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? specification}) async { + final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'name': name, - 'runtime': runtime?.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'runtime': runtime?.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll( - '{functionId}', - functionId, - ); + Future listDeployments({required String functionId, List? queries, String? search}) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 = { + 'entrypoint': entrypoint, - 'commands': commands, - 'code': code, - 'activate': activate, +'commands': commands, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -325,446 +265,361 @@ 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, - 'buildId': buildId, +'buildId': buildId, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String functionId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/functions/{functionId}/deployments/template'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll( - '{functionId}', - functionId, - ); + Future createVcsDeployment({required String functionId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll( - '{functionId}', - functionId, - ); + Future listExecutions({required String functionId, List? queries}) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 = { + 'body': body, - 'async': xasync, - 'path': path, - 'method': method?.value, - 'headers': headers, - 'scheduledAt': scheduledAt, +'async': xasync, +'path': path, +'method': method?.value, +'headers': headers, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index 18eb54f1..e2418b52 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,49 +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 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; - 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 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/health.dart b/lib/services/health.dart index 5250c91d..0cf64ac6 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,414 +1,438 @@ 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.HealthStatus.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 = {'domain': domain}; + final Map apiParams = { + 'domain': domain, - 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.HealthCertificate.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.HealthStatus.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.HealthStatus.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = { + 'threshold': threshold, - final Map apiParams = {'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 = { 'name': name, - 'threshold': threshold, +'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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, - ); - - final Map apiParams = {'threshold': threshold}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future getFailedJobs({required enums.Name name, int? threshold}) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll('{name}', name.value); + + final Map apiParams = { + 'threshold': threshold, + + + }; + + final Map 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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 @@ -417,20 +441,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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 4d3cc3e0..430a00c3 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,164 +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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index afe3ee86..6147b8dc 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1478 +1,1160 @@ 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, - }) async { - final String apiPath = '/messaging/messages'; + Future listMessages({List? queries, String? search}) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'cc': cc, - 'bcc': bcc, - 'attachments': attachments, - 'draft': draft, - 'html': html, - 'scheduledAt': scheduledAt, +'subject': subject, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'cc': cc, +'bcc': bcc, +'attachments': attachments, +'draft': draft, +'html': html, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'title': title, - 'body': body, - 'topics': topics, - 'users': users, - 'targets': targets, - '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.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'title': title, +'body': body, +'topics': topics, +'users': users, +'targets': targets, +'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.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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'draft': draft, - 'scheduledAt': scheduledAt, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'draft': draft, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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 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 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; - return res.data; - } + } /// Get the message activity logs listed by its unique ID. - Future listMessageLogs({ - required String messageId, - List? queries, - }) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listMessageLogs({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/providers'; + Future listProviders({List? queries, String? search}) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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. - 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, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, - 'enabled': enabled, +'name': name, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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 = { + 'name': name, - 'enabled': enabled, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, +'enabled': enabled, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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 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. - 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 = { + 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'enabled': enabled, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'enabled': enabled, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, - 'enabled': enabled, +'name': name, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, +'enabled': enabled, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'enabled': enabled, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - 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 = { + 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'from': from, - 'customerId': customerId, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'customerId': customerId, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'customerId': customerId, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'customerId': customerId, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'username': username, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'username': username, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'username': username, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'username': username, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'accountSid': accountSid, - 'authToken': authToken, - 'enabled': enabled, +'name': name, +'from': from, +'accountSid': accountSid, +'authToken': authToken, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'accountSid': accountSid, - 'authToken': authToken, - 'from': from, +'enabled': enabled, +'accountSid': accountSid, +'authToken': authToken, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'enabled': enabled, +'name': name, +'from': from, +'apiKey': apiKey, +'apiSecret': apiSecret, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'from': from, +'enabled': enabled, +'apiKey': apiKey, +'apiSecret': apiSecret, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } + } /// Get the provider activity logs listed by its unique ID. - Future listProviderLogs({ - required String providerId, - List? queries, - }) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( - '{providerId}', - providerId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listProviderLogs({required String providerId, List? queries}) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs' - .replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs({required String subscriberId, List? queries}) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); + + final Map apiParams = { + 'queries': queries, - final Map apiParams = {'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.LogList.fromMap(res.data); - } + + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({ - List? queries, - String? search, - }) async { - final String apiPath = '/messaging/topics'; + Future listTopics({List? queries, String? search}) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'subscribe': subscribe, +'name': name, +'subscribe': subscribe, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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; - } + return res.data; + + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs({ - required String topicId, - List? queries, - }) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( - '{topicId}', - topicId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTopicLogs({required String topicId, List? queries}) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( - '{topicId}', - topicId, - ); + Future listSubscribers({required String topicId, List? queries, String? search}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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 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); - - 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; - } -} + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/sites.dart b/lib/services/sites.dart index d89f2192..5481986e 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,296 +1,247 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? outputDirectory, - enums.Adapter? adapter, - String? installationId, - String? fallbackFile, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites'; final Map apiParams = { + 'siteId': siteId, - 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime.value, - 'adapter': adapter?.value, - 'installationId': installationId, - 'fallbackFile': fallbackFile, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime.value, +'adapter': adapter?.value, +'installationId': installationId, +'fallbackFile': fallbackFile, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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? outputDirectory, - enums.BuildRuntime? buildRuntime, - enums.Adapter? adapter, - String? fallbackFile, - String? installationId, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime?.value, - 'adapter': adapter?.value, - 'fallbackFile': fallbackFile, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime?.value, +'adapter': adapter?.value, +'fallbackFile': fallbackFile, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future listDeployments({required String siteId, List? queries, String? search}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({ - required String siteId, - required InputFile code, - required bool activate, - String? installCommand, - String? buildCommand, - String? outputDirectory, - Function(UploadProgress)? onProgress, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'code': code, - 'activate': activate, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -305,400 +256,331 @@ 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String siteId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll( - '{siteId}', - siteId, - ); + Future createVcsDeployment({required String siteId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll( - '{siteId}', - siteId, - ); + Future listLogs({required String siteId, List? queries}) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ee630883..ccdce915 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,226 +1,184 @@ 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, - }) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({List? queries, String? search}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { + 'bucketId': bucketId, - 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'name': name, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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, - }) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( - '{bucketId}', - bucketId, - ); + Future listFiles({required String bucketId, List? queries, String? search}) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'permissions': permissions, +'file': file, +'permissions': permissions, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -236,187 +194,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 = { + 'name': name, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 = { 'width': width, - 'height': height, - 'gravity': gravity?.value, - 'quality': quality, - 'borderWidth': borderWidth, - 'borderColor': borderColor, - 'borderRadius': borderRadius, - 'opacity': opacity, - 'rotation': rotation, - 'background': background, - 'output': output?.value, - 'token': token, - +'height': height, +'gravity': gravity?.value, +'quality': quality, +'borderWidth': borderWidth, +'borderColor': borderColor, +'borderRadius': borderRadius, +'opacity': opacity, +'rotation': rotation, +'background': background, +'output': output?.value, +'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 = { '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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/tables-db.dart b/lib/services/tables-db.dart deleted file mode 100644 index a6760c13..00000000 --- a/lib/services/tables-db.dart +++ /dev/null @@ -1,1522 +0,0 @@ -part of '../dart_appwrite.dart'; - -class TablesDb extends Service { - 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, - }) async { - final String apiPath = '/tablesdb'; - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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, - enums.Type? type, - }) async { - final String apiPath = '/tablesdb'; - - final Map apiParams = { - 'databaseId': databaseId, - 'name': name, - 'enabled': enabled, - 'type': type?.value, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.Database.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, - ); - - final Map apiParams = {}; - - final Map 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - ); - - 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = { - 'queries': queries, - 'search': search, - }; - - final Map 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/server/databases#databasesCreateTable) - /// API or directly from your database console. - Future createTable({ - required String databaseId, - required String tableId, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = { - 'tableId': tableId, - 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = {}; - - final Map 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, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - 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; - } - - /// List columns in the table. - Future listColumns({ - required String databaseId, - required String tableId, - List? queries, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map 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); - - final Map apiParams = { - 'key': key, - 'required': xrequired, - 'default': xdefault, - 'array': array, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = { - '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, - ); - - 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); - - final Map apiParams = { - 'key': key, - 'required': xrequired, - 'default': xdefault, - 'array': array, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = { - '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, - ); - - 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); - - final Map apiParams = { - 'key': key, - 'required': xrequired, - 'default': xdefault, - 'array': array, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = { - '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, - ); - - 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); - - final Map apiParams = { - 'key': key, - 'elements': elements, - 'required': xrequired, - 'default': xdefault, - 'array': array, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = { - 'elements': elements, - '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, - ); - - 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); - - final Map apiParams = { - 'key': key, - 'required': xrequired, - 'min': min, - 'max': max, - 'default': xdefault, - 'array': array, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = { - 'required': xrequired, - '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.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); - - final Map apiParams = { - 'key': key, - 'required': xrequired, - 'min': min, - 'max': max, - 'default': xdefault, - 'array': array, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = { - 'required': xrequired, - '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.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); - - final Map apiParams = { - 'key': key, - 'required': xrequired, - 'default': xdefault, - 'array': array, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = { - '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, - ); - - return models.ColumnIp.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); - - final Map apiParams = { - 'relatedTableId': relatedTableId, - 'type': type.value, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.ColumnRelationship.fromMap(res.data); - } - - /// Create a string column. - /// - 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, - 'array': array, - 'encrypt': encrypt, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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. - /// - 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.ColumnString.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); - - final Map apiParams = { - 'key': key, - 'required': xrequired, - 'default': xdefault, - 'array': array, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = { - '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, - ); - - return models.ColumnUrl.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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } - - /// 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); - - 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 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); - - final Map apiParams = { - 'onDelete': onDelete?.value, - 'newKey': newKey, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.ColumnRelationship.fromMap(res.data); - } - - /// List indexes in the collection. - Future listIndexes({ - required String databaseId, - required String tableId, - List? queries, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map 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. - /// Attributes can be `key`, `fulltext`, and `unique`. - Future createIndex({ - required String databaseId, - required String tableId, - required String key, - required enums.IndexType 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, - 'orders': orders, - 'lengths': lengths, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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); - - final Map apiParams = {}; - - final Map 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); - - 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map 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/server/databases#databasesCreateTable) - /// API or directly from your database console. - Future createRow({ - required String databaseId, - required String tableId, - required String rowId, - required Map data, - List? permissions, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'rowId': rowId, - 'data': data, - 'permissions': permissions, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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/server/databases#databasesCreateTable) - /// API or directly from your database console. - Future createRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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/server/databases#databasesCreateTable) - /// API or directly from your database console. - /// - Future upsertRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - final Map apiParams = {'queries': queries}; - - final Map 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/server/databases#databasesCreateTable) - /// API or directly from your database console. - Future upsertRow({ - required String databaseId, - required String tableId, - required String rowId, - Map? data, - List? permissions, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - final Map apiParams = { - 'data': data, - 'permissions': permissions, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - final Map apiParams = { - 'data': data, - 'permissions': permissions, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - 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; - } - - /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return models.Row.fromMap(res.data); - } -} diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart new file mode 100644 index 00000000..288d730b --- /dev/null +++ b/lib/services/tables_db.dart @@ -0,0 +1,1162 @@ +part of '../dart_appwrite.dart'; + +class TablesDb extends Service { + 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}) async { + final String apiPath = '/tablesdb'; + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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'; + + final Map apiParams = { + + 'databaseId': databaseId, +'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Database.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); + + final Map apiParams = { + + + }; + + final Map 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, required String name, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map 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/server/databases#databasesCreateTable) + /// API or directly from your database console. + Future createTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'tableId': tableId, +'name': name, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'name': name, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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; + + } + + /// List columns in the table. + Future listColumns({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + '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); + + 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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + '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); + + 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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + '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); + + 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); + + final Map apiParams = { + + 'key': key, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'elements': elements, +'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); + + 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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'required': xrequired, +'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.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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + 'required': xrequired, +'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.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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + '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); + + return models.ColumnIp.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); + + final Map apiParams = { + + 'relatedTableId': relatedTableId, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ColumnRelationship.fromMap(res.data); + + } + + /// Create a string column. + /// + 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, +'array': array, +'encrypt': encrypt, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. + /// + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ColumnString.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); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + '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); + + return models.ColumnUrl.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); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } + + /// 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); + + 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 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); + + final Map apiParams = { + + 'onDelete': onDelete?.value, +'newKey': newKey, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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, +'orders': orders, +'lengths': lengths, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map 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); + + 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 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/databases#databasesCreateTable) + /// API or directly from your database console. + Future createRow({required String databaseId, required String tableId, required String rowId, required Map data, List? permissions}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rowId': rowId, +'data': data, +'permissions': permissions, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/databases#databasesCreateTable) + /// API or directly from your database console. + Future createRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/databases#databasesCreateTable) + /// API or directly from your database console. + /// + Future upsertRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/databases#databasesCreateTable) + /// API or directly from your database console. + Future upsertRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + final Map apiParams = { + + 'data': data, +'permissions': permissions, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + final Map apiParams = { + + 'data': data, +'permissions': permissions, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + 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; + + } + + /// 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}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Row.fromMap(res.data); + + } +} \ No newline at end of file diff --git a/lib/services/teams.dart b/lib/services/teams.dart index 5fd59641..c21a93af 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,147 +1,140 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'roles': roles, +'name': name, +'roles': roles, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiParams = {'name': name}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - 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, - }) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll( - '{teamId}', - teamId, - ); + Future listMemberships({required String teamId, List? queries, String? search}) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 @@ -149,210 +142,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 = { + 'email': email, - 'userId': userId, - 'phone': phone, - 'roles': roles, - 'url': url, - 'name': name, +'userId': userId, +'phone': phone, +'roles': roles, +'url': url, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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, - ); + /// + 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); 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 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; - 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); - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index 4e6915dc..cb04449b 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,113 +1,109 @@ 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, - }) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future list({required String bucketId, required String fileId, List? queries}) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); - - 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, - ); + 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); 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 apiParams = {'expire': expire}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/users.dart b/lib/services/users.dart index c98182b7..e6f80be3 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,359 +1,314 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'password': password, - 'name': name, +'email': email, +'phone': phone, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = '/users/identities'; + Future listIdentities({List? queries, String? search}) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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; - 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordCpu': passwordCpu, +'passwordMemory': passwordMemory, +'passwordParallel': passwordParallel, +'passwordLength': passwordLength, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordSaltSeparator': passwordSaltSeparator, +'passwordSignerKey': passwordSignerKey, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'passwordVersion': passwordVersion?.value, - 'name': name, +'email': email, +'password': password, +'passwordVersion': passwordVersion?.value, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -361,748 +316,648 @@ 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 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; - 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, - ); - - 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, - ); + 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); 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 = { + 'sessionId': sessionId, - 'duration': duration, +'duration': duration, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// Get the user activity logs list by its unique ID. - Future listLogs({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/logs'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listLogs({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll( - '{userId}', - userId, - ); + Future listMemberships({required String userId, List? queries, String? search}) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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. - 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 apiParams = {'mfa': mfa}; + final Map apiHeaders = { + 'content-type': 'application/json', - 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. - 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 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; - return 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. - 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. - 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 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. - 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 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } + + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll( - '{userId}', - userId, - ); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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 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 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; - 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 apiHeaders = { + 'content-type': 'application/json', - 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; - 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// List the messaging targets that are associated with a user. - Future listTargets({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/targets'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - 'providerId': providerId, - 'name': name, +'providerType': providerType.value, +'identifier': identifier, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'identifier': identifier, - 'providerId': providerId, - 'name': name, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - 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, - ); - - final Map apiParams = {'length': length, 'expire': expire}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future createToken({required String userId, int? length, int? expire}) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll('{userId}', userId); + + final Map apiParams = { + + 'length': length, +'expire': expire, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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); - } -} + + } +} \ No newline at end of file diff --git a/lib/src/client.dart b/lib/src/client.dart index d82d623a..0d9be210 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,8 +81,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 08d93b85..cd82d264 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,25 +2,21 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index c961873f..ea2cd62a 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,11 +9,14 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -31,66 +34,59 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format': '1.8.0', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -139,11 +135,7 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -170,19 +162,12 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 2bd7d639..f9e695bf 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,11 +10,17 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => - ClientIO(endPoint: endPoint, selfSigned: selfSigned); +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => + ClientIO( + endPoint: endPoint, + selfSigned: selfSigned, + ); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -37,68 +43,60 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent': - 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format': '1.8.0', + 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -153,16 +151,11 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, - file.path!, - filename: file.filename, - ); + paramName, file.path!, + filename: file.filename); } else { - 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, @@ -201,19 +194,12 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -258,7 +244,10 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse(res, responseType: responseType); + return prepareResponse( + res, + responseType: responseType, + ); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 06c9ebe3..658b79b6 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest).fields.addAll({ - "$key[$i]": v.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({"$key[$i]": v.toString()}); }); } else { - (request as http.MultipartRequest).fields.addAll({ - key: value.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({key: value.toString()}); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value) { + params = params.map((key, value){ if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,13 +51,12 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port, - ); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -67,9 +66,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); @@ -116,25 +113,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.dart b/lib/src/enums.dart index 0f250ea3..595afdc2 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes, + bytes } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 3341912f..2f198d4e 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 1bae5c8a..cd45b6a1 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 42954430..7d2d7016 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,16 +1,18 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 e20f48c6..af5ebaad 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,24 +1,26 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index b101d35f..8d86530d 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({required this.value}); + const IndexType({ + 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/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/name.dart b/lib/src/enums/name.dart index 74823feb..613bf5f1 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,22 +1,24 @@ 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'), - 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'), + 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 383e45b1..076c1c50 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,50 +1,52 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d4fef930..d34440ec 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/type.dart b/lib/src/enums/type.dart deleted file mode 100644 index 99bbf308..00000000 --- a/lib/src/enums/type.dart +++ /dev/null @@ -1,12 +0,0 @@ -part of '../../enums.dart'; - -enum Type { - tablesdb(value: 'tablesdb'), - legacy(value: 'legacy'); - - const Type({required this.value}); - - final String value; - - String toJson() => value; -} diff --git a/lib/src/enums/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index f01fcb01..0bf8e2ad 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({required this.value}); + const VCSDeploymentType({ + 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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index 4145f701..f174d569 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 4e901476..c9f67200 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 35c7b767..2fabb416 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index 7d27adba..fdcee07a 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index fec6f65a..120723df 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 0e80700f..504b5f8f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 bae6618f..5f3e1654 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 0ca54691..20dd7189 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1df01f19..a5b27b4f 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 21f8e9a3..96ce554b 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 298c181a..a4953a0e 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c6eecadd..03ba94c7 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1ef48332..8a5aa89d 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8c8fcb73..d17f414a 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index c5fa6adc..4098a5a1 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "attributes": attributes}; - } + Map toMap() { + return { + "total": total, + "attributes": attributes, + }; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 903c6290..050cbe14 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7374fa78..2202d255 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index f0bc295e..0c3ddf9e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index b8fb5e48..3bb374be 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 9d5b771b..29c56fe4 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Buckets List class BucketList implements Model { - /// Total number of buckets rows that matched your query. - final int total; + /// Total number of buckets rows 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))), + ); + } - Map toMap() { - return {"total": total, "buckets": buckets.map((p) => p.toMap()).toList()}; - } + 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 72de429d..c55110cf 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index b5ff3518..81104b31 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Collections List class CollectionList implements Model { - /// Total number of collections rows that matched your query. - final int total; + /// Total number of collections rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 60fcfa48..0ffc8fea 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c21a2260..367686d0 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 15d80695..7deb5e26 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 558b7d43..7bb56922 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 3b2f1335..c0547e11 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 9d637d92..acf0f6df 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 7bea7426..66213f0a 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,24 +2,28 @@ part of '../../models.dart'; /// Column Indexes List class ColumnIndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 2ba463cd..3823f425 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6672d7ce..4ac1fa12 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 8eb0171f..475c1c40 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "columns": columns}; - } + Map toMap() { + return { + "total": total, + "columns": columns, + }; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index 6221c01e..e55d1534 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7b560989..6fd6a3b0 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 66c0ce7b..94271aa6 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 7318b7ad..1a9c5038 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 651b5ae4..60b008ef 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Continents List class ContinentList implements Model { - /// Total number of continents rows that matched your query. - final int total; + /// Total number of continents rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 c52b50f2..565b1d66 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,19 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index ea839b51..3a3acd49 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Countries List class CountryList implements Model { - /// Total number of countries rows that matched your query. - final int total; + /// Total number of countries rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 27eef0c1..deafffe3 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 2ff28c61..34274e00 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Currencies List class CurrencyList implements Model { - /// Total number of currencies rows that matched your query. - final int total; + /// Total number of currencies rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 8d79e052..cab95b02 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 01e092f2..940a9610 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Databases List class DatabaseList implements Model { - /// Total number of databases rows that matched your query. - final int total; + /// Total number of databases rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 448c62c7..ecf7e791 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 1ca87150..7a2a38c2 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Deployments List class DeploymentList implements Model { - /// Total number of deployments rows that matched your query. - final int total; + /// Total number of deployments rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index cf85e457..be424a9c 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 b897a877..90bce66f 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,30 +2,31 @@ part of '../../models.dart'; /// Documents List class DocumentList implements Model { - /// Total number of documents rows that matched your query. - final int total; + /// Total number of documents rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 8618bcd6..0cfdbb4e 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,122 +2,118 @@ 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 upate date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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.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(), - trigger: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "trigger": trigger, - "status": status, - "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 upate date in ISO 8601 format. + final String $updatedAt; + + /// Execution roles. + final List $permissions; + + /// Function ID. + final String functionId; + + /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + final String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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.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(), + trigger: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "trigger": trigger, + "status": status, + "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 583d9fab..c30098a6 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Executions List class ExecutionList implements Model { - /// Total number of executions rows that matched your query. - final int total; + /// Total number of executions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 a6a9fa46..de8439ec 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index e7ca1bd5..164a281f 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Files List class FileList implements Model { - /// Total number of files rows that matched your query. - final int total; + /// Total number of files rows 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))), + ); + } - Map toMap() { - return {"total": total, "files": files.map((p) => p.toMap()).toList()}; - } + 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 693c9b07..ea6b601a 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,48 +2,46 @@ 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)), - ), - ); - } - - 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))), + ); + } + + 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 0b908240..7614616a 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5661bec4..bd39632e 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Frameworks List class FrameworkList implements Model { - /// Total number of frameworks rows that matched your query. - final int total; + /// Total number of frameworks rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 56c2eded..64401c3f 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index 24b199b1..b40dd517 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,25 +2,28 @@ part of '../../models.dart'; /// Functions List class FunctionList implements Model { - /// Total number of functions rows that matched your query. - final int total; + /// Total number of functions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 463cf696..ecf0a178 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "value": value}; - } + Map toMap() { + return { + "name": name, + "value": value, + }; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index fa402e97..54c31e70 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return {"version": version, "status": status}; - } + Map toMap() { + return { + "version": version, + "status": status, + }; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index d412eba9..0a5b6ce9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5f06906b..95da1235 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,16 +2,22 @@ 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'], + ); + } - Map toMap() { - return {"size": size}; - } + Map toMap() { + return { + "size": size, + }; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 59b7092c..0d6e7216 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,26 +2,34 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return {"name": name, "ping": ping, "status": status}; - } + Map toMap() { + return { + "name": name, + "ping": ping, + "status": status, + }; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index dec2d54f..102dfe77 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,30 +2,34 @@ 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'], + ); + } - Map toMap() { - return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; - } + Map toMap() { + return { + "remoteTime": remoteTime, + "localTime": localTime, + "diff": diff, + }; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index 807bdfd0..c43c4d57 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 51ddb64a..52fa04a6 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Identities List class IdentityList implements Model { - /// Total number of identities rows that matched your query. - final int total; + /// Total number of identities rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 9d6d7aec..b6717c4e 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 65207b94..390e9039 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Indexes List class IndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 490a1824..1b4ff7de 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"jwt": jwt}; - } + Map toMap() { + return { + "jwt": jwt, + }; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 9c45adb1..43eaad08 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,26 +2,34 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code, "nativeName": nativeName}; - } + 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 76a3f548..755c4e29 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Languages List class LanguageList implements Model { - /// Total number of languages rows that matched your query. - final int total; + /// Total number of languages rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 084475bf..b5e9ad1a 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 cd5a1155..10499ef5 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"code": code, "name": name}; - } + 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 5fa5c0ce..9e1e6034 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Locale codes list class LocaleCodeList implements Model { - /// Total number of localeCodes rows that matched your query. - final int total; + /// Total number of localeCodes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 7fb3f364..cb567bd7 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 4a771585..636d9166 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Logs List class LogList implements Model { - /// Total number of logs rows that matched your query. - final int total; + /// Total number of logs rows 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))), + ); + } - Map toMap() { - return {"total": total, "logs": logs.map((p) => p.toMap()).toList()}; - } + 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 8ee142ad..26610e46 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index 993f7206..566afb17 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Memberships List class MembershipList implements Model { - /// Total number of memberships rows that matched your query. - final int total; + /// Total number of memberships rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 9b93b00d..c4e9e858 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index c577ccc1..c5082c8e 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Message list class MessageList implements Model { - /// Total number of messages rows that matched your query. - final int total; + /// Total number of messages rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 96bf3c65..46c166fb 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 c930a23e..d49989d8 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 63411988..6c8b4e36 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,18 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"recoveryCodes": recoveryCodes}; - } + Map toMap() { + return { + "recoveryCodes": recoveryCodes, + }; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index fa57cb8b..01cf0857 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"secret": secret, "uri": uri}; - } + Map toMap() { + return { + "secret": secret, + "uri": uri, + }; + } } 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/phone.dart b/lib/src/models/phone.dart index 40f7bcd2..c8bbb95b 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 497aa36c..a40e3591 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Phones List class PhoneList implements Model { - /// Total number of phones rows that matched your query. - final int total; + /// Total number of phones rows 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))), + ); + } - Map toMap() { - return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "phones": phones.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index 7bc3abc9..edb6083e 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,17 +2,23 @@ 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); - } + factory Preferences.fromMap(Map map) { + return Preferences( + data: map, + ); + } - Map toMap() { - return {"data": data}; - } + 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/provider.dart b/lib/src/models/provider.dart index 1a762f85..4295c486 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 6d579bd0..c71c810d 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Provider list class ProviderList implements Model { - /// Total number of providers rows that matched your query. - final int total; + /// Total number of providers rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index dad35dcc..ed520cc4 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 fcbcbc3a..3c2d985f 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,24 +2,28 @@ part of '../../models.dart'; /// Resource Tokens List class ResourceTokenList implements Model { - /// Total number of tokens rows that matched your query. - final int total; + /// Total number of tokens rows 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))), + ); + } - Map toMap() { - return {"total": total, "tokens": tokens.map((p) => p.toMap()).toList()}; - } + 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 3700e577..62e69e5b 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 ae3f851d..42bdbfea 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,25 +2,31 @@ part of '../../models.dart'; /// Rows List class RowList implements Model { - /// Total number of rows rows that matched your query. - final int total; + /// Total number of rows 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))), + ); + } - Map toMap() { - return {"total": total, "rows": rows.map((p) => p.toMap()).toList()}; - } + 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 7c9677d8..35f82cfa 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 b93dbb8f..e574c63c 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Runtimes List class RuntimeList implements Model { - /// Total number of runtimes rows that matched your query. - final int total; + /// Total number of runtimes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 d2fe4f64..3a1d955f 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 563b04a4..160cb789 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Sessions List class SessionList implements Model { - /// Total number of sessions rows that matched your query. - final int total; + /// Total number of sessions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 1449f8bd..5cda6acc 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index eb1a5457..3164546a 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Sites List class SiteList implements Model { - /// Total number of sites rows that matched your query. - final int total; + /// Total number of sites rows 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))), + ); + } - Map toMap() { - return {"total": total, "sites": sites.map((p) => p.toMap()).toList()}; - } + 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 e8fb8c75..e49d399c 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,35 +2,40 @@ 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(), + ); + } - Map toMap() { - return {"memory": memory, "cpus": cpus, "enabled": enabled, "slug": slug}; - } + 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 9a7d0154..040dbcc7 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Specifications List class SpecificationList implements Model { - /// Total number of specifications rows that matched your query. - final int total; + /// Total number of specifications rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 0c926297..36e18a7e 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 d5c6c01d..20ce6ca5 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Subscriber list class SubscriberList implements Model { - /// Total number of subscribers rows that matched your query. - final int total; + /// Total number of subscribers rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 7ce86b9d..1c5b88fb 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,78 +2,76 @@ 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; - 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, - }); + 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, + }); - 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)), - ), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 7398c48f..2c285e55 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Tables List class TableList implements Model { - /// Total number of tables rows that matched your query. - final int total; + /// Total number of tables rows 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))), + ); + } - Map toMap() { - return {"total": total, "tables": tables.map((p) => p.toMap()).toList()}; - } + 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 4be8b545..f2b3b6b4 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 29667c94..c3c250a5 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Target list class TargetList implements Model { - /// Total number of targets rows that matched your query. - final int total; + /// Total number of targets rows 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))), + ); + } - Map toMap() { - return {"total": total, "targets": targets.map((p) => p.toMap()).toList()}; - } + 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 43df33a8..e9058b5b 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 b70f12c1..3b8547ca 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Teams List class TeamList implements Model { - /// Total number of teams rows that matched your query. - final int total; + /// Total number of teams rows 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))), + ); + } - Map toMap() { - return {"total": total, "teams": teams.map((p) => p.toMap()).toList()}; - } + 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 35115467..4f6b8454 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 430d44ac..461d5694 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 69a17ebc..1c0fdb32 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Topic list class TopicList implements Model { - /// Total number of topics rows that matched your query. - final int total; + /// Total number of topics rows 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))), + ); + } - Map toMap() { - return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "topics": topics.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index 50bfb3ce..effc397c 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 56cc1b5b..75b8f53b 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Users List class UserList implements Model { - /// Total number of users rows that matched your query. - final int total; + /// Total number of users rows 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))), + ); + } - Map toMap() { - return {"total": total, "users": users.map((p) => p.toMap()).toList()}; - } + 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 2a8e276a..58882a9f 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 cd90d85f..da6e6982 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Variables List class VariableList implements Model { - /// Total number of variables rows that matched your query. - final int total; + /// Total number of variables rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } diff --git a/test/query_test.dart b/test/query_test.dart index ab7bd0e9..737a82b3 100644 --- a/test/query_test.dart +++ b/test/query_test.dart @@ -63,12 +63,16 @@ void main() { group('notEqual()', () { for (var t in tests) { - test(t.description, () { - final query = jsonDecode(Query.notEqual('attr', t.value)); - expect(query['attribute'], 'attr'); - expect(query['values'], t.expectedValues); - expect(query['method'], 'notEqual'); - }); + test( + t.description, + () { + final query = jsonDecode(Query.notEqual('attr', t.value)); + expect(query['attribute'], 'attr'); + expect(query['values'], t.expectedValues); + expect(query['method'], 'notEqual'); + }, + skip: t.value is List, + ); } }); @@ -185,28 +189,28 @@ void main() { test('returns cursorBefore', () { final query = jsonDecode(Query.cursorBefore('custom')); expect(query['attribute'], null); - expect(query['values'], 'custom'); + expect(query['values'], ['custom']); expect(query['method'], 'cursorBefore'); }); test('returns cursorAfter', () { final query = jsonDecode(Query.cursorAfter('custom')); expect(query['attribute'], null); - expect(query['values'], 'custom'); + expect(query['values'], ['custom']); expect(query['method'], 'cursorAfter'); }); test('returns limit', () { final query = jsonDecode(Query.limit(1)); expect(query['attribute'], null); - expect(query['values'], 1); + expect(query['values'], [1]); expect(query['method'], 'limit'); }); test('returns offset', () { final query = jsonDecode(Query.offset(1)); expect(query['attribute'], null); - expect(query['values'], 1); + expect(query['values'], [1]); expect(query['method'], 'offset'); }); @@ -264,28 +268,28 @@ void main() { test('returns createdBefore', () { final query = jsonDecode(Query.createdBefore('2023-01-01')); expect(query['attribute'], null); - expect(query['values'], '2023-01-01'); + expect(query['values'], ['2023-01-01']); expect(query['method'], 'createdBefore'); }); test('returns createdAfter', () { final query = jsonDecode(Query.createdAfter('2023-01-01')); expect(query['attribute'], null); - expect(query['values'], '2023-01-01'); + expect(query['values'], ['2023-01-01']); expect(query['method'], 'createdAfter'); }); test('returns updatedBefore', () { final query = jsonDecode(Query.updatedBefore('2023-01-01')); expect(query['attribute'], null); - expect(query['values'], '2023-01-01'); + expect(query['values'], ['2023-01-01']); expect(query['method'], 'updatedBefore'); }); test('returns updatedAfter', () { final query = jsonDecode(Query.updatedAfter('2023-01-01')); expect(query['attribute'], null); - expect(query['values'], '2023-01-01'); + expect(query['values'], ['2023-01-01']); expect(query['method'], 'updatedAfter'); }); } diff --git a/test/services/account_test.dart b/test/services/account_test.dart index 55679f3f..b3bea7c6 100644 --- a/test/services/account_test.dart +++ b/test/services/account_test.dart @@ -1,6 +1,7 @@ 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'; @@ -22,12 +23,7 @@ class MockClient extends Mock implements Client { } @override - Future webAuth( - Uri? url, - { - String? callbackUrlScheme, - } - ) async { + Future webAuth(Uri url) async { return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @@ -259,7 +255,7 @@ void main() { final response = await account.createMfaAuthenticator( - type: 'totp', + type: enums.AuthenticatorType.totp, ); expect(response, isA()); @@ -291,7 +287,7 @@ void main() { final response = await account.updateMfaAuthenticator( - type: 'totp', + type: enums.AuthenticatorType.totp, otp: '', ); expect(response, isA()); @@ -307,7 +303,7 @@ void main() { final response = await account.deleteMfaAuthenticator( - type: 'totp', + type: enums.AuthenticatorType.totp, ); }); @@ -325,7 +321,7 @@ void main() { final response = await account.createMfaChallenge( - factor: 'email', + factor: enums.AuthenticationFactor.email, ); expect(response, isA()); @@ -1080,7 +1076,7 @@ void main() { final response = await account.createOAuth2Token( - provider: 'amazon', + provider: enums.OAuthProvider.amazon, ); }); diff --git a/test/services/avatars_test.dart b/test/services/avatars_test.dart index aaf84313..062e484e 100644 --- a/test/services/avatars_test.dart +++ b/test/services/avatars_test.dart @@ -1,6 +1,7 @@ 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'; @@ -22,12 +23,7 @@ class MockClient extends Mock implements Client { } @override - Future webAuth( - Uri? url, - { - String? callbackUrlScheme, - } - ) async { + Future webAuth(Uri url) async { return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @@ -62,7 +58,7 @@ void main() { final response = await avatars.getBrowser( - code: 'aa', + code: enums.Browser.avantBrowser, ); expect(response, isA()); @@ -76,7 +72,7 @@ void main() { final response = await avatars.getCreditCard( - code: 'amex', + code: enums.CreditCard.americanExpress, ); expect(response, isA()); @@ -104,7 +100,7 @@ void main() { final response = await avatars.getFlag( - code: 'af', + code: enums.Flag.afghanistan, ); expect(response, isA()); diff --git a/test/services/databases_test.dart b/test/services/databases_test.dart index c6bc5a24..eeab4468 100644 --- a/test/services/databases_test.dart +++ b/test/services/databases_test.dart @@ -1,6 +1,7 @@ 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'; @@ -22,12 +23,7 @@ class MockClient extends Mock implements Client { } @override - Future webAuth( - Uri? url, - { - String? callbackUrlScheme, - } - ) async { + Future webAuth(Uri url) async { return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @@ -695,7 +691,7 @@ void main() { databaseId: '', collectionId: '', relatedCollectionId: '', - type: 'oneToOne', + type: enums.RelationshipType.oneToOne, ); expect(response, isA()); @@ -1180,7 +1176,7 @@ void main() { databaseId: '', collectionId: '', key: '', - type: 'key', + type: enums.IndexType.key, attributes: [], ); expect(response, isA()); diff --git a/test/services/functions_test.dart b/test/services/functions_test.dart index f42bd078..eaacca8c 100644 --- a/test/services/functions_test.dart +++ b/test/services/functions_test.dart @@ -1,6 +1,7 @@ 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'; @@ -22,12 +23,7 @@ class MockClient extends Mock implements Client { } @override - Future webAuth( - Uri? url, - { - String? callbackUrlScheme, - } - ) async { + Future webAuth(Uri url) async { return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @@ -111,7 +107,7 @@ void main() { final response = await functions.create( functionId: '', name: '', - runtime: 'node-14.5', + runtime: enums.Runtime.node145, ); expect(response, isA()); @@ -494,7 +490,7 @@ void main() { final response = await functions.createVcsDeployment( functionId: '', - type: 'branch', + type: enums.VCSDeploymentType.branch, reference: '', ); expect(response, isA()); diff --git a/test/services/graphql_test.dart b/test/services/graphql_test.dart index 20ace7b1..26d79d42 100644 --- a/test/services/graphql_test.dart +++ b/test/services/graphql_test.dart @@ -1,6 +1,7 @@ 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'; @@ -22,12 +23,7 @@ class MockClient extends Mock implements Client { } @override - Future webAuth( - Uri? url, - { - String? callbackUrlScheme, - } - ) async { + Future webAuth(Uri url) async { return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } diff --git a/test/services/health_test.dart b/test/services/health_test.dart index 6a1dae9e..e60505df 100644 --- a/test/services/health_test.dart +++ b/test/services/health_test.dart @@ -1,6 +1,7 @@ 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'; @@ -22,12 +23,7 @@ class MockClient extends Mock implements Client { } @override - Future webAuth( - Uri? url, - { - String? callbackUrlScheme, - } - ) async { + Future webAuth(Uri url) async { return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @@ -239,7 +235,7 @@ void main() { final response = await health.getFailedJobs( - name: 'v1-database', + name: enums.Name.v1Database, ); expect(response, isA()); diff --git a/test/services/locale_test.dart b/test/services/locale_test.dart index 795c9f03..3536cee0 100644 --- a/test/services/locale_test.dart +++ b/test/services/locale_test.dart @@ -1,6 +1,7 @@ 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'; @@ -22,12 +23,7 @@ class MockClient extends Mock implements Client { } @override - Future webAuth( - Uri? url, - { - String? callbackUrlScheme, - } - ) async { + Future webAuth(Uri url) async { return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } diff --git a/test/services/messaging_test.dart b/test/services/messaging_test.dart index eacea811..47a21df1 100644 --- a/test/services/messaging_test.dart +++ b/test/services/messaging_test.dart @@ -1,6 +1,7 @@ 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'; @@ -22,12 +23,7 @@ class MockClient extends Mock implements Client { } @override - Future webAuth( - Uri? url, - { - String? callbackUrlScheme, - } - ) async { + Future webAuth(Uri url) async { return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @@ -1031,7 +1027,16 @@ void main() { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$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, + }, 'userId': '5e5ea5c16897e', 'userName': 'Aegon Targaryen', 'topicId': '259125845563242502', @@ -1058,7 +1063,16 @@ void main() { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$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, + }, 'userId': '5e5ea5c16897e', 'userName': 'Aegon Targaryen', 'topicId': '259125845563242502', diff --git a/test/services/sites_test.dart b/test/services/sites_test.dart index be65bbf9..f4a9b957 100644 --- a/test/services/sites_test.dart +++ b/test/services/sites_test.dart @@ -1,6 +1,7 @@ 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'; @@ -22,12 +23,7 @@ class MockClient extends Mock implements Client { } @override - Future webAuth( - Uri? url, - { - String? callbackUrlScheme, - } - ) async { + Future webAuth(Uri url) async { return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @@ -112,8 +108,8 @@ void main() { final response = await sites.create( siteId: '', name: '', - framework: 'analog', - buildRuntime: 'node-14.5', + framework: enums.Framework.analog, + buildRuntime: enums.BuildRuntime.node145, ); expect(response, isA()); @@ -239,7 +235,7 @@ void main() { final response = await sites.update( siteId: '', name: '', - framework: 'analog', + framework: enums.Framework.analog, ); expect(response, isA()); @@ -500,7 +496,7 @@ void main() { final response = await sites.createVcsDeployment( siteId: '', - type: 'branch', + type: enums.VCSDeploymentType.branch, reference: '', ); expect(response, isA()); diff --git a/test/services/storage_test.dart b/test/services/storage_test.dart index c2a81fab..27f51037 100644 --- a/test/services/storage_test.dart +++ b/test/services/storage_test.dart @@ -1,6 +1,7 @@ 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'; @@ -22,12 +23,7 @@ class MockClient extends Mock implements Client { } @override - Future webAuth( - Uri? url, - { - String? callbackUrlScheme, - } - ) async { + Future webAuth(Uri url) async { return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } diff --git a/test/services/tables-db_test.dart b/test/services/tables_db_test.dart similarity index 99% rename from test/services/tables-db_test.dart rename to test/services/tables_db_test.dart index 25590572..a6f8350f 100644 --- a/test/services/tables-db_test.dart +++ b/test/services/tables_db_test.dart @@ -1,6 +1,7 @@ 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'; @@ -22,12 +23,7 @@ class MockClient extends Mock implements Client { } @override - Future webAuth( - Uri? url, - { - String? callbackUrlScheme, - } - ) async { + Future webAuth(Uri url) async { return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @@ -695,7 +691,7 @@ void main() { databaseId: '', tableId: '', relatedTableId: '', - type: 'oneToOne', + type: enums.RelationshipType.oneToOne, ); expect(response, isA()); @@ -914,7 +910,7 @@ void main() { databaseId: '', tableId: '', key: '', - type: 'key', + type: enums.IndexType.key, columns: [], ); expect(response, isA()); diff --git a/test/services/teams_test.dart b/test/services/teams_test.dart index 891610e1..3248d30b 100644 --- a/test/services/teams_test.dart +++ b/test/services/teams_test.dart @@ -1,6 +1,7 @@ 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'; @@ -22,12 +23,7 @@ class MockClient extends Mock implements Client { } @override - Future webAuth( - Uri? url, - { - String? callbackUrlScheme, - } - ) async { + Future webAuth(Uri url) async { return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } diff --git a/test/services/tokens_test.dart b/test/services/tokens_test.dart index 66aec103..1560cb59 100644 --- a/test/services/tokens_test.dart +++ b/test/services/tokens_test.dart @@ -1,6 +1,7 @@ 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'; @@ -22,12 +23,7 @@ class MockClient extends Mock implements Client { } @override - Future webAuth( - Uri? url, - { - String? callbackUrlScheme, - } - ) async { + Future webAuth(Uri url) async { return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } diff --git a/test/services/users_test.dart b/test/services/users_test.dart index 9f05493d..52adda4e 100644 --- a/test/services/users_test.dart +++ b/test/services/users_test.dart @@ -1,6 +1,7 @@ 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'; @@ -22,12 +23,7 @@ class MockClient extends Mock implements Client { } @override - Future webAuth( - Uri? url, - { - String? callbackUrlScheme, - } - ) async { + Future webAuth(Uri url) async { return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @@ -586,7 +582,7 @@ void main() { final response = await users.deleteMfaAuthenticator( userId: '', - type: 'totp', + type: enums.AuthenticatorType.totp, ); }); @@ -954,7 +950,7 @@ void main() { final response = await users.createTarget( userId: '', targetId: '', - providerType: 'email', + providerType: enums.MessagingProviderType.email, identifier: '', ); expect(response, isA()); diff --git a/test/src/enums_test.dart b/test/src/enums_test.dart index d62900b4..b44b0124 100644 --- a/test/src/enums_test.dart +++ b/test/src/enums_test.dart @@ -5,10 +5,14 @@ void main() { group('name()', () { for (final method in HttpMethod.values) { test( - 'returns ${method.toString().split('.').last.toUpperCase()} for $method', - () { - expect(method.name(), method.toString().split('.').last.toUpperCase()); - }); + 'returns ${method.toString().split('.').last.toUpperCase()} for $method', + () { + expect( + method.name(), + method.toString().split('.').last.toUpperCase(), + ); + }, + ); } }); } diff --git a/test/src/exception_test.dart b/test/src/exception_test.dart index 500059e3..6b051375 100644 --- a/test/src/exception_test.dart +++ b/test/src/exception_test.dart @@ -8,13 +8,22 @@ void main() { expect(exception1.toString(), equals('AppwriteException')); final exception2 = AppwriteException('Some error message'); - expect(exception2.toString(), - equals('AppwriteException: , Some error message (0)')); + expect( + exception2.toString(), + equals('AppwriteException: , Some error message (0)'), + ); - final exception3 = - AppwriteException('Invalid request', 400, 'ValidationError'); - expect(exception3.toString(), - equals('AppwriteException: ValidationError, Invalid request (400)')); + final exception3 = AppwriteException( + 'Invalid request', + 400, + 'ValidationError', + ); + expect( + exception3.toString(), + equals( + 'AppwriteException: ValidationError, Invalid request (400)', + ), + ); }); }); } diff --git a/test/src/input_file_test.dart b/test/src/input_file_test.dart index a5277d8e..876921e6 100644 --- a/test/src/input_file_test.dart +++ b/test/src/input_file_test.dart @@ -36,8 +36,10 @@ void main() { }); test('creates InputFile from bytes', () { - final inputFile = - InputFile.fromBytes(bytes: [1, 2, 3], filename: 'file.txt'); + final inputFile = InputFile.fromBytes( + bytes: [1, 2, 3], + filename: 'file.txt', + ); expect(inputFile.path, isNull); expect(inputFile.filename, 'file.txt'); 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 d7af2ef9..53596100 100644 --- a/test/src/models/algo_scrypt_modified_test.dart +++ b/test/src/models/algo_scrypt_modified_test.dart @@ -14,10 +14,10 @@ void main() { 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_boolean_test.dart b/test/src/models/attribute_boolean_test.dart index 6b594877..39319182 100644 --- a/test/src/models/attribute_boolean_test.dart +++ b/test/src/models/attribute_boolean_test.dart @@ -17,13 +17,13 @@ void main() { final map = model.toMap(); final result = AttributeBoolean.fromMap(map); - expect(result.key, 'isEnabled'); - expect(result.type, 'boolean'); - expect(result.status, '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, '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 ad1fd7e7..42ae6cc6 100644 --- a/test/src/models/attribute_datetime_test.dart +++ b/test/src/models/attribute_datetime_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = AttributeDatetime.fromMap(map); - expect(result.key, 'birthDay'); - expect(result.type, 'datetime'); - expect(result.status, '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, '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 ecbe20c4..8bff3e81 100644 --- a/test/src/models/attribute_email_test.dart +++ b/test/src/models/attribute_email_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = AttributeEmail.fromMap(map); - expect(result.key, 'userEmail'); - expect(result.type, 'string'); - expect(result.status, '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, '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 d8b3348c..cf741a60 100644 --- a/test/src/models/attribute_enum_test.dart +++ b/test/src/models/attribute_enum_test.dart @@ -19,15 +19,15 @@ void main() { final map = model.toMap(); final result = AttributeEnum.fromMap(map); - expect(result.key, 'status'); - expect(result.type, 'string'); - expect(result.status, '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, '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 3f18dd42..1dbf3078 100644 --- a/test/src/models/attribute_float_test.dart +++ b/test/src/models/attribute_float_test.dart @@ -17,13 +17,13 @@ void main() { final map = model.toMap(); final result = AttributeFloat.fromMap(map); - expect(result.key, 'percentageCompleted'); - expect(result.type, 'double'); - expect(result.status, '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, '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 3e82c55d..9baa191f 100644 --- a/test/src/models/attribute_integer_test.dart +++ b/test/src/models/attribute_integer_test.dart @@ -17,13 +17,13 @@ void main() { final map = model.toMap(); final result = AttributeInteger.fromMap(map); - expect(result.key, 'count'); - expect(result.type, 'integer'); - expect(result.status, '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, '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 89d230f6..f1e7c993 100644 --- a/test/src/models/attribute_ip_test.dart +++ b/test/src/models/attribute_ip_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = AttributeIp.fromMap(map); - expect(result.key, 'ipAddress'); - expect(result.type, 'string'); - expect(result.status, '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, '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_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_relationship_test.dart b/test/src/models/attribute_relationship_test.dart index d2c7c6c5..4ee29944 100644 --- a/test/src/models/attribute_relationship_test.dart +++ b/test/src/models/attribute_relationship_test.dart @@ -23,19 +23,19 @@ void main() { final map = model.toMap(); final result = AttributeRelationship.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, '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, '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 4528c470..f5e93640 100644 --- a/test/src/models/attribute_string_test.dart +++ b/test/src/models/attribute_string_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = AttributeString.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, '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, '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_url_test.dart b/test/src/models/attribute_url_test.dart index 8ac97572..4cfdbc40 100644 --- a/test/src/models/attribute_url_test.dart +++ b/test/src/models/attribute_url_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = AttributeUrl.fromMap(map); - expect(result.key, 'githubUrl'); - expect(result.type, 'string'); - expect(result.status, '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, '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/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 143eeb19..f1686882 100644 --- a/test/src/models/bucket_test.dart +++ b/test/src/models/bucket_test.dart @@ -22,18 +22,18 @@ 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.$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); + }); }); } 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 ad6c2878..4a7e4277 100644 --- a/test/src/models/collection_test.dart +++ b/test/src/models/collection_test.dart @@ -20,16 +20,16 @@ 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.$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, []); + }); }); } diff --git a/test/src/models/column_boolean_test.dart b/test/src/models/column_boolean_test.dart index 074fbc1e..578d1ffc 100644 --- a/test/src/models/column_boolean_test.dart +++ b/test/src/models/column_boolean_test.dart @@ -17,13 +17,13 @@ void main() { final map = model.toMap(); final result = ColumnBoolean.fromMap(map); - expect(result.key, 'isEnabled'); - expect(result.type, 'boolean'); - expect(result.status, '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, '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 681e9325..9efa877f 100644 --- a/test/src/models/column_datetime_test.dart +++ b/test/src/models/column_datetime_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = ColumnDatetime.fromMap(map); - expect(result.key, 'birthDay'); - expect(result.type, 'datetime'); - expect(result.status, '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, '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 261fbb50..6af65d64 100644 --- a/test/src/models/column_email_test.dart +++ b/test/src/models/column_email_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = ColumnEmail.fromMap(map); - expect(result.key, 'userEmail'); - expect(result.type, 'string'); - expect(result.status, '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, '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 cbf435d9..8d4f4772 100644 --- a/test/src/models/column_enum_test.dart +++ b/test/src/models/column_enum_test.dart @@ -19,15 +19,15 @@ void main() { final map = model.toMap(); final result = ColumnEnum.fromMap(map); - expect(result.key, 'status'); - expect(result.type, 'string'); - expect(result.status, '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, '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 e179f2c3..316b566b 100644 --- a/test/src/models/column_float_test.dart +++ b/test/src/models/column_float_test.dart @@ -17,13 +17,13 @@ void main() { final map = model.toMap(); final result = ColumnFloat.fromMap(map); - expect(result.key, 'percentageCompleted'); - expect(result.type, 'double'); - expect(result.status, '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, '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 f786e54a..911588d3 100644 --- a/test/src/models/column_integer_test.dart +++ b/test/src/models/column_integer_test.dart @@ -17,13 +17,13 @@ void main() { final map = model.toMap(); final result = ColumnInteger.fromMap(map); - expect(result.key, 'count'); - expect(result.type, 'integer'); - expect(result.status, '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, '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 aa2b38df..a1153e85 100644 --- a/test/src/models/column_ip_test.dart +++ b/test/src/models/column_ip_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = ColumnIp.fromMap(map); - expect(result.key, 'ipAddress'); - expect(result.type, 'string'); - expect(result.status, '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, '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_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_relationship_test.dart b/test/src/models/column_relationship_test.dart index 852e4ec3..3de4bc71 100644 --- a/test/src/models/column_relationship_test.dart +++ b/test/src/models/column_relationship_test.dart @@ -23,19 +23,19 @@ void main() { final map = model.toMap(); final result = ColumnRelationship.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, '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, '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 dfd78790..e6c11716 100644 --- a/test/src/models/column_string_test.dart +++ b/test/src/models/column_string_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = ColumnString.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, '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, '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_url_test.dart b/test/src/models/column_url_test.dart index 8943d6a6..ad8cde9f 100644 --- a/test/src/models/column_url_test.dart +++ b/test/src/models/column_url_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = ColumnUrl.fromMap(map); - expect(result.key, 'githubUrl'); - expect(result.type, 'string'); - expect(result.status, '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, '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/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 1389d5a7..191a10fd 100644 --- a/test/src/models/database_test.dart +++ b/test/src/models/database_test.dart @@ -16,12 +16,12 @@ 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, 'legacy'); - }); + 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, 'legacy'); + }); }); } 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 5693c863..80c2c9b9 100644 --- a/test/src/models/deployment_test.dart +++ b/test/src/models/deployment_test.dart @@ -37,33 +37,33 @@ void main() { 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, 'ready'); - 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.providerBranch, '0.7.x'); - 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.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, 'ready'); + 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.providerBranch, '0.7.x'); + 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.providerBranchUrl, 'https://github.com/vermakhushboo/appwrite/tree/0.7.x'); + }); }); } 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 971b58de..b86aebbd 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/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 ff2939ee..2936d861 100644 --- a/test/src/models/execution_test.dart +++ b/test/src/models/execution_test.dart @@ -26,22 +26,22 @@ 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.trigger, 'http'); - expect(result.status, 'processing'); - 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.trigger, 'http'); + expect(result.status, 'processing'); + 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 65bea117..f89314f0 100644 --- a/test/src/models/file_test.dart +++ b/test/src/models/file_test.dart @@ -21,17 +21,17 @@ 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.$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); + }); }); } 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 204e18f3..58116683 100644 --- a/test/src/models/function_test.dart +++ b/test/src/models/function_test.dart @@ -38,34 +38,34 @@ 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.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.specification, '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.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.specification, '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 0ab03404..56e3d755 100644 --- a/test/src/models/health_antivirus_test.dart +++ b/test/src/models/health_antivirus_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = HealthAntivirus.fromMap(map); - expect(result.version, '1.0.0'); - expect(result.status, 'online'); - }); + expect(result.version, '1.0.0'); + expect(result.status, 'online'); + }); }); } 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_test.dart b/test/src/models/health_status_test.dart index 3dad07ea..36be52ad 100644 --- a/test/src/models/health_status_test.dart +++ b/test/src/models/health_status_test.dart @@ -13,9 +13,9 @@ void main() { final map = model.toMap(); final result = HealthStatus.fromMap(map); - expect(result.name, 'database'); - expect(result.ping, 128); - expect(result.status, 'pass'); - }); + expect(result.name, 'database'); + expect(result.ping, 128); + expect(result.status, '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 63766829..54733385 100644 --- a/test/src/models/index_test.dart +++ b/test/src/models/index_test.dart @@ -19,15 +19,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, '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, '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 b9b04120..a45857b3 100644 --- a/test/src/models/jwt_test.dart +++ b/test/src/models/jwt_test.dart @@ -11,7 +11,7 @@ void main() { 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/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 c4e740c9..1a1464ef 100644 --- a/test/src/models/log_test.dart +++ b/test/src/models/log_test.dart @@ -31,27 +31,27 @@ 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.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.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..21718671 100644 --- a/test/src/models/membership_test.dart +++ b/test/src/models/membership_test.dart @@ -23,19 +23,19 @@ 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.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 22b83fef..64b2feac 100644 --- a/test/src/models/message_test.dart +++ b/test/src/models/message_test.dart @@ -20,16 +20,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, 'Message status can be one of the following: draft, processing, scheduled, sent, or failed.'); - }); + 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, 'Message status can be one of the following: draft, processing, scheduled, sent, or failed.'); + }); }); } 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 fd71f87d..0b99593b 100644 --- a/test/src/models/mfa_type_test.dart +++ b/test/src/models/mfa_type_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = MfaType.fromMap(map); - expect(result.secret, '1'); - expect(result.uri, '1'); - }); + expect(result.secret, '1'); + expect(result.uri, '1'); + }); }); } 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/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/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 d792db7e..e8f7bd34 100644 --- a/test/src/models/resource_token_test.dart +++ b/test/src/models/resource_token_test.dart @@ -17,13 +17,13 @@ void main() { 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 9770d87f..8b5e00f0 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 4949b0cc..75bda837 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 d73d1003..a1e95c50 100644 --- a/test/src/models/site_test.dart +++ b/test/src/models/site_test.dart @@ -39,35 +39,35 @@ 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.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.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.specification, '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.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.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.specification, '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 18fbf0e5..32d1f9e1 100644 --- a/test/src/models/subscriber_test.dart +++ b/test/src/models/subscriber_test.dart @@ -9,7 +9,16 @@ void main() { $createdAt: '2020-10-15T06:38:00.000+00:00', $updatedAt: '2020-10-15T06:38:00.000+00:00', targetId: '259125845563242502', - target: {}, + 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, + ), userId: '5e5ea5c16897e', userName: 'Aegon Targaryen', topicId: '259125845563242502', @@ -19,15 +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.target, {}); - 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 d16033bf..fa7e754e 100644 --- a/test/src/models/table_test.dart +++ b/test/src/models/table_test.dart @@ -20,16 +20,16 @@ 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.$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, []); + }); }); } 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 45d12b7f..6285fe54 100644 --- a/test/src/models/team_test.dart +++ b/test/src/models/team_test.dart @@ -16,12 +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.prefs.data, {"data": {}}); - }); + 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/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 9827da38..47e85f4b 100644 --- a/test/src/models/user_test.dart +++ b/test/src/models/user_test.dart @@ -26,22 +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.prefs.data, {"data": {}}); - 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'); + }); }); } From 95e352b9bc2d9eb8d887076e163dd2a893c3c835 Mon Sep 17 00:00:00 2001 From: abnegate Date: Wed, 20 Aug 2025 06:26:48 +0000 Subject: [PATCH 04/22] Commit from GitHub Actions (Format and push) --- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1191 +++++------ lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 ++++++++++++------- lib/services/functions.dart | 869 ++++---- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 +++-- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 1852 ++++++++++------- lib/services/sites.dart | 822 ++++---- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 +++++++++------- lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1349 ++++++------ lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 232 ++- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 ++-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 ++-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 ++-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +-- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 164 files changed, 12559 insertions(+), 11067 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/query.dart b/lib/query.dart index 281aa756..c9a2fc91 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if(attribute != null) { + if (attribute != null) { map['attribute'] = attribute; } - - if(values != null) { + + if (values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} \ 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 89246ea7..b1358d47 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,27 +1,26 @@ 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 +29,32 @@ 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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,449 +63,442 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.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); - - final Map apiParams = { - - - }; + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/account/identities/{identityId}'.replaceAll( + '{identityId}', + identityId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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; + 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() async { - final String apiPath = '/account/jwts'; + Future createJWT() async { + final String apiPath = '/account/jwts'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.LogList.fromMap(res.data); - - } + } /// Enable or disable MFA on an account. - Future updateMFA({required bool mfa}) async { - final String apiPath = '/account/mfa'; - - final Map apiParams = { - - 'mfa': 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 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. - Future createMfaAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - - final Map apiParams = { - - - }; + Future createMfaAuthenticator({ + required enums.AuthenticatorType type, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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, - - }; + Future updateMfaAuthenticator({ + required enums.AuthenticatorType type, + required String otp, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - - final Map apiParams = { - - - }; + Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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; + 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. - Future createMfaChallenge({required enums.AuthenticationFactor factor}) async { - final String apiPath = '/account/mfa/challenge'; + Future createMfaChallenge({ + required enums.AuthenticationFactor factor, + }) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = { - - 'factor': factor.value, - - }; + final Map apiParams = {'factor': factor.value}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - Future updateMfaChallenge({required String challengeId, required String otp}) async { - final String apiPath = '/account/mfa/challenge'; + Future updateMfaChallenge({ + required String challengeId, + required String otp, + }) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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. - 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. - Future createMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; - - final Map apiParams = { - - - }; + Future createMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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 apiHeaders = { - 'content-type': 'application/json', + 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 apiParams = {'name': name}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'oldPassword': oldPassword, - + 'oldPassword': oldPassword, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 apiParams = {'prefs': prefs}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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 @@ -512,99 +508,98 @@ 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, + final Map apiParams = {'email': email, 'url': url}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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 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'; - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteSessions() async { + final String apiPath = '/account/sessions'; - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 @@ -613,213 +608,212 @@ 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 apiHeaders = { - 'content-type': 'application/json', + 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 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.') - Future updateMagicURLSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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.') - Future updatePhoneSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + final Map apiParams = {'userId': userId, 'secret': secret}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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); - - final Map apiParams = { - - - }; + Future updateSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 apiHeaders = { - 'content-type': 'application/json', + 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 /// provided user ID has not be registered, a new user will be created. Use the @@ -827,31 +821,34 @@ 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, -'phrase': phrase, - + 'email': email, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 @@ -862,66 +859,79 @@ 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, -'url': url, -'phrase': phrase, - + 'email': email, + 'url': url, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { 'success': success, -'failure': failure, -'scopes': scopes, + 'failure': failure, + 'scopes': scopes, - 'project': client.config['project'], }; 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)); + query.add( + Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item), + ); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -929,15 +939,16 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri(scheme: endpoint.scheme, + Uri url = Uri( + scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&') + 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 @@ -945,30 +956,29 @@ 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, + final Map apiParams = {'userId': userId, 'phone': phone}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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** @@ -979,56 +989,52 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; - - final Map apiParams = { - - 'url': url, - - }; + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 updateVerification({required String userId, required String secret}) async { - final String apiPath = '/account/verification'; + Future updateVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification'; - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; + final Map apiParams = {'userId': userId, 'secret': secret}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -1038,47 +1044,44 @@ 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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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/verification/phone'; + Future updatePhoneVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; + final Map apiParams = {'userId': userId, 'secret': secret}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index a91d6d3f..8033f1cd 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,189 +1,255 @@ 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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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, -'width': width, -'height': height, + 'width': width, + '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 = { 'name': name, -'width': width, -'height': height, -'background': background, + 'width': width, + 'height': height, + '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, -'size': size, -'margin': margin, -'download': download, + 'size': size, + 'margin': margin, + '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 22e279fc..ca557ea5 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1215 +1,1682 @@ 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}) 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, + }) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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.createDatabase` 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.createDatabase` instead.', + ) + Future create({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases'; final Map apiParams = { - 'databaseId': databaseId, -'name': name, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, bool? enabled}) async { - final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDb.update` instead.', + ) + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'collectionId': collectionId, -'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) 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, + required String name, + List? permissions, + bool? documentSecurity, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + @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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + @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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return 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/{key}/relationship'.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/{key}/relationship' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'onDelete': onDelete?.value, -'newKey': newKey, - + 'newKey': newKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - } + } /// 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'documentId': documentId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + final Map apiParams = {'queries': queries}; + + final Map 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, required Map data, List? permissions}) 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, + required Map data, + List? permissions, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - 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; - - } + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'attributes': attributes, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 index by 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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); - - 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; - - } -} \ No newline at end of file + @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 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/functions.dart b/lib/services/functions.dart index 05a7d5f7..e86f1afe 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,256 +1,316 @@ 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}) async { - final String apiPath = '/functions'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? specification}) 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? specification, + }) async { + final String apiPath = '/functions'; final Map apiParams = { - 'functionId': functionId, -'name': name, -'runtime': runtime.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'name': name, + 'runtime': runtime.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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? specification}) 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? specification, + }) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'name': name, -'runtime': runtime?.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'runtime': runtime?.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String functionId}) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateFunctionDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployment'.replaceAll( + '{functionId}', + functionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); + Future listDeployments({ + required String functionId, + List? queries, + String? search, + }) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 = { - 'entrypoint': entrypoint, -'commands': commands, -'code': code, -'activate': activate, - + 'commands': commands, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -265,361 +325,446 @@ 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, -'buildId': buildId, - + 'buildId': buildId, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String functionId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/functions/{functionId}/deployments/template' + .replaceAll('{functionId}', functionId); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll('{functionId}', functionId); + Future createVcsDeployment({ + required String functionId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployments/{deploymentId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 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}) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - - final Map apiParams = { - 'queries': queries, + Future listExecutions({ + required String functionId, + List? queries, + }) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll( + '{functionId}', + functionId, + ); - - }; + final Map apiParams = {'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.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 = { - 'body': body, -'async': xasync, -'path': path, -'method': method?.value, -'headers': headers, -'scheduledAt': scheduledAt, - + 'async': xasync, + 'path': path, + 'method': method?.value, + 'headers': headers, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteExecution({ + required String functionId, + required String executionId, + }) async { + final String apiPath = '/functions/{functionId}/executions/{executionId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{executionId}', executionId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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, + }) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index e2418b52..18eb54f1 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,51 +1,49 @@ 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 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); - - return res.data; + 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 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); - - return res.data; + final res = await client.call( + HttpMethod.post, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/health.dart b/lib/services/health.dart index 0cf64ac6..5250c91d 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,438 +1,414 @@ 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.HealthStatus.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 = { - 'domain': domain, + final Map apiParams = {'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); - - } + } /// 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.HealthStatus.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.HealthStatus.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 = { - 'threshold': threshold, - - - }; + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueCertificates({int? threshold}) async { + final String apiPath = '/health/queue/certificates'; - - }; + final Map apiParams = {'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 = { 'name': name, -'threshold': threshold, - - + '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 = { - 'threshold': threshold, + final Map apiParams = {'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); - - final Map apiParams = { - 'threshold': threshold, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future getFailedJobs({ + required enums.Name name, + int? threshold, + }) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll( + '{name}', + name.value, + ); + + final Map apiParams = {'threshold': threshold}; + + final Map 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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueFunctions({int? threshold}) async { + final String apiPath = '/health/queue/functions'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueStatsResources({int? threshold}) async { + final String apiPath = '/health/queue/stats-resources'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 @@ -441,21 +417,20 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 430a00c3..4d3cc3e0 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,172 +1,164 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 6147b8dc..afe3ee86 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1160 +1,1478 @@ 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}) async { - final String apiPath = '/messaging/messages'; + Future listMessages({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'topics': topics, -'users': users, -'targets': targets, -'cc': cc, -'bcc': bcc, -'attachments': attachments, -'draft': draft, -'html': html, -'scheduledAt': scheduledAt, - + 'subject': subject, + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'cc': cc, + 'bcc': bcc, + 'attachments': attachments, + 'draft': draft, + 'html': html, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'title': title, -'body': body, -'topics': topics, -'users': users, -'targets': targets, -'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.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'title': title, + 'body': body, + 'topics': topics, + 'users': users, + 'targets': targets, + '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.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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'topics': topics, -'users': users, -'targets': targets, -'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'draft': draft, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - /// - 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 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); - - final Map apiParams = { - - - }; + Future delete({required String messageId}) async { + final String apiPath = '/messaging/messages/{messageId}'.replaceAll( + '{messageId}', + messageId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listMessageLogs({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/providers'; + Future listProviders({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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. - 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, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - 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 = { - 'name': name, -'enabled': enabled, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - 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 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. - 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 = { - 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'enabled': enabled, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'enabled': enabled, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, -'enabled': enabled, - + 'name': name, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, - + 'enabled': enabled, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'enabled': enabled, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - 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, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. - 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 = { - 'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, -'from': from, -'customerId': customerId, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'customerId': customerId, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'customerId': customerId, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'customerId': customerId, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'from': from, -'username': username, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'username': username, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'username': username, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'username': username, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'from': from, -'accountSid': accountSid, -'authToken': authToken, -'enabled': enabled, - + 'name': name, + 'from': from, + 'accountSid': accountSid, + 'authToken': authToken, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'accountSid': accountSid, -'authToken': authToken, -'from': from, - + 'enabled': enabled, + 'accountSid': accountSid, + 'authToken': authToken, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'from': from, -'apiKey': apiKey, -'apiSecret': apiSecret, -'enabled': enabled, - + 'name': name, + 'from': from, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'apiSecret': apiSecret, -'from': from, - + 'enabled': enabled, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteProvider({required String providerId}) async { + final String apiPath = '/messaging/providers/{providerId}'.replaceAll( + '{providerId}', + providerId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listProviderLogs({ + required String providerId, + List? queries, + }) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( + '{providerId}', + providerId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); - - final Map apiParams = { - 'queries': queries, + Future listSubscriberLogs({ + required String subscriberId, + List? queries, + }) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs' + .replaceAll('{subscriberId}', subscriberId); - - }; + final Map apiParams = {'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.LogList.fromMap(res.data); - - } + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({List? queries, String? search}) async { - final String apiPath = '/messaging/topics'; + Future listTopics({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'subscribe': subscribe, - + 'name': name, + 'subscribe': subscribe, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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; - - } + return res.data; + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs({required String topicId, List? queries}) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTopicLogs({ + required String topicId, + List? queries, + }) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( + '{topicId}', + topicId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); + Future listSubscribers({ + required String topicId, + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( + '{topicId}', + topicId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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 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); - - 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; - - } -} \ No newline at end of file + 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 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/sites.dart b/lib/services/sites.dart index 5481986e..d89f2192 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,247 +1,296 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.Adapter? adapter, + String? installationId, + String? fallbackFile, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites'; final Map apiParams = { - 'siteId': siteId, -'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime.value, -'adapter': adapter?.value, -'installationId': installationId, -'fallbackFile': fallbackFile, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime.value, + 'adapter': adapter?.value, + 'installationId': installationId, + 'fallbackFile': fallbackFile, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.BuildRuntime? buildRuntime, + enums.Adapter? adapter, + String? fallbackFile, + String? installationId, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime?.value, -'adapter': adapter?.value, -'fallbackFile': fallbackFile, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime?.value, + 'adapter': adapter?.value, + 'fallbackFile': fallbackFile, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + Future delete({required String siteId}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateSiteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployment'.replaceAll( + '{siteId}', + siteId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future listDeployments({ + required String siteId, + List? queries, + String? search, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future createDeployment({ + required String siteId, + required InputFile code, + required bool activate, + String? installCommand, + String? buildCommand, + String? outputDirectory, + Function(UploadProgress)? onProgress, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'code': code, -'activate': activate, - + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -256,331 +305,400 @@ 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, + 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 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String siteId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll('{siteId}', siteId); + Future createVcsDeployment({ + required String siteId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - 'queries': queries, + Future listLogs({ + required String siteId, + List? queries, + }) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll( + '{siteId}', + siteId, + ); - - }; + final Map apiParams = {'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.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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ccdce915..ee630883 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,184 +1,226 @@ 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}) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({ + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { - 'bucketId': bucketId, -'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'name': name, + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) 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, + }) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { - 'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteBucket({required String bucketId}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); + Future listFiles({ + required String bucketId, + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'permissions': permissions, - + 'file': file, + 'permissions': permissions, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -194,137 +236,187 @@ 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 = { - 'name': name, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 = { 'width': width, -'height': height, -'gravity': gravity?.value, -'quality': quality, -'borderWidth': borderWidth, -'borderColor': borderColor, -'borderRadius': borderRadius, -'opacity': opacity, -'rotation': rotation, -'background': background, -'output': output?.value, -'token': token, - - + 'height': height, + 'gravity': gravity?.value, + 'quality': quality, + 'borderWidth': borderWidth, + 'borderColor': borderColor, + 'borderRadius': borderRadius, + 'opacity': opacity, + 'rotation': rotation, + 'background': background, + 'output': output?.value, + '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 = { '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 288d730b..7cf31d00 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1162 +1,1520 @@ 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}) async { - final String apiPath = '/tablesdb'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, required String name, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + Future listTables({ + required String databaseId, + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'tableId': tableId, -'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future updateTable({ + required String databaseId, + required String tableId, + required String name, + List? permissions, + bool? rowSecurity, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteTable({ + required String databaseId, + required String tableId, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listColumns({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - /// - 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); + /// + 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - /// - 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); + /// + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + 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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + 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 apiHeaders = {'content-type': 'application/json'}; + + 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listIndexes({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'columns': columns, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + 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 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); - - 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; - - } + 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 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRow({required String databaseId, required String tableId, required String rowId, required Map data, List? permissions}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'rowId': rowId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + Future createRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - /// - Future upsertRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future upsertRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future updateRows({ + required String databaseId, + required String tableId, + Map? data, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + Future deleteRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future getRow({ + required String databaseId, + required String tableId, + required String rowId, + List? queries, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future upsertRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - 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; - - } + Future deleteRow({ + required String databaseId, + required String tableId, + required String rowId, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future decrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? min, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future incrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? max, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.patch, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); return models.Row.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/teams.dart b/lib/services/teams.dart index c21a93af..5fd59641 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,140 +1,147 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'roles': roles, - + 'name': name, + 'roles': roles, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - 'name': name, + 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 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); + Future listMemberships({ + required String teamId, + List? queries, + String? search, + }) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll( + '{teamId}', + teamId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 @@ -142,182 +149,210 @@ 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 = { - 'email': email, -'userId': userId, -'phone': phone, -'roles': roles, -'url': url, -'name': name, - + 'userId': userId, + 'phone': phone, + 'roles': roles, + 'url': url, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - 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); + /// + 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, + ); 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index cb04449b..4e6915dc 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,109 +1,113 @@ 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}) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future list({ + required String bucketId, + required String fileId, + List? queries, + }) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); + + final Map apiParams = {'queries': queries}; + + final Map 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); - - 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); + 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, + ); 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); - - final Map apiParams = { - - 'expire': expire, + 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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String tokenId}) async { + final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/users.dart b/lib/services/users.dart index e6f80be3..c98182b7 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,314 +1,359 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'password': password, -'name': name, - + 'email': email, + 'phone': phone, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/users/identities'; + Future listIdentities({ + List? queries, + String? search, + }) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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); - - final Map apiParams = { - - - }; + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/users/identities/{identityId}'.replaceAll( + '{identityId}', + identityId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordCpu': passwordCpu, + 'passwordMemory': passwordMemory, + 'passwordParallel': passwordParallel, + 'passwordLength': passwordLength, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordSaltSeparator': passwordSaltSeparator, + 'passwordSignerKey': passwordSignerKey, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'passwordVersion': passwordVersion?.value, -'name': name, - + 'email': email, + 'password': password, + 'passwordVersion': passwordVersion?.value, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -316,648 +361,748 @@ 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); - - final Map apiParams = { - - - }; + Future delete({required String userId}) async { + final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); 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 = { - 'sessionId': sessionId, -'duration': duration, - + 'duration': duration, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// Get the user activity logs list by its unique ID. - Future listLogs({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listLogs({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/logs'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); + Future listMemberships({ + required String userId, + List? queries, + String? search, + }) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll( + '{userId}', + userId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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. - Future updateMfa({required String userId, required bool mfa}) async { - final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); - - final Map apiParams = { - - 'mfa': mfa, - - }; + Future updateMfa({ + required String userId, + required bool mfa, + }) async { + final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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 = { - - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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. - 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. - 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. - Future updateMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; + Future updateMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - Future createMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; + Future createMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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); - - final Map apiParams = { - - - }; + Future createSession({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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 res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// List the messaging targets that are associated with a user. - Future listTargets({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/targets'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, -'providerId': providerId, -'name': name, - + 'providerType': providerType.value, + 'identifier': identifier, + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'identifier': identifier, -'providerId': providerId, -'name': name, - + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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 res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'length': length, -'expire': expire, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future createToken({ + required String userId, + int? length, + int? expire, + }) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'length': length, 'expire': expire}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/src/client.dart b/lib/src/client.dart index 0d9be210..d82d623a 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,7 +81,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 cd82d264..08d93b85 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,21 +2,25 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index ea2cd62a..c961873f 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,14 +9,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => +ClientBase createClient({required String endPoint, required bool selfSigned}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -34,59 +31,66 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format' : '1.8.0', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -135,7 +139,11 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -162,12 +170,19 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index f9e695bf..2bd7d639 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,17 +10,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => - ClientIO( - endPoint: endPoint, - selfSigned: selfSigned, - ); +ClientBase createClient({required String endPoint, required bool selfSigned}) => + ClientIO(endPoint: endPoint, selfSigned: selfSigned); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -43,60 +37,68 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format' : '1.8.0', + 'user-agent': + 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -151,11 +153,16 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, file.path!, - filename: file.filename); + paramName, + file.path!, + filename: file.filename, + ); } else { - 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, @@ -194,12 +201,19 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -244,10 +258,7 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse( - res, - responseType: responseType, - ); + return prepareResponse(res, responseType: responseType); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 658b79b6..06c9ebe3 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest) - .fields - .addAll({"$key[$i]": v.toString()}); + (request as http.MultipartRequest).fields.addAll({ + "$key[$i]": v.toString(), + }); }); } else { - (request as http.MultipartRequest) - .fields - .addAll({key: value.toString()}); + (request as http.MultipartRequest).fields.addAll({ + key: value.toString(), + }); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value){ + params = params.map((key, value) { if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,12 +51,13 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port, + ); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -66,7 +67,9 @@ 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); @@ -113,18 +116,25 @@ 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.dart b/lib/src/enums.dart index 595afdc2..0f250ea3 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes + bytes, } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 2f198d4e..3341912f 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 cd45b6a1..1bae5c8a 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 7d2d7016..42954430 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,18 +1,16 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 af5ebaad..e20f48c6 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,26 +1,24 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index 8d86530d..b101d35f 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({ - required this.value - }); + const IndexType({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/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/name.dart b/lib/src/enums/name.dart index 613bf5f1..74823feb 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,24 +1,22 @@ 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'), - 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'), + 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 076c1c50..383e45b1 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,52 +1,50 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d34440ec..d4fef930 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index 0bf8e2ad..f01fcb01 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({ - required this.value - }); + const VCSDeploymentType({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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index f174d569..4145f701 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 c9f67200..4e901476 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 2fabb416..35c7b767 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index fdcee07a..7d27adba 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index 120723df..fec6f65a 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 504b5f8f..0e80700f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 5f3e1654..bae6618f 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 20dd7189..0ca54691 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a5b27b4f..1df01f19 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 96ce554b..21f8e9a3 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a4953a0e..298c181a 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 03ba94c7..c6eecadd 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8a5aa89d..1ef48332 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 d17f414a..8c8fcb73 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index 4098a5a1..c5fa6adc 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "attributes": attributes, - }; - } + Map toMap() { + return {"total": total, "attributes": attributes}; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 050cbe14..903c6290 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 2202d255..7374fa78 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index 0c3ddf9e..f0bc295e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index 3bb374be..b8fb5e48 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 29c56fe4..9d5b771b 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Buckets List class BucketList implements Model { - /// Total number of buckets rows that matched your query. - final int total; + /// Total number of buckets rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "buckets": buckets.map((p) => p.toMap()).toList(), - }; - } + 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 c55110cf..72de429d 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 81104b31..b5ff3518 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Collections List class CollectionList implements Model { - /// Total number of collections rows that matched your query. - final int total; + /// Total number of collections rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 0ffc8fea..60fcfa48 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 367686d0..c21a2260 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7deb5e26..15d80695 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7bb56922..558b7d43 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c0547e11..3b2f1335 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 acf0f6df..9d637d92 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 66213f0a..7bea7426 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,28 +2,24 @@ part of '../../models.dart'; /// Column Indexes List class ColumnIndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 3823f425..2ba463cd 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 4ac1fa12..6672d7ce 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 475c1c40..8eb0171f 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "columns": columns, - }; - } + Map toMap() { + return {"total": total, "columns": columns}; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index e55d1534..6221c01e 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6fd6a3b0..7b560989 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 94271aa6..66c0ce7b 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 1a9c5038..7318b7ad 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 60b008ef..651b5ae4 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Continents List class ContinentList implements Model { - /// Total number of continents rows that matched your query. - final int total; + /// Total number of continents rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 565b1d66..c52b50f2 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,28 +2,19 @@ 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()); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 3a3acd49..ea839b51 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Countries List class CountryList implements Model { - /// Total number of countries rows that matched your query. - final int total; + /// Total number of countries rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 deafffe3..27eef0c1 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 34274e00..2ff28c61 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Currencies List class CurrencyList implements Model { - /// Total number of currencies rows that matched your query. - final int total; + /// Total number of currencies rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 cab95b02..8d79e052 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 940a9610..01e092f2 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Databases List class DatabaseList implements Model { - /// Total number of databases rows that matched your query. - final int total; + /// Total number of databases rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 ecf7e791..448c62c7 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 7a2a38c2..1ca87150 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Deployments List class DeploymentList implements Model { - /// Total number of deployments rows that matched your query. - final int total; + /// Total number of deployments rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index be424a9c..cf85e457 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 90bce66f..b897a877 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,31 +2,30 @@ part of '../../models.dart'; /// Documents List class DocumentList implements Model { - /// Total number of documents rows that matched your query. - final int total; + /// Total number of documents rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 0cfdbb4e..8618bcd6 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,118 +2,122 @@ 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 upate date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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.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(), - trigger: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "trigger": trigger, - "status": status, - "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 upate date in ISO 8601 format. + final String $updatedAt; + + /// Execution roles. + final List $permissions; + + /// Function ID. + final String functionId; + + /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + final String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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.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(), + trigger: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "trigger": trigger, + "status": status, + "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 c30098a6..583d9fab 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Executions List class ExecutionList implements Model { - /// Total number of executions rows that matched your query. - final int total; + /// Total number of executions rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 de8439ec..a6a9fa46 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 164a281f..e7ca1bd5 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Files List class FileList implements Model { - /// Total number of files rows that matched your query. - final int total; + /// Total number of files rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "files": files.map((p) => p.toMap()).toList(), - }; - } + 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 ea6b601a..693c9b07 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,46 +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))), - ); - } - - 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)), + ), + ); + } + + 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 7614616a..0b908240 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 bd39632e..5661bec4 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Frameworks List class FrameworkList implements Model { - /// Total number of frameworks rows that matched your query. - final int total; + /// Total number of frameworks rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 64401c3f..56c2eded 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index b40dd517..24b199b1 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,28 +2,25 @@ part of '../../models.dart'; /// Functions List class FunctionList implements Model { - /// Total number of functions rows that matched your query. - final int total; + /// Total number of functions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 ecf0a178..463cf696 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "value": value, - }; - } + Map toMap() { + return {"name": name, "value": value}; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index 54c31e70..fa402e97 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "version": version, - "status": status, - }; - } + Map toMap() { + return {"version": version, "status": status}; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index 0a5b6ce9..d412eba9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 95da1235..5f06906b 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,22 +2,16 @@ 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']); + } - Map toMap() { - return { - "size": size, - }; - } + Map toMap() { + return {"size": size}; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 0d6e7216..59b7092c 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,34 +2,26 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "name": name, - "ping": ping, - "status": status, - }; - } + Map toMap() { + return {"name": name, "ping": ping, "status": status}; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index 102dfe77..dec2d54f 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,34 +2,30 @@ 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'], + ); + } - Map toMap() { - return { - "remoteTime": remoteTime, - "localTime": localTime, - "diff": diff, - }; - } + Map toMap() { + return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index c43c4d57..807bdfd0 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 52fa04a6..51ddb64a 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Identities List class IdentityList implements Model { - /// Total number of identities rows that matched your query. - final int total; + /// Total number of identities rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 b6717c4e..9d6d7aec 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 390e9039..65207b94 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Indexes List class IndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 1b4ff7de..490a1824 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "jwt": jwt, - }; - } + Map toMap() { + return {"jwt": jwt}; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 43eaad08..9c45adb1 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,34 +2,26 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - "nativeName": nativeName, - }; - } + 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 755c4e29..76a3f548 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Languages List class LanguageList implements Model { - /// Total number of languages rows that matched your query. - final int total; + /// Total number of languages rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 b5e9ad1a..084475bf 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 10499ef5..cd5a1155 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "name": name, - }; - } + 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 9e1e6034..5fa5c0ce 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Locale codes list class LocaleCodeList implements Model { - /// Total number of localeCodes rows that matched your query. - final int total; + /// Total number of localeCodes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 cb567bd7..7fb3f364 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 636d9166..4a771585 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Logs List class LogList implements Model { - /// Total number of logs rows that matched your query. - final int total; + /// Total number of logs rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "logs": logs.map((p) => p.toMap()).toList(), - }; - } + 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 26610e46..8ee142ad 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index 566afb17..993f7206 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Memberships List class MembershipList implements Model { - /// Total number of memberships rows that matched your query. - final int total; + /// Total number of memberships rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 c4e9e858..9b93b00d 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index c5082c8e..c577ccc1 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Message list class MessageList implements Model { - /// Total number of messages rows that matched your query. - final int total; + /// Total number of messages rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 46c166fb..96bf3c65 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 d49989d8..c930a23e 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 6c8b4e36..63411988 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,22 +2,18 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "recoveryCodes": recoveryCodes, - }; - } + Map toMap() { + return {"recoveryCodes": recoveryCodes}; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index 01cf0857..fa57cb8b 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "secret": secret, - "uri": uri, - }; - } + Map toMap() { + return {"secret": secret, "uri": uri}; + } } 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/phone.dart b/lib/src/models/phone.dart index c8bbb95b..40f7bcd2 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 a40e3591..497aa36c 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Phones List class PhoneList implements Model { - /// Total number of phones rows that matched your query. - final int total; + /// Total number of phones rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "phones": phones.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index edb6083e..7bc3abc9 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,23 +2,17 @@ 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, - ); - } + factory Preferences.fromMap(Map map) { + return Preferences(data: map); + } - Map toMap() { - return { - "data": data, - }; - } + 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/provider.dart b/lib/src/models/provider.dart index 4295c486..1a762f85 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 c71c810d..6d579bd0 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Provider list class ProviderList implements Model { - /// Total number of providers rows that matched your query. - final int total; + /// Total number of providers rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index ed520cc4..dad35dcc 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 3c2d985f..fcbcbc3a 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,28 +2,24 @@ part of '../../models.dart'; /// Resource Tokens List class ResourceTokenList implements Model { - /// Total number of tokens rows that matched your query. - final int total; + /// Total number of tokens rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "tokens": tokens.map((p) => p.toMap()).toList(), - }; - } + 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 62e69e5b..3700e577 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 42bdbfea..ae3f851d 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,31 +2,25 @@ part of '../../models.dart'; /// Rows List class RowList implements Model { - /// Total number of rows rows that matched your query. - final int total; + /// Total number of rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "rows": rows.map((p) => p.toMap()).toList(), - }; - } + 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 35f82cfa..7c9677d8 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 e574c63c..b93dbb8f 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Runtimes List class RuntimeList implements Model { - /// Total number of runtimes rows that matched your query. - final int total; + /// Total number of runtimes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 3a1d955f..d2fe4f64 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 160cb789..563b04a4 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Sessions List class SessionList implements Model { - /// Total number of sessions rows that matched your query. - final int total; + /// Total number of sessions rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 5cda6acc..1449f8bd 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index 3164546a..eb1a5457 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Sites List class SiteList implements Model { - /// Total number of sites rows that matched your query. - final int total; + /// Total number of sites rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "sites": sites.map((p) => p.toMap()).toList(), - }; - } + 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 e49d399c..e8fb8c75 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,40 +2,35 @@ 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(), + ); + } - Map toMap() { - return { - "memory": memory, - "cpus": cpus, - "enabled": enabled, - "slug": slug, - }; - } + 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 040dbcc7..9a7d0154 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Specifications List class SpecificationList implements Model { - /// Total number of specifications rows that matched your query. - final int total; + /// Total number of specifications rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 36e18a7e..0c926297 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 20ce6ca5..d5c6c01d 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Subscriber list class SubscriberList implements Model { - /// Total number of subscribers rows that matched your query. - final int total; + /// Total number of subscribers rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 1c5b88fb..7ce86b9d 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,76 +2,78 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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)), + ), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 2c285e55..7398c48f 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Tables List class TableList implements Model { - /// Total number of tables rows that matched your query. - final int total; + /// Total number of tables rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "tables": tables.map((p) => p.toMap()).toList(), - }; - } + 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 f2b3b6b4..4be8b545 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 c3c250a5..29667c94 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Target list class TargetList implements Model { - /// Total number of targets rows that matched your query. - final int total; + /// Total number of targets rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "targets": targets.map((p) => p.toMap()).toList(), - }; - } + 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 e9058b5b..43df33a8 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 3b8547ca..b70f12c1 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Teams List class TeamList implements Model { - /// Total number of teams rows that matched your query. - final int total; + /// Total number of teams rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "teams": teams.map((p) => p.toMap()).toList(), - }; - } + 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 4f6b8454..35115467 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 461d5694..430d44ac 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 1c0fdb32..69a17ebc 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Topic list class TopicList implements Model { - /// Total number of topics rows that matched your query. - final int total; + /// Total number of topics rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "topics": topics.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index effc397c..50bfb3ce 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 75b8f53b..56cc1b5b 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Users List class UserList implements Model { - /// Total number of users rows that matched your query. - final int total; + /// Total number of users rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "users": users.map((p) => p.toMap()).toList(), - }; - } + 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 58882a9f..2a8e276a 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 da6e6982..cd90d85f 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Variables List class VariableList implements Model { - /// Total number of variables rows that matched your query. - final int total; + /// Total number of variables rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } From ae4eb5ffc5f469ec1e27029d27c1afcf1894d1dc Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 20 Aug 2025 18:29:17 +1200 Subject: [PATCH 05/22] Add 1.8.x support --- CHANGELOG.md | 28 +- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1191 ++++++----- lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 +++++++------------ lib/services/functions.dart | 869 ++++---- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 ++--- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 1852 +++++++---------- lib/services/sites.dart | 822 ++++---- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 +++++++--------- lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1349 ++++++------ lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 232 +-- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 ++-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 ++-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 ++-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +-- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 165 files changed, 11081 insertions(+), 12573 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 392eaf2b..9a0b94a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,23 +3,23 @@ ## 17.0.0 * Support for Appwrite 1.8 -* Add TablesDB service -* Add new query types: - * `notContains` - * `notSearch` - * `notBetween` - * `notStartsWith` - * `notEndsWith` - * `createdBefore` - * `createdAfter` - * `updatedBefore` - * `updatedAfter` +* Added TablesDB service +* Added new query types: + * `notContains` + * `notSearch` + * `notBetween` + * `notStartsWith` + * `notEndsWith` + * `createdBefore` + * `createdAfter` + * `updatedBefore` + * `updatedAfter` * Deprecated `updateMagicURLSession` * Deprecated `updatePhoneSession` * Deprecated Databases service -> The TablesDB service is the new recommended way to work with databases. -> Existing databases/collections can be managed using the TablesDB service. -> Existing Databases service will continue to work, but new features will only be added to the TablesDB service. +> The TablesDB service is the new recommended way to work with databases. +> Existing databases/collections/attributes/documents can be managed using the TablesDB service. +> Existing Databases service will continue to work, but new features may only be added to the TablesDB service. ## 16.2.0 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/query.dart b/lib/query.dart index c9a2fc91..281aa756 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if (attribute != null) { + if(attribute != null) { map['attribute'] = attribute; } - - if (values != null) { + + if(values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} +} \ 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 b1358d47..89246ea7 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,26 +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 @@ -29,32 +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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -63,442 +60,449 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 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; - 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() async { - final String apiPath = '/account/jwts'; + Future createJWT() async { + final String apiPath = '/account/jwts'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 apiParams = {'mfa': mfa}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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 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. - 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 apiParams = { + + 'otp': otp, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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. - Future createMfaChallenge({ - required enums.AuthenticationFactor factor, - }) async { - final String apiPath = '/account/mfa/challenge'; + Future createMfaChallenge({required enums.AuthenticationFactor factor}) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = {'factor': factor.value}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - Future updateMfaChallenge({ - required String challengeId, - required String otp, - }) async { - final String apiPath = '/account/mfa/challenge'; + Future updateMfaChallenge({required String challengeId, required String otp}) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { + 'challengeId': challengeId, - 'otp': otp, +'otp': otp, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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. - 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. - 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 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. - 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 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 apiParams = { + + 'name': name, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'oldPassword': oldPassword, +'oldPassword': oldPassword, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 apiParams = { + + 'prefs': prefs, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 @@ -508,98 +512,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}; + final Map apiParams = { + + 'email': email, +'url': url, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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; - } + 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 @@ -608,212 +613,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 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 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.') - Future updateMagicURLSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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.') - Future updatePhoneSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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; - } + 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 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 /// provided user ID has not be registered, a new user will be created. Use the @@ -821,34 +827,31 @@ 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, - 'phrase': phrase, +'email': email, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -859,79 +862,66 @@ 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, - 'url': url, - 'phrase': phrase, +'email': email, +'url': url, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { 'success': success, - 'failure': failure, - 'scopes': scopes, +'failure': failure, +'scopes': scopes, + 'project': client.config['project'], }; 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), - ); + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -939,16 +929,15 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri( - scheme: endpoint.scheme, + Uri url = Uri(scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&'), + 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 @@ -956,29 +945,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}; + final Map apiParams = { + + 'userId': userId, +'phone': phone, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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** @@ -989,52 +979,56 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'url': url}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 updateVerification({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/verification'; + Future updateVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 @@ -1044,44 +1038,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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/verification/phone'; + Future updatePhoneVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index 8033f1cd..a91d6d3f 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,255 +1,189 @@ 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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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, - 'width': width, - 'height': height, +'width': width, +'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 = { 'name': name, - 'width': width, - 'height': height, - 'background': background, +'width': width, +'height': height, +'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, - 'size': size, - 'margin': margin, - 'download': download, +'size': size, +'margin': margin, +'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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/databases.dart b/lib/services/databases.dart index ca557ea5..22e279fc 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1682 +1,1215 @@ 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, - }) 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}) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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.createDatabase` 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.createDatabase` instead.') + Future create({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases'; final Map apiParams = { + 'databaseId': databaseId, - 'name': name, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/databases/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDb.update` instead.') + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'collectionId': collectionId, - 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - List? permissions, - bool? documentSecurity, - bool? enabled, - }) 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + @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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + @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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return 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/{key}/relationship' - .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/{key}/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'onDelete': onDelete?.value, - 'newKey': newKey, +'newKey': newKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'documentId': documentId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - required Map data, - List? permissions, - }) 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, required Map data, List? permissions}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - 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; - } + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'attributes': attributes, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 index by 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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); - - 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; - } -} + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/functions.dart b/lib/services/functions.dart index e86f1afe..05a7d5f7 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,316 +1,256 @@ 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, - }) async { - final String apiPath = '/functions'; + Future list({List? queries, String? search}) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? specification, - }) 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? specification}) async { + final String apiPath = '/functions'; final Map apiParams = { + 'functionId': functionId, - 'name': name, - 'runtime': runtime.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'name': name, +'runtime': runtime.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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? specification, - }) 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? specification}) async { + final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'name': name, - 'runtime': runtime?.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'runtime': runtime?.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll( - '{functionId}', - functionId, - ); + Future listDeployments({required String functionId, List? queries, String? search}) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 = { + 'entrypoint': entrypoint, - 'commands': commands, - 'code': code, - 'activate': activate, +'commands': commands, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -325,446 +265,361 @@ 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, - 'buildId': buildId, +'buildId': buildId, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String functionId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/functions/{functionId}/deployments/template'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll( - '{functionId}', - functionId, - ); + Future createVcsDeployment({required String functionId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll( - '{functionId}', - functionId, - ); + Future listExecutions({required String functionId, List? queries}) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 = { + 'body': body, - 'async': xasync, - 'path': path, - 'method': method?.value, - 'headers': headers, - 'scheduledAt': scheduledAt, +'async': xasync, +'path': path, +'method': method?.value, +'headers': headers, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index 18eb54f1..e2418b52 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,49 +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 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; - 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 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/health.dart b/lib/services/health.dart index 5250c91d..0cf64ac6 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,414 +1,438 @@ 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.HealthStatus.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 = {'domain': domain}; + final Map apiParams = { + 'domain': domain, - 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.HealthCertificate.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.HealthStatus.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.HealthStatus.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = { + 'threshold': threshold, - final Map apiParams = {'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 = { 'name': name, - 'threshold': threshold, +'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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, - ); - - final Map apiParams = {'threshold': threshold}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future getFailedJobs({required enums.Name name, int? threshold}) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll('{name}', name.value); + + final Map apiParams = { + 'threshold': threshold, + + + }; + + final Map 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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 @@ -417,20 +441,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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 4d3cc3e0..430a00c3 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,164 +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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index afe3ee86..6147b8dc 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1478 +1,1160 @@ 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, - }) async { - final String apiPath = '/messaging/messages'; + Future listMessages({List? queries, String? search}) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'cc': cc, - 'bcc': bcc, - 'attachments': attachments, - 'draft': draft, - 'html': html, - 'scheduledAt': scheduledAt, +'subject': subject, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'cc': cc, +'bcc': bcc, +'attachments': attachments, +'draft': draft, +'html': html, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'title': title, - 'body': body, - 'topics': topics, - 'users': users, - 'targets': targets, - '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.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'title': title, +'body': body, +'topics': topics, +'users': users, +'targets': targets, +'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.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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'draft': draft, - 'scheduledAt': scheduledAt, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'draft': draft, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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 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 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; - return res.data; - } + } /// Get the message activity logs listed by its unique ID. - Future listMessageLogs({ - required String messageId, - List? queries, - }) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listMessageLogs({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/providers'; + Future listProviders({List? queries, String? search}) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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. - 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, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, - 'enabled': enabled, +'name': name, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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 = { + 'name': name, - 'enabled': enabled, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, +'enabled': enabled, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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 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. - 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 = { + 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'enabled': enabled, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'enabled': enabled, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, - 'enabled': enabled, +'name': name, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, +'enabled': enabled, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'enabled': enabled, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - 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 = { + 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'from': from, - 'customerId': customerId, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'customerId': customerId, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'customerId': customerId, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'customerId': customerId, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'username': username, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'username': username, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'username': username, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'username': username, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'accountSid': accountSid, - 'authToken': authToken, - 'enabled': enabled, +'name': name, +'from': from, +'accountSid': accountSid, +'authToken': authToken, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'accountSid': accountSid, - 'authToken': authToken, - 'from': from, +'enabled': enabled, +'accountSid': accountSid, +'authToken': authToken, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'enabled': enabled, +'name': name, +'from': from, +'apiKey': apiKey, +'apiSecret': apiSecret, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'from': from, +'enabled': enabled, +'apiKey': apiKey, +'apiSecret': apiSecret, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } + } /// Get the provider activity logs listed by its unique ID. - Future listProviderLogs({ - required String providerId, - List? queries, - }) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( - '{providerId}', - providerId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listProviderLogs({required String providerId, List? queries}) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs' - .replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs({required String subscriberId, List? queries}) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); + + final Map apiParams = { + 'queries': queries, - final Map apiParams = {'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.LogList.fromMap(res.data); - } + + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({ - List? queries, - String? search, - }) async { - final String apiPath = '/messaging/topics'; + Future listTopics({List? queries, String? search}) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'subscribe': subscribe, +'name': name, +'subscribe': subscribe, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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; - } + return res.data; + + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs({ - required String topicId, - List? queries, - }) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( - '{topicId}', - topicId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTopicLogs({required String topicId, List? queries}) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( - '{topicId}', - topicId, - ); + Future listSubscribers({required String topicId, List? queries, String? search}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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 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); - - 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; - } -} + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/sites.dart b/lib/services/sites.dart index d89f2192..5481986e 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,296 +1,247 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? outputDirectory, - enums.Adapter? adapter, - String? installationId, - String? fallbackFile, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites'; final Map apiParams = { + 'siteId': siteId, - 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime.value, - 'adapter': adapter?.value, - 'installationId': installationId, - 'fallbackFile': fallbackFile, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime.value, +'adapter': adapter?.value, +'installationId': installationId, +'fallbackFile': fallbackFile, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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? outputDirectory, - enums.BuildRuntime? buildRuntime, - enums.Adapter? adapter, - String? fallbackFile, - String? installationId, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime?.value, - 'adapter': adapter?.value, - 'fallbackFile': fallbackFile, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime?.value, +'adapter': adapter?.value, +'fallbackFile': fallbackFile, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future listDeployments({required String siteId, List? queries, String? search}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({ - required String siteId, - required InputFile code, - required bool activate, - String? installCommand, - String? buildCommand, - String? outputDirectory, - Function(UploadProgress)? onProgress, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'code': code, - 'activate': activate, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -305,400 +256,331 @@ 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String siteId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll( - '{siteId}', - siteId, - ); + Future createVcsDeployment({required String siteId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll( - '{siteId}', - siteId, - ); + Future listLogs({required String siteId, List? queries}) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ee630883..ccdce915 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,226 +1,184 @@ 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, - }) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({List? queries, String? search}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { + 'bucketId': bucketId, - 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'name': name, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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, - }) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( - '{bucketId}', - bucketId, - ); + Future listFiles({required String bucketId, List? queries, String? search}) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'permissions': permissions, +'file': file, +'permissions': permissions, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -236,187 +194,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 = { + 'name': name, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 = { 'width': width, - 'height': height, - 'gravity': gravity?.value, - 'quality': quality, - 'borderWidth': borderWidth, - 'borderColor': borderColor, - 'borderRadius': borderRadius, - 'opacity': opacity, - 'rotation': rotation, - 'background': background, - 'output': output?.value, - 'token': token, - +'height': height, +'gravity': gravity?.value, +'quality': quality, +'borderWidth': borderWidth, +'borderColor': borderColor, +'borderRadius': borderRadius, +'opacity': opacity, +'rotation': rotation, +'background': background, +'output': output?.value, +'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 = { '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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 7cf31d00..288d730b 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1520 +1,1162 @@ 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, - }) async { - final String apiPath = '/tablesdb'; + Future list({List? queries, String? search}) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( - '{databaseId}', - databaseId, - ); + Future listTables({required String databaseId, List? queries, String? search}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createTable({ - required String databaseId, - required String tableId, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'tableId': tableId, - 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future updateTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - return res.data; - } + } /// List columns in the table. - Future listColumns({ - required String databaseId, - required String tableId, - List? queries, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listColumns({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + 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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listIndexes({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'columns': columns, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + 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 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); - - 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; - } + 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 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRow({ - required String databaseId, - required String tableId, - required String rowId, - required Map data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'rowId': rowId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future createRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - /// - Future upsertRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future upsertRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future updateRows({required String databaseId, required String tableId, Map? data, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future deleteRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future getRow({required String databaseId, required String tableId, required String rowId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future upsertRow({ - required String databaseId, - required String tableId, - required String rowId, - Map? data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - 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; - } + Future deleteRow({required String databaseId, required String tableId, required String rowId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future decrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? min}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future incrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? max}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/teams.dart b/lib/services/teams.dart index 5fd59641..c21a93af 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,147 +1,140 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'roles': roles, +'name': name, +'roles': roles, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiParams = {'name': name}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - 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, - }) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll( - '{teamId}', - teamId, - ); + Future listMemberships({required String teamId, List? queries, String? search}) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 @@ -149,210 +142,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 = { + 'email': email, - 'userId': userId, - 'phone': phone, - 'roles': roles, - 'url': url, - 'name': name, +'userId': userId, +'phone': phone, +'roles': roles, +'url': url, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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, - ); + /// + 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); 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 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; - 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); - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index 4e6915dc..cb04449b 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,113 +1,109 @@ 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, - }) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future list({required String bucketId, required String fileId, List? queries}) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); - - 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, - ); + 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); 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 apiParams = {'expire': expire}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/users.dart b/lib/services/users.dart index c98182b7..e6f80be3 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,359 +1,314 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'password': password, - 'name': name, +'email': email, +'phone': phone, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = '/users/identities'; + Future listIdentities({List? queries, String? search}) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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; - 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordCpu': passwordCpu, +'passwordMemory': passwordMemory, +'passwordParallel': passwordParallel, +'passwordLength': passwordLength, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordSaltSeparator': passwordSaltSeparator, +'passwordSignerKey': passwordSignerKey, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'passwordVersion': passwordVersion?.value, - 'name': name, +'email': email, +'password': password, +'passwordVersion': passwordVersion?.value, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -361,748 +316,648 @@ 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 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; - 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, - ); - - 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, - ); + 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); 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 = { + 'sessionId': sessionId, - 'duration': duration, +'duration': duration, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// Get the user activity logs list by its unique ID. - Future listLogs({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/logs'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listLogs({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll( - '{userId}', - userId, - ); + Future listMemberships({required String userId, List? queries, String? search}) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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. - 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 apiParams = {'mfa': mfa}; + final Map apiHeaders = { + 'content-type': 'application/json', - 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. - 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 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; - return 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. - 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. - 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 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. - 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 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } + + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll( - '{userId}', - userId, - ); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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 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 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; - 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 apiHeaders = { + 'content-type': 'application/json', - 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; - 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// List the messaging targets that are associated with a user. - Future listTargets({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/targets'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - 'providerId': providerId, - 'name': name, +'providerType': providerType.value, +'identifier': identifier, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'identifier': identifier, - 'providerId': providerId, - 'name': name, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - 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, - ); - - final Map apiParams = {'length': length, 'expire': expire}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future createToken({required String userId, int? length, int? expire}) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll('{userId}', userId); + + final Map apiParams = { + + 'length': length, +'expire': expire, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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); - } -} + + } +} \ No newline at end of file diff --git a/lib/src/client.dart b/lib/src/client.dart index d82d623a..0d9be210 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,8 +81,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 08d93b85..cd82d264 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,25 +2,21 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index c961873f..ea2cd62a 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,11 +9,14 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -31,66 +34,59 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format': '1.8.0', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -139,11 +135,7 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -170,19 +162,12 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 2bd7d639..f9e695bf 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,11 +10,17 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => - ClientIO(endPoint: endPoint, selfSigned: selfSigned); +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => + ClientIO( + endPoint: endPoint, + selfSigned: selfSigned, + ); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -37,68 +43,60 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent': - 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format': '1.8.0', + 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -153,16 +151,11 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, - file.path!, - filename: file.filename, - ); + paramName, file.path!, + filename: file.filename); } else { - 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, @@ -201,19 +194,12 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -258,7 +244,10 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse(res, responseType: responseType); + return prepareResponse( + res, + responseType: responseType, + ); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 06c9ebe3..658b79b6 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest).fields.addAll({ - "$key[$i]": v.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({"$key[$i]": v.toString()}); }); } else { - (request as http.MultipartRequest).fields.addAll({ - key: value.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({key: value.toString()}); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value) { + params = params.map((key, value){ if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,13 +51,12 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port, - ); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -67,9 +66,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); @@ -116,25 +113,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.dart b/lib/src/enums.dart index 0f250ea3..595afdc2 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes, + bytes } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 3341912f..2f198d4e 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 1bae5c8a..cd45b6a1 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 42954430..7d2d7016 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,16 +1,18 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 e20f48c6..af5ebaad 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,24 +1,26 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index b101d35f..8d86530d 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({required this.value}); + const IndexType({ + 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/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/name.dart b/lib/src/enums/name.dart index 74823feb..613bf5f1 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,22 +1,24 @@ 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'), - 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'), + 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 383e45b1..076c1c50 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,50 +1,52 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d4fef930..d34440ec 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index f01fcb01..0bf8e2ad 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({required this.value}); + const VCSDeploymentType({ + 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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index 4145f701..f174d569 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 4e901476..c9f67200 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 35c7b767..2fabb416 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index 7d27adba..fdcee07a 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index fec6f65a..120723df 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 0e80700f..504b5f8f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 bae6618f..5f3e1654 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 0ca54691..20dd7189 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1df01f19..a5b27b4f 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 21f8e9a3..96ce554b 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 298c181a..a4953a0e 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c6eecadd..03ba94c7 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1ef48332..8a5aa89d 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8c8fcb73..d17f414a 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index c5fa6adc..4098a5a1 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "attributes": attributes}; - } + Map toMap() { + return { + "total": total, + "attributes": attributes, + }; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 903c6290..050cbe14 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7374fa78..2202d255 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index f0bc295e..0c3ddf9e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index b8fb5e48..3bb374be 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 9d5b771b..29c56fe4 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Buckets List class BucketList implements Model { - /// Total number of buckets rows that matched your query. - final int total; + /// Total number of buckets rows 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))), + ); + } - Map toMap() { - return {"total": total, "buckets": buckets.map((p) => p.toMap()).toList()}; - } + 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 72de429d..c55110cf 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index b5ff3518..81104b31 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Collections List class CollectionList implements Model { - /// Total number of collections rows that matched your query. - final int total; + /// Total number of collections rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 60fcfa48..0ffc8fea 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c21a2260..367686d0 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 15d80695..7deb5e26 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 558b7d43..7bb56922 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 3b2f1335..c0547e11 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 9d637d92..acf0f6df 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 7bea7426..66213f0a 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,24 +2,28 @@ part of '../../models.dart'; /// Column Indexes List class ColumnIndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 2ba463cd..3823f425 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6672d7ce..4ac1fa12 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 8eb0171f..475c1c40 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "columns": columns}; - } + Map toMap() { + return { + "total": total, + "columns": columns, + }; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index 6221c01e..e55d1534 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7b560989..6fd6a3b0 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 66c0ce7b..94271aa6 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 7318b7ad..1a9c5038 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 651b5ae4..60b008ef 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Continents List class ContinentList implements Model { - /// Total number of continents rows that matched your query. - final int total; + /// Total number of continents rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 c52b50f2..565b1d66 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,19 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index ea839b51..3a3acd49 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Countries List class CountryList implements Model { - /// Total number of countries rows that matched your query. - final int total; + /// Total number of countries rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 27eef0c1..deafffe3 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 2ff28c61..34274e00 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Currencies List class CurrencyList implements Model { - /// Total number of currencies rows that matched your query. - final int total; + /// Total number of currencies rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 8d79e052..cab95b02 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 01e092f2..940a9610 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Databases List class DatabaseList implements Model { - /// Total number of databases rows that matched your query. - final int total; + /// Total number of databases rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 448c62c7..ecf7e791 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 1ca87150..7a2a38c2 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Deployments List class DeploymentList implements Model { - /// Total number of deployments rows that matched your query. - final int total; + /// Total number of deployments rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index cf85e457..be424a9c 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 b897a877..90bce66f 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,30 +2,31 @@ part of '../../models.dart'; /// Documents List class DocumentList implements Model { - /// Total number of documents rows that matched your query. - final int total; + /// Total number of documents rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 8618bcd6..0cfdbb4e 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,122 +2,118 @@ 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 upate date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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.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(), - trigger: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "trigger": trigger, - "status": status, - "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 upate date in ISO 8601 format. + final String $updatedAt; + + /// Execution roles. + final List $permissions; + + /// Function ID. + final String functionId; + + /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + final String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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.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(), + trigger: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "trigger": trigger, + "status": status, + "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 583d9fab..c30098a6 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Executions List class ExecutionList implements Model { - /// Total number of executions rows that matched your query. - final int total; + /// Total number of executions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 a6a9fa46..de8439ec 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index e7ca1bd5..164a281f 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Files List class FileList implements Model { - /// Total number of files rows that matched your query. - final int total; + /// Total number of files rows 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))), + ); + } - Map toMap() { - return {"total": total, "files": files.map((p) => p.toMap()).toList()}; - } + 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 693c9b07..ea6b601a 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,48 +2,46 @@ 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)), - ), - ); - } - - 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))), + ); + } + + 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 0b908240..7614616a 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5661bec4..bd39632e 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Frameworks List class FrameworkList implements Model { - /// Total number of frameworks rows that matched your query. - final int total; + /// Total number of frameworks rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 56c2eded..64401c3f 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index 24b199b1..b40dd517 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,25 +2,28 @@ part of '../../models.dart'; /// Functions List class FunctionList implements Model { - /// Total number of functions rows that matched your query. - final int total; + /// Total number of functions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 463cf696..ecf0a178 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "value": value}; - } + Map toMap() { + return { + "name": name, + "value": value, + }; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index fa402e97..54c31e70 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return {"version": version, "status": status}; - } + Map toMap() { + return { + "version": version, + "status": status, + }; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index d412eba9..0a5b6ce9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5f06906b..95da1235 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,16 +2,22 @@ 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'], + ); + } - Map toMap() { - return {"size": size}; - } + Map toMap() { + return { + "size": size, + }; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 59b7092c..0d6e7216 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,26 +2,34 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return {"name": name, "ping": ping, "status": status}; - } + Map toMap() { + return { + "name": name, + "ping": ping, + "status": status, + }; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index dec2d54f..102dfe77 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,30 +2,34 @@ 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'], + ); + } - Map toMap() { - return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; - } + Map toMap() { + return { + "remoteTime": remoteTime, + "localTime": localTime, + "diff": diff, + }; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index 807bdfd0..c43c4d57 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 51ddb64a..52fa04a6 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Identities List class IdentityList implements Model { - /// Total number of identities rows that matched your query. - final int total; + /// Total number of identities rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 9d6d7aec..b6717c4e 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 65207b94..390e9039 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Indexes List class IndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 490a1824..1b4ff7de 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"jwt": jwt}; - } + Map toMap() { + return { + "jwt": jwt, + }; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 9c45adb1..43eaad08 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,26 +2,34 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code, "nativeName": nativeName}; - } + 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 76a3f548..755c4e29 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Languages List class LanguageList implements Model { - /// Total number of languages rows that matched your query. - final int total; + /// Total number of languages rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 084475bf..b5e9ad1a 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 cd5a1155..10499ef5 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"code": code, "name": name}; - } + 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 5fa5c0ce..9e1e6034 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Locale codes list class LocaleCodeList implements Model { - /// Total number of localeCodes rows that matched your query. - final int total; + /// Total number of localeCodes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 7fb3f364..cb567bd7 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 4a771585..636d9166 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Logs List class LogList implements Model { - /// Total number of logs rows that matched your query. - final int total; + /// Total number of logs rows 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))), + ); + } - Map toMap() { - return {"total": total, "logs": logs.map((p) => p.toMap()).toList()}; - } + 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 8ee142ad..26610e46 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index 993f7206..566afb17 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Memberships List class MembershipList implements Model { - /// Total number of memberships rows that matched your query. - final int total; + /// Total number of memberships rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 9b93b00d..c4e9e858 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index c577ccc1..c5082c8e 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Message list class MessageList implements Model { - /// Total number of messages rows that matched your query. - final int total; + /// Total number of messages rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 96bf3c65..46c166fb 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 c930a23e..d49989d8 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 63411988..6c8b4e36 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,18 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"recoveryCodes": recoveryCodes}; - } + Map toMap() { + return { + "recoveryCodes": recoveryCodes, + }; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index fa57cb8b..01cf0857 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"secret": secret, "uri": uri}; - } + Map toMap() { + return { + "secret": secret, + "uri": uri, + }; + } } 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/phone.dart b/lib/src/models/phone.dart index 40f7bcd2..c8bbb95b 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 497aa36c..a40e3591 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Phones List class PhoneList implements Model { - /// Total number of phones rows that matched your query. - final int total; + /// Total number of phones rows 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))), + ); + } - Map toMap() { - return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "phones": phones.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index 7bc3abc9..edb6083e 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,17 +2,23 @@ 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); - } + factory Preferences.fromMap(Map map) { + return Preferences( + data: map, + ); + } - Map toMap() { - return {"data": data}; - } + 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/provider.dart b/lib/src/models/provider.dart index 1a762f85..4295c486 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 6d579bd0..c71c810d 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Provider list class ProviderList implements Model { - /// Total number of providers rows that matched your query. - final int total; + /// Total number of providers rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index dad35dcc..ed520cc4 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 fcbcbc3a..3c2d985f 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,24 +2,28 @@ part of '../../models.dart'; /// Resource Tokens List class ResourceTokenList implements Model { - /// Total number of tokens rows that matched your query. - final int total; + /// Total number of tokens rows 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))), + ); + } - Map toMap() { - return {"total": total, "tokens": tokens.map((p) => p.toMap()).toList()}; - } + 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 3700e577..62e69e5b 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 ae3f851d..42bdbfea 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,25 +2,31 @@ part of '../../models.dart'; /// Rows List class RowList implements Model { - /// Total number of rows rows that matched your query. - final int total; + /// Total number of rows 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))), + ); + } - Map toMap() { - return {"total": total, "rows": rows.map((p) => p.toMap()).toList()}; - } + 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 7c9677d8..35f82cfa 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 b93dbb8f..e574c63c 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Runtimes List class RuntimeList implements Model { - /// Total number of runtimes rows that matched your query. - final int total; + /// Total number of runtimes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 d2fe4f64..3a1d955f 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 563b04a4..160cb789 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Sessions List class SessionList implements Model { - /// Total number of sessions rows that matched your query. - final int total; + /// Total number of sessions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 1449f8bd..5cda6acc 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index eb1a5457..3164546a 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Sites List class SiteList implements Model { - /// Total number of sites rows that matched your query. - final int total; + /// Total number of sites rows 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))), + ); + } - Map toMap() { - return {"total": total, "sites": sites.map((p) => p.toMap()).toList()}; - } + 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 e8fb8c75..e49d399c 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,35 +2,40 @@ 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(), + ); + } - Map toMap() { - return {"memory": memory, "cpus": cpus, "enabled": enabled, "slug": slug}; - } + 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 9a7d0154..040dbcc7 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Specifications List class SpecificationList implements Model { - /// Total number of specifications rows that matched your query. - final int total; + /// Total number of specifications rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 0c926297..36e18a7e 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 d5c6c01d..20ce6ca5 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Subscriber list class SubscriberList implements Model { - /// Total number of subscribers rows that matched your query. - final int total; + /// Total number of subscribers rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 7ce86b9d..1c5b88fb 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,78 +2,76 @@ 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; - 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, - }); + 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, + }); - 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)), - ), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 7398c48f..2c285e55 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Tables List class TableList implements Model { - /// Total number of tables rows that matched your query. - final int total; + /// Total number of tables rows 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))), + ); + } - Map toMap() { - return {"total": total, "tables": tables.map((p) => p.toMap()).toList()}; - } + 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 4be8b545..f2b3b6b4 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 29667c94..c3c250a5 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Target list class TargetList implements Model { - /// Total number of targets rows that matched your query. - final int total; + /// Total number of targets rows 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))), + ); + } - Map toMap() { - return {"total": total, "targets": targets.map((p) => p.toMap()).toList()}; - } + 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 43df33a8..e9058b5b 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 b70f12c1..3b8547ca 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Teams List class TeamList implements Model { - /// Total number of teams rows that matched your query. - final int total; + /// Total number of teams rows 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))), + ); + } - Map toMap() { - return {"total": total, "teams": teams.map((p) => p.toMap()).toList()}; - } + 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 35115467..4f6b8454 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 430d44ac..461d5694 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 69a17ebc..1c0fdb32 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Topic list class TopicList implements Model { - /// Total number of topics rows that matched your query. - final int total; + /// Total number of topics rows 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))), + ); + } - Map toMap() { - return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "topics": topics.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index 50bfb3ce..effc397c 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 56cc1b5b..75b8f53b 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Users List class UserList implements Model { - /// Total number of users rows that matched your query. - final int total; + /// Total number of users rows 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))), + ); + } - Map toMap() { - return {"total": total, "users": users.map((p) => p.toMap()).toList()}; - } + 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 2a8e276a..58882a9f 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 cd90d85f..da6e6982 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Variables List class VariableList implements Model { - /// Total number of variables rows that matched your query. - final int total; + /// Total number of variables rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } From da30c6d4159d53bd85398cbab325f1b16ae5635d Mon Sep 17 00:00:00 2001 From: abnegate Date: Wed, 20 Aug 2025 06:30:28 +0000 Subject: [PATCH 06/22] Commit from GitHub Actions (Format and push) --- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1191 +++++------ lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 ++++++++++++------- lib/services/functions.dart | 869 ++++---- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 +++-- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 1852 ++++++++++------- lib/services/sites.dart | 822 ++++---- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 +++++++++------- lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1349 ++++++------ lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 232 ++- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 ++-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 ++-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 ++-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +-- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 164 files changed, 12559 insertions(+), 11067 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/query.dart b/lib/query.dart index 281aa756..c9a2fc91 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if(attribute != null) { + if (attribute != null) { map['attribute'] = attribute; } - - if(values != null) { + + if (values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} \ 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 89246ea7..b1358d47 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,27 +1,26 @@ 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 +29,32 @@ 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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,449 +63,442 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.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); - - final Map apiParams = { - - - }; + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/account/identities/{identityId}'.replaceAll( + '{identityId}', + identityId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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; + 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() async { - final String apiPath = '/account/jwts'; + Future createJWT() async { + final String apiPath = '/account/jwts'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.LogList.fromMap(res.data); - - } + } /// Enable or disable MFA on an account. - Future updateMFA({required bool mfa}) async { - final String apiPath = '/account/mfa'; - - final Map apiParams = { - - 'mfa': 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 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. - Future createMfaAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - - final Map apiParams = { - - - }; + Future createMfaAuthenticator({ + required enums.AuthenticatorType type, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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, - - }; + Future updateMfaAuthenticator({ + required enums.AuthenticatorType type, + required String otp, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - - final Map apiParams = { - - - }; + Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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; + 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. - Future createMfaChallenge({required enums.AuthenticationFactor factor}) async { - final String apiPath = '/account/mfa/challenge'; + Future createMfaChallenge({ + required enums.AuthenticationFactor factor, + }) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = { - - 'factor': factor.value, - - }; + final Map apiParams = {'factor': factor.value}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - Future updateMfaChallenge({required String challengeId, required String otp}) async { - final String apiPath = '/account/mfa/challenge'; + Future updateMfaChallenge({ + required String challengeId, + required String otp, + }) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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. - 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. - Future createMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; - - final Map apiParams = { - - - }; + Future createMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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 apiHeaders = { - 'content-type': 'application/json', + 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 apiParams = {'name': name}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'oldPassword': oldPassword, - + 'oldPassword': oldPassword, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 apiParams = {'prefs': prefs}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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 @@ -512,99 +508,98 @@ 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, + final Map apiParams = {'email': email, 'url': url}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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 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'; - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteSessions() async { + final String apiPath = '/account/sessions'; - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 @@ -613,213 +608,212 @@ 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 apiHeaders = { - 'content-type': 'application/json', + 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 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.') - Future updateMagicURLSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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.') - Future updatePhoneSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + final Map apiParams = {'userId': userId, 'secret': secret}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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); - - final Map apiParams = { - - - }; + Future updateSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 apiHeaders = { - 'content-type': 'application/json', + 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 /// provided user ID has not be registered, a new user will be created. Use the @@ -827,31 +821,34 @@ 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, -'phrase': phrase, - + 'email': email, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 @@ -862,66 +859,79 @@ 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, -'url': url, -'phrase': phrase, - + 'email': email, + 'url': url, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { 'success': success, -'failure': failure, -'scopes': scopes, + 'failure': failure, + 'scopes': scopes, - 'project': client.config['project'], }; 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)); + query.add( + Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item), + ); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -929,15 +939,16 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri(scheme: endpoint.scheme, + Uri url = Uri( + scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&') + 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 @@ -945,30 +956,29 @@ 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, + final Map apiParams = {'userId': userId, 'phone': phone}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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** @@ -979,56 +989,52 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; - - final Map apiParams = { - - 'url': url, - - }; + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 updateVerification({required String userId, required String secret}) async { - final String apiPath = '/account/verification'; + Future updateVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification'; - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; + final Map apiParams = {'userId': userId, 'secret': secret}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -1038,47 +1044,44 @@ 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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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/verification/phone'; + Future updatePhoneVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; + final Map apiParams = {'userId': userId, 'secret': secret}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index a91d6d3f..8033f1cd 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,189 +1,255 @@ 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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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, -'width': width, -'height': height, + 'width': width, + '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 = { 'name': name, -'width': width, -'height': height, -'background': background, + 'width': width, + 'height': height, + '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, -'size': size, -'margin': margin, -'download': download, + 'size': size, + 'margin': margin, + '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 22e279fc..ca557ea5 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1215 +1,1682 @@ 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}) 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, + }) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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.createDatabase` 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.createDatabase` instead.', + ) + Future create({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases'; final Map apiParams = { - 'databaseId': databaseId, -'name': name, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, bool? enabled}) async { - final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDb.update` instead.', + ) + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'collectionId': collectionId, -'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) 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, + required String name, + List? permissions, + bool? documentSecurity, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + @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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + @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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return 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/{key}/relationship'.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/{key}/relationship' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'onDelete': onDelete?.value, -'newKey': newKey, - + 'newKey': newKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - } + } /// 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'documentId': documentId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + final Map apiParams = {'queries': queries}; + + final Map 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, required Map data, List? permissions}) 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, + required Map data, + List? permissions, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - 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; - - } + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'attributes': attributes, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 index by 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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); - - 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; - - } -} \ No newline at end of file + @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 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/functions.dart b/lib/services/functions.dart index 05a7d5f7..e86f1afe 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,256 +1,316 @@ 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}) async { - final String apiPath = '/functions'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? specification}) 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? specification, + }) async { + final String apiPath = '/functions'; final Map apiParams = { - 'functionId': functionId, -'name': name, -'runtime': runtime.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'name': name, + 'runtime': runtime.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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? specification}) 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? specification, + }) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'name': name, -'runtime': runtime?.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'runtime': runtime?.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String functionId}) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateFunctionDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployment'.replaceAll( + '{functionId}', + functionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); + Future listDeployments({ + required String functionId, + List? queries, + String? search, + }) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 = { - 'entrypoint': entrypoint, -'commands': commands, -'code': code, -'activate': activate, - + 'commands': commands, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -265,361 +325,446 @@ 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, -'buildId': buildId, - + 'buildId': buildId, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String functionId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/functions/{functionId}/deployments/template' + .replaceAll('{functionId}', functionId); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll('{functionId}', functionId); + Future createVcsDeployment({ + required String functionId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployments/{deploymentId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 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}) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - - final Map apiParams = { - 'queries': queries, + Future listExecutions({ + required String functionId, + List? queries, + }) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll( + '{functionId}', + functionId, + ); - - }; + final Map apiParams = {'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.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 = { - 'body': body, -'async': xasync, -'path': path, -'method': method?.value, -'headers': headers, -'scheduledAt': scheduledAt, - + 'async': xasync, + 'path': path, + 'method': method?.value, + 'headers': headers, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteExecution({ + required String functionId, + required String executionId, + }) async { + final String apiPath = '/functions/{functionId}/executions/{executionId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{executionId}', executionId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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, + }) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index e2418b52..18eb54f1 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,51 +1,49 @@ 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 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); - - return res.data; + 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 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); - - return res.data; + final res = await client.call( + HttpMethod.post, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/health.dart b/lib/services/health.dart index 0cf64ac6..5250c91d 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,438 +1,414 @@ 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.HealthStatus.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 = { - 'domain': domain, + final Map apiParams = {'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); - - } + } /// 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.HealthStatus.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.HealthStatus.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 = { - 'threshold': threshold, - - - }; + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueCertificates({int? threshold}) async { + final String apiPath = '/health/queue/certificates'; - - }; + final Map apiParams = {'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 = { 'name': name, -'threshold': threshold, - - + '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 = { - 'threshold': threshold, + final Map apiParams = {'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); - - final Map apiParams = { - 'threshold': threshold, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future getFailedJobs({ + required enums.Name name, + int? threshold, + }) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll( + '{name}', + name.value, + ); + + final Map apiParams = {'threshold': threshold}; + + final Map 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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueFunctions({int? threshold}) async { + final String apiPath = '/health/queue/functions'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueStatsResources({int? threshold}) async { + final String apiPath = '/health/queue/stats-resources'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 @@ -441,21 +417,20 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 430a00c3..4d3cc3e0 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,172 +1,164 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 6147b8dc..afe3ee86 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1160 +1,1478 @@ 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}) async { - final String apiPath = '/messaging/messages'; + Future listMessages({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'topics': topics, -'users': users, -'targets': targets, -'cc': cc, -'bcc': bcc, -'attachments': attachments, -'draft': draft, -'html': html, -'scheduledAt': scheduledAt, - + 'subject': subject, + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'cc': cc, + 'bcc': bcc, + 'attachments': attachments, + 'draft': draft, + 'html': html, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'title': title, -'body': body, -'topics': topics, -'users': users, -'targets': targets, -'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.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'title': title, + 'body': body, + 'topics': topics, + 'users': users, + 'targets': targets, + '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.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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'topics': topics, -'users': users, -'targets': targets, -'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'draft': draft, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - /// - 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 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); - - final Map apiParams = { - - - }; + Future delete({required String messageId}) async { + final String apiPath = '/messaging/messages/{messageId}'.replaceAll( + '{messageId}', + messageId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listMessageLogs({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/providers'; + Future listProviders({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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. - 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, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - 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 = { - 'name': name, -'enabled': enabled, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - 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 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. - 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 = { - 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'enabled': enabled, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'enabled': enabled, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, -'enabled': enabled, - + 'name': name, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, - + 'enabled': enabled, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'enabled': enabled, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - 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, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. - 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 = { - 'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, -'from': from, -'customerId': customerId, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'customerId': customerId, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'customerId': customerId, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'customerId': customerId, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'from': from, -'username': username, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'username': username, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'username': username, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'username': username, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'from': from, -'accountSid': accountSid, -'authToken': authToken, -'enabled': enabled, - + 'name': name, + 'from': from, + 'accountSid': accountSid, + 'authToken': authToken, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'accountSid': accountSid, -'authToken': authToken, -'from': from, - + 'enabled': enabled, + 'accountSid': accountSid, + 'authToken': authToken, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'from': from, -'apiKey': apiKey, -'apiSecret': apiSecret, -'enabled': enabled, - + 'name': name, + 'from': from, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'apiSecret': apiSecret, -'from': from, - + 'enabled': enabled, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteProvider({required String providerId}) async { + final String apiPath = '/messaging/providers/{providerId}'.replaceAll( + '{providerId}', + providerId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listProviderLogs({ + required String providerId, + List? queries, + }) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( + '{providerId}', + providerId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); - - final Map apiParams = { - 'queries': queries, + Future listSubscriberLogs({ + required String subscriberId, + List? queries, + }) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs' + .replaceAll('{subscriberId}', subscriberId); - - }; + final Map apiParams = {'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.LogList.fromMap(res.data); - - } + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({List? queries, String? search}) async { - final String apiPath = '/messaging/topics'; + Future listTopics({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'subscribe': subscribe, - + 'name': name, + 'subscribe': subscribe, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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; - - } + return res.data; + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs({required String topicId, List? queries}) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTopicLogs({ + required String topicId, + List? queries, + }) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( + '{topicId}', + topicId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); + Future listSubscribers({ + required String topicId, + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( + '{topicId}', + topicId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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 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); - - 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; - - } -} \ No newline at end of file + 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 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/sites.dart b/lib/services/sites.dart index 5481986e..d89f2192 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,247 +1,296 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.Adapter? adapter, + String? installationId, + String? fallbackFile, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites'; final Map apiParams = { - 'siteId': siteId, -'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime.value, -'adapter': adapter?.value, -'installationId': installationId, -'fallbackFile': fallbackFile, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime.value, + 'adapter': adapter?.value, + 'installationId': installationId, + 'fallbackFile': fallbackFile, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.BuildRuntime? buildRuntime, + enums.Adapter? adapter, + String? fallbackFile, + String? installationId, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime?.value, -'adapter': adapter?.value, -'fallbackFile': fallbackFile, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime?.value, + 'adapter': adapter?.value, + 'fallbackFile': fallbackFile, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + Future delete({required String siteId}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateSiteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployment'.replaceAll( + '{siteId}', + siteId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future listDeployments({ + required String siteId, + List? queries, + String? search, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future createDeployment({ + required String siteId, + required InputFile code, + required bool activate, + String? installCommand, + String? buildCommand, + String? outputDirectory, + Function(UploadProgress)? onProgress, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'code': code, -'activate': activate, - + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -256,331 +305,400 @@ 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, + 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 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String siteId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll('{siteId}', siteId); + Future createVcsDeployment({ + required String siteId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - 'queries': queries, + Future listLogs({ + required String siteId, + List? queries, + }) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll( + '{siteId}', + siteId, + ); - - }; + final Map apiParams = {'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.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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ccdce915..ee630883 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,184 +1,226 @@ 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}) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({ + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { - 'bucketId': bucketId, -'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'name': name, + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) 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, + }) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { - 'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteBucket({required String bucketId}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); + Future listFiles({ + required String bucketId, + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'permissions': permissions, - + 'file': file, + 'permissions': permissions, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -194,137 +236,187 @@ 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 = { - 'name': name, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 = { 'width': width, -'height': height, -'gravity': gravity?.value, -'quality': quality, -'borderWidth': borderWidth, -'borderColor': borderColor, -'borderRadius': borderRadius, -'opacity': opacity, -'rotation': rotation, -'background': background, -'output': output?.value, -'token': token, - - + 'height': height, + 'gravity': gravity?.value, + 'quality': quality, + 'borderWidth': borderWidth, + 'borderColor': borderColor, + 'borderRadius': borderRadius, + 'opacity': opacity, + 'rotation': rotation, + 'background': background, + 'output': output?.value, + '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 = { '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 288d730b..7cf31d00 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1162 +1,1520 @@ 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}) async { - final String apiPath = '/tablesdb'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, required String name, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + Future listTables({ + required String databaseId, + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'tableId': tableId, -'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future updateTable({ + required String databaseId, + required String tableId, + required String name, + List? permissions, + bool? rowSecurity, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteTable({ + required String databaseId, + required String tableId, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listColumns({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - /// - 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); + /// + 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - /// - 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); + /// + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + 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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + 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 apiHeaders = {'content-type': 'application/json'}; + + 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listIndexes({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'columns': columns, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + 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 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); - - 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; - - } + 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 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRow({required String databaseId, required String tableId, required String rowId, required Map data, List? permissions}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'rowId': rowId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + Future createRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - /// - Future upsertRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future upsertRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future updateRows({ + required String databaseId, + required String tableId, + Map? data, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + Future deleteRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future getRow({ + required String databaseId, + required String tableId, + required String rowId, + List? queries, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future upsertRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - 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; - - } + Future deleteRow({ + required String databaseId, + required String tableId, + required String rowId, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future decrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? min, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future incrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? max, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.patch, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); return models.Row.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/teams.dart b/lib/services/teams.dart index c21a93af..5fd59641 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,140 +1,147 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'roles': roles, - + 'name': name, + 'roles': roles, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - 'name': name, + 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 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); + Future listMemberships({ + required String teamId, + List? queries, + String? search, + }) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll( + '{teamId}', + teamId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 @@ -142,182 +149,210 @@ 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 = { - 'email': email, -'userId': userId, -'phone': phone, -'roles': roles, -'url': url, -'name': name, - + 'userId': userId, + 'phone': phone, + 'roles': roles, + 'url': url, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - 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); + /// + 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, + ); 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index cb04449b..4e6915dc 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,109 +1,113 @@ 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}) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future list({ + required String bucketId, + required String fileId, + List? queries, + }) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); + + final Map apiParams = {'queries': queries}; + + final Map 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); - - 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); + 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, + ); 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); - - final Map apiParams = { - - 'expire': expire, + 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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String tokenId}) async { + final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/users.dart b/lib/services/users.dart index e6f80be3..c98182b7 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,314 +1,359 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'password': password, -'name': name, - + 'email': email, + 'phone': phone, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/users/identities'; + Future listIdentities({ + List? queries, + String? search, + }) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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); - - final Map apiParams = { - - - }; + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/users/identities/{identityId}'.replaceAll( + '{identityId}', + identityId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordCpu': passwordCpu, + 'passwordMemory': passwordMemory, + 'passwordParallel': passwordParallel, + 'passwordLength': passwordLength, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordSaltSeparator': passwordSaltSeparator, + 'passwordSignerKey': passwordSignerKey, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'passwordVersion': passwordVersion?.value, -'name': name, - + 'email': email, + 'password': password, + 'passwordVersion': passwordVersion?.value, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -316,648 +361,748 @@ 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); - - final Map apiParams = { - - - }; + Future delete({required String userId}) async { + final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); 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 = { - 'sessionId': sessionId, -'duration': duration, - + 'duration': duration, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// Get the user activity logs list by its unique ID. - Future listLogs({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listLogs({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/logs'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); + Future listMemberships({ + required String userId, + List? queries, + String? search, + }) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll( + '{userId}', + userId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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. - Future updateMfa({required String userId, required bool mfa}) async { - final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); - - final Map apiParams = { - - 'mfa': mfa, - - }; + Future updateMfa({ + required String userId, + required bool mfa, + }) async { + final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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 = { - - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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. - 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. - 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. - Future updateMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; + Future updateMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - Future createMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; + Future createMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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); - - final Map apiParams = { - - - }; + Future createSession({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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 res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// List the messaging targets that are associated with a user. - Future listTargets({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/targets'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, -'providerId': providerId, -'name': name, - + 'providerType': providerType.value, + 'identifier': identifier, + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'identifier': identifier, -'providerId': providerId, -'name': name, - + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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 res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'length': length, -'expire': expire, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future createToken({ + required String userId, + int? length, + int? expire, + }) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'length': length, 'expire': expire}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/src/client.dart b/lib/src/client.dart index 0d9be210..d82d623a 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,7 +81,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 cd82d264..08d93b85 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,21 +2,25 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index ea2cd62a..c961873f 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,14 +9,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => +ClientBase createClient({required String endPoint, required bool selfSigned}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -34,59 +31,66 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format' : '1.8.0', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -135,7 +139,11 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -162,12 +170,19 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index f9e695bf..2bd7d639 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,17 +10,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => - ClientIO( - endPoint: endPoint, - selfSigned: selfSigned, - ); +ClientBase createClient({required String endPoint, required bool selfSigned}) => + ClientIO(endPoint: endPoint, selfSigned: selfSigned); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -43,60 +37,68 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format' : '1.8.0', + 'user-agent': + 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -151,11 +153,16 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, file.path!, - filename: file.filename); + paramName, + file.path!, + filename: file.filename, + ); } else { - 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, @@ -194,12 +201,19 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -244,10 +258,7 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse( - res, - responseType: responseType, - ); + return prepareResponse(res, responseType: responseType); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 658b79b6..06c9ebe3 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest) - .fields - .addAll({"$key[$i]": v.toString()}); + (request as http.MultipartRequest).fields.addAll({ + "$key[$i]": v.toString(), + }); }); } else { - (request as http.MultipartRequest) - .fields - .addAll({key: value.toString()}); + (request as http.MultipartRequest).fields.addAll({ + key: value.toString(), + }); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value){ + params = params.map((key, value) { if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,12 +51,13 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port, + ); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -66,7 +67,9 @@ 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); @@ -113,18 +116,25 @@ 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.dart b/lib/src/enums.dart index 595afdc2..0f250ea3 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes + bytes, } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 2f198d4e..3341912f 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 cd45b6a1..1bae5c8a 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 7d2d7016..42954430 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,18 +1,16 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 af5ebaad..e20f48c6 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,26 +1,24 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index 8d86530d..b101d35f 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({ - required this.value - }); + const IndexType({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/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/name.dart b/lib/src/enums/name.dart index 613bf5f1..74823feb 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,24 +1,22 @@ 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'), - 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'), + 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 076c1c50..383e45b1 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,52 +1,50 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d34440ec..d4fef930 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index 0bf8e2ad..f01fcb01 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({ - required this.value - }); + const VCSDeploymentType({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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index f174d569..4145f701 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 c9f67200..4e901476 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 2fabb416..35c7b767 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index fdcee07a..7d27adba 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index 120723df..fec6f65a 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 504b5f8f..0e80700f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 5f3e1654..bae6618f 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 20dd7189..0ca54691 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a5b27b4f..1df01f19 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 96ce554b..21f8e9a3 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a4953a0e..298c181a 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 03ba94c7..c6eecadd 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8a5aa89d..1ef48332 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 d17f414a..8c8fcb73 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index 4098a5a1..c5fa6adc 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "attributes": attributes, - }; - } + Map toMap() { + return {"total": total, "attributes": attributes}; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 050cbe14..903c6290 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 2202d255..7374fa78 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index 0c3ddf9e..f0bc295e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index 3bb374be..b8fb5e48 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 29c56fe4..9d5b771b 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Buckets List class BucketList implements Model { - /// Total number of buckets rows that matched your query. - final int total; + /// Total number of buckets rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "buckets": buckets.map((p) => p.toMap()).toList(), - }; - } + 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 c55110cf..72de429d 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 81104b31..b5ff3518 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Collections List class CollectionList implements Model { - /// Total number of collections rows that matched your query. - final int total; + /// Total number of collections rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 0ffc8fea..60fcfa48 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 367686d0..c21a2260 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7deb5e26..15d80695 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7bb56922..558b7d43 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c0547e11..3b2f1335 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 acf0f6df..9d637d92 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 66213f0a..7bea7426 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,28 +2,24 @@ part of '../../models.dart'; /// Column Indexes List class ColumnIndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 3823f425..2ba463cd 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 4ac1fa12..6672d7ce 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 475c1c40..8eb0171f 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "columns": columns, - }; - } + Map toMap() { + return {"total": total, "columns": columns}; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index e55d1534..6221c01e 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6fd6a3b0..7b560989 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 94271aa6..66c0ce7b 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 1a9c5038..7318b7ad 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 60b008ef..651b5ae4 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Continents List class ContinentList implements Model { - /// Total number of continents rows that matched your query. - final int total; + /// Total number of continents rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 565b1d66..c52b50f2 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,28 +2,19 @@ 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()); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 3a3acd49..ea839b51 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Countries List class CountryList implements Model { - /// Total number of countries rows that matched your query. - final int total; + /// Total number of countries rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 deafffe3..27eef0c1 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 34274e00..2ff28c61 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Currencies List class CurrencyList implements Model { - /// Total number of currencies rows that matched your query. - final int total; + /// Total number of currencies rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 cab95b02..8d79e052 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 940a9610..01e092f2 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Databases List class DatabaseList implements Model { - /// Total number of databases rows that matched your query. - final int total; + /// Total number of databases rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 ecf7e791..448c62c7 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 7a2a38c2..1ca87150 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Deployments List class DeploymentList implements Model { - /// Total number of deployments rows that matched your query. - final int total; + /// Total number of deployments rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index be424a9c..cf85e457 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 90bce66f..b897a877 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,31 +2,30 @@ part of '../../models.dart'; /// Documents List class DocumentList implements Model { - /// Total number of documents rows that matched your query. - final int total; + /// Total number of documents rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 0cfdbb4e..8618bcd6 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,118 +2,122 @@ 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 upate date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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.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(), - trigger: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "trigger": trigger, - "status": status, - "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 upate date in ISO 8601 format. + final String $updatedAt; + + /// Execution roles. + final List $permissions; + + /// Function ID. + final String functionId; + + /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + final String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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.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(), + trigger: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "trigger": trigger, + "status": status, + "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 c30098a6..583d9fab 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Executions List class ExecutionList implements Model { - /// Total number of executions rows that matched your query. - final int total; + /// Total number of executions rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 de8439ec..a6a9fa46 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 164a281f..e7ca1bd5 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Files List class FileList implements Model { - /// Total number of files rows that matched your query. - final int total; + /// Total number of files rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "files": files.map((p) => p.toMap()).toList(), - }; - } + 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 ea6b601a..693c9b07 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,46 +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))), - ); - } - - 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)), + ), + ); + } + + 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 7614616a..0b908240 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 bd39632e..5661bec4 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Frameworks List class FrameworkList implements Model { - /// Total number of frameworks rows that matched your query. - final int total; + /// Total number of frameworks rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 64401c3f..56c2eded 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index b40dd517..24b199b1 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,28 +2,25 @@ part of '../../models.dart'; /// Functions List class FunctionList implements Model { - /// Total number of functions rows that matched your query. - final int total; + /// Total number of functions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 ecf0a178..463cf696 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "value": value, - }; - } + Map toMap() { + return {"name": name, "value": value}; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index 54c31e70..fa402e97 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "version": version, - "status": status, - }; - } + Map toMap() { + return {"version": version, "status": status}; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index 0a5b6ce9..d412eba9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 95da1235..5f06906b 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,22 +2,16 @@ 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']); + } - Map toMap() { - return { - "size": size, - }; - } + Map toMap() { + return {"size": size}; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 0d6e7216..59b7092c 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,34 +2,26 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "name": name, - "ping": ping, - "status": status, - }; - } + Map toMap() { + return {"name": name, "ping": ping, "status": status}; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index 102dfe77..dec2d54f 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,34 +2,30 @@ 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'], + ); + } - Map toMap() { - return { - "remoteTime": remoteTime, - "localTime": localTime, - "diff": diff, - }; - } + Map toMap() { + return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index c43c4d57..807bdfd0 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 52fa04a6..51ddb64a 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Identities List class IdentityList implements Model { - /// Total number of identities rows that matched your query. - final int total; + /// Total number of identities rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 b6717c4e..9d6d7aec 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 390e9039..65207b94 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Indexes List class IndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 1b4ff7de..490a1824 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "jwt": jwt, - }; - } + Map toMap() { + return {"jwt": jwt}; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 43eaad08..9c45adb1 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,34 +2,26 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - "nativeName": nativeName, - }; - } + 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 755c4e29..76a3f548 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Languages List class LanguageList implements Model { - /// Total number of languages rows that matched your query. - final int total; + /// Total number of languages rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 b5e9ad1a..084475bf 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 10499ef5..cd5a1155 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "name": name, - }; - } + 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 9e1e6034..5fa5c0ce 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Locale codes list class LocaleCodeList implements Model { - /// Total number of localeCodes rows that matched your query. - final int total; + /// Total number of localeCodes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 cb567bd7..7fb3f364 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 636d9166..4a771585 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Logs List class LogList implements Model { - /// Total number of logs rows that matched your query. - final int total; + /// Total number of logs rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "logs": logs.map((p) => p.toMap()).toList(), - }; - } + 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 26610e46..8ee142ad 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index 566afb17..993f7206 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Memberships List class MembershipList implements Model { - /// Total number of memberships rows that matched your query. - final int total; + /// Total number of memberships rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 c4e9e858..9b93b00d 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index c5082c8e..c577ccc1 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Message list class MessageList implements Model { - /// Total number of messages rows that matched your query. - final int total; + /// Total number of messages rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 46c166fb..96bf3c65 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 d49989d8..c930a23e 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 6c8b4e36..63411988 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,22 +2,18 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "recoveryCodes": recoveryCodes, - }; - } + Map toMap() { + return {"recoveryCodes": recoveryCodes}; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index 01cf0857..fa57cb8b 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "secret": secret, - "uri": uri, - }; - } + Map toMap() { + return {"secret": secret, "uri": uri}; + } } 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/phone.dart b/lib/src/models/phone.dart index c8bbb95b..40f7bcd2 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 a40e3591..497aa36c 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Phones List class PhoneList implements Model { - /// Total number of phones rows that matched your query. - final int total; + /// Total number of phones rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "phones": phones.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index edb6083e..7bc3abc9 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,23 +2,17 @@ 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, - ); - } + factory Preferences.fromMap(Map map) { + return Preferences(data: map); + } - Map toMap() { - return { - "data": data, - }; - } + 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/provider.dart b/lib/src/models/provider.dart index 4295c486..1a762f85 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 c71c810d..6d579bd0 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Provider list class ProviderList implements Model { - /// Total number of providers rows that matched your query. - final int total; + /// Total number of providers rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index ed520cc4..dad35dcc 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 3c2d985f..fcbcbc3a 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,28 +2,24 @@ part of '../../models.dart'; /// Resource Tokens List class ResourceTokenList implements Model { - /// Total number of tokens rows that matched your query. - final int total; + /// Total number of tokens rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "tokens": tokens.map((p) => p.toMap()).toList(), - }; - } + 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 62e69e5b..3700e577 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 42bdbfea..ae3f851d 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,31 +2,25 @@ part of '../../models.dart'; /// Rows List class RowList implements Model { - /// Total number of rows rows that matched your query. - final int total; + /// Total number of rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "rows": rows.map((p) => p.toMap()).toList(), - }; - } + 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 35f82cfa..7c9677d8 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 e574c63c..b93dbb8f 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Runtimes List class RuntimeList implements Model { - /// Total number of runtimes rows that matched your query. - final int total; + /// Total number of runtimes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 3a1d955f..d2fe4f64 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 160cb789..563b04a4 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Sessions List class SessionList implements Model { - /// Total number of sessions rows that matched your query. - final int total; + /// Total number of sessions rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 5cda6acc..1449f8bd 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index 3164546a..eb1a5457 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Sites List class SiteList implements Model { - /// Total number of sites rows that matched your query. - final int total; + /// Total number of sites rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "sites": sites.map((p) => p.toMap()).toList(), - }; - } + 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 e49d399c..e8fb8c75 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,40 +2,35 @@ 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(), + ); + } - Map toMap() { - return { - "memory": memory, - "cpus": cpus, - "enabled": enabled, - "slug": slug, - }; - } + 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 040dbcc7..9a7d0154 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Specifications List class SpecificationList implements Model { - /// Total number of specifications rows that matched your query. - final int total; + /// Total number of specifications rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 36e18a7e..0c926297 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 20ce6ca5..d5c6c01d 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Subscriber list class SubscriberList implements Model { - /// Total number of subscribers rows that matched your query. - final int total; + /// Total number of subscribers rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 1c5b88fb..7ce86b9d 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,76 +2,78 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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)), + ), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 2c285e55..7398c48f 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Tables List class TableList implements Model { - /// Total number of tables rows that matched your query. - final int total; + /// Total number of tables rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "tables": tables.map((p) => p.toMap()).toList(), - }; - } + 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 f2b3b6b4..4be8b545 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 c3c250a5..29667c94 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Target list class TargetList implements Model { - /// Total number of targets rows that matched your query. - final int total; + /// Total number of targets rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "targets": targets.map((p) => p.toMap()).toList(), - }; - } + 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 e9058b5b..43df33a8 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 3b8547ca..b70f12c1 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Teams List class TeamList implements Model { - /// Total number of teams rows that matched your query. - final int total; + /// Total number of teams rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "teams": teams.map((p) => p.toMap()).toList(), - }; - } + 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 4f6b8454..35115467 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 461d5694..430d44ac 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 1c0fdb32..69a17ebc 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Topic list class TopicList implements Model { - /// Total number of topics rows that matched your query. - final int total; + /// Total number of topics rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "topics": topics.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index effc397c..50bfb3ce 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 75b8f53b..56cc1b5b 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Users List class UserList implements Model { - /// Total number of users rows that matched your query. - final int total; + /// Total number of users rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "users": users.map((p) => p.toMap()).toList(), - }; - } + 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 58882a9f..2a8e276a 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 da6e6982..cd90d85f 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Variables List class VariableList implements Model { - /// Total number of variables rows that matched your query. - final int total; + /// Total number of variables rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } From af97ef2d00308f791b3364e317689d6baf0be1d1 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 20 Aug 2025 18:39:33 +1200 Subject: [PATCH 07/22] Update doc --- README.md | 39 +- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1191 ++++++----- lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 +++++++------------ lib/services/functions.dart | 869 ++++---- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 ++--- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 1852 +++++++---------- lib/services/sites.dart | 822 ++++---- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 +++++++--------- lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1349 ++++++------ lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 232 +-- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 ++-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 ++-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 ++-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +-- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 165 files changed, 11082 insertions(+), 12583 deletions(-) diff --git a/README.md b/README.md index bebfe6d2..958295f0 100644 --- a/README.md +++ b/README.md @@ -39,38 +39,29 @@ dart pub add dart_appwrite Once you add the dependencies, its extremely easy to get started with the SDK; All you need to do is import the package in your code, set your Appwrite credentials, and start making API calls. Below is a simple example: ```dart -import 'package:dart_appwrite/dart_appwrite.dart'; - -void main() async { - Client client = Client() - .setEndpoint('http://[HOSTNAME_OR_IP]/v1') // Make sure your endpoint is accessible - .setProject('5ff3379a01d25') // Your project ID - .setKey('cd868c7af8bdc893b4...93b7535db89') - .setSelfSigned(); // Use only on dev mode with a self-signed SSL cert - - Users users = Users(client); - - try { - final user = await users.create(userId: ID.unique(), email: "email@example.com", phone: "+123456789", password: "password", name: "Walter O'Brien"); - print(user.toMap()); - } on AppwriteException catch(e) { - print(e.message); - } -} +Client client = Client() + .setProject('') + .setKey(''); + +Users users = Users(client); + +User user = await users.create( + userId: ID.unique(), + email: 'email@example.com', + phone: '+123456789', + password: 'password', + name: 'Walter O'Brien' +); ``` ### Error handling The Appwrite Dart SDK raises `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching `AppwriteException` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example. ```dart -Users users = Users(client); - try { - final user = await users.create(userId: ID.unique(), email: "email@example.com", phone: "+123456789", password: "password", name: "Walter O'Brien"); - print(user.toMap()); + User user = await users.create(...); } on AppwriteException catch(e) { - //show message to user or do other operation based on error as required - print(e.message); + // Handle the error } ``` 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/query.dart b/lib/query.dart index c9a2fc91..281aa756 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if (attribute != null) { + if(attribute != null) { map['attribute'] = attribute; } - - if (values != null) { + + if(values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} +} \ 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 b1358d47..89246ea7 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,26 +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 @@ -29,32 +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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -63,442 +60,449 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 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; - 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() async { - final String apiPath = '/account/jwts'; + Future createJWT() async { + final String apiPath = '/account/jwts'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 apiParams = {'mfa': mfa}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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 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. - 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 apiParams = { + + 'otp': otp, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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. - Future createMfaChallenge({ - required enums.AuthenticationFactor factor, - }) async { - final String apiPath = '/account/mfa/challenge'; + Future createMfaChallenge({required enums.AuthenticationFactor factor}) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = {'factor': factor.value}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - Future updateMfaChallenge({ - required String challengeId, - required String otp, - }) async { - final String apiPath = '/account/mfa/challenge'; + Future updateMfaChallenge({required String challengeId, required String otp}) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { + 'challengeId': challengeId, - 'otp': otp, +'otp': otp, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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. - 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. - 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 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. - 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 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 apiParams = { + + 'name': name, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'oldPassword': oldPassword, +'oldPassword': oldPassword, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 apiParams = { + + 'prefs': prefs, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 @@ -508,98 +512,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}; + final Map apiParams = { + + 'email': email, +'url': url, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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; - } + 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 @@ -608,212 +613,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 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 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.') - Future updateMagicURLSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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.') - Future updatePhoneSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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; - } + 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 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 /// provided user ID has not be registered, a new user will be created. Use the @@ -821,34 +827,31 @@ 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, - 'phrase': phrase, +'email': email, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -859,79 +862,66 @@ 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, - 'url': url, - 'phrase': phrase, +'email': email, +'url': url, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { 'success': success, - 'failure': failure, - 'scopes': scopes, +'failure': failure, +'scopes': scopes, + 'project': client.config['project'], }; 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), - ); + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -939,16 +929,15 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri( - scheme: endpoint.scheme, + Uri url = Uri(scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&'), + 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 @@ -956,29 +945,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}; + final Map apiParams = { + + 'userId': userId, +'phone': phone, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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** @@ -989,52 +979,56 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'url': url}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 updateVerification({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/verification'; + Future updateVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 @@ -1044,44 +1038,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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/verification/phone'; + Future updatePhoneVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index 8033f1cd..a91d6d3f 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,255 +1,189 @@ 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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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, - 'width': width, - 'height': height, +'width': width, +'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 = { 'name': name, - 'width': width, - 'height': height, - 'background': background, +'width': width, +'height': height, +'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, - 'size': size, - 'margin': margin, - 'download': download, +'size': size, +'margin': margin, +'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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/databases.dart b/lib/services/databases.dart index ca557ea5..22e279fc 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1682 +1,1215 @@ 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, - }) 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}) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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.createDatabase` 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.createDatabase` instead.') + Future create({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases'; final Map apiParams = { + 'databaseId': databaseId, - 'name': name, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/databases/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDb.update` instead.') + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'collectionId': collectionId, - 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - List? permissions, - bool? documentSecurity, - bool? enabled, - }) 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + @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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + @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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return 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/{key}/relationship' - .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/{key}/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'onDelete': onDelete?.value, - 'newKey': newKey, +'newKey': newKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'documentId': documentId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - required Map data, - List? permissions, - }) 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, required Map data, List? permissions}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - 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; - } + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'attributes': attributes, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 index by 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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); - - 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; - } -} + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/functions.dart b/lib/services/functions.dart index e86f1afe..05a7d5f7 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,316 +1,256 @@ 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, - }) async { - final String apiPath = '/functions'; + Future list({List? queries, String? search}) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? specification, - }) 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? specification}) async { + final String apiPath = '/functions'; final Map apiParams = { + 'functionId': functionId, - 'name': name, - 'runtime': runtime.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'name': name, +'runtime': runtime.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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? specification, - }) 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? specification}) async { + final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'name': name, - 'runtime': runtime?.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'runtime': runtime?.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll( - '{functionId}', - functionId, - ); + Future listDeployments({required String functionId, List? queries, String? search}) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 = { + 'entrypoint': entrypoint, - 'commands': commands, - 'code': code, - 'activate': activate, +'commands': commands, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -325,446 +265,361 @@ 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, - 'buildId': buildId, +'buildId': buildId, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String functionId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/functions/{functionId}/deployments/template'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll( - '{functionId}', - functionId, - ); + Future createVcsDeployment({required String functionId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll( - '{functionId}', - functionId, - ); + Future listExecutions({required String functionId, List? queries}) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 = { + 'body': body, - 'async': xasync, - 'path': path, - 'method': method?.value, - 'headers': headers, - 'scheduledAt': scheduledAt, +'async': xasync, +'path': path, +'method': method?.value, +'headers': headers, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index 18eb54f1..e2418b52 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,49 +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 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; - 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 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/health.dart b/lib/services/health.dart index 5250c91d..0cf64ac6 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,414 +1,438 @@ 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.HealthStatus.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 = {'domain': domain}; + final Map apiParams = { + 'domain': domain, - 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.HealthCertificate.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.HealthStatus.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.HealthStatus.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = { + 'threshold': threshold, - final Map apiParams = {'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 = { 'name': name, - 'threshold': threshold, +'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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, - ); - - final Map apiParams = {'threshold': threshold}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future getFailedJobs({required enums.Name name, int? threshold}) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll('{name}', name.value); + + final Map apiParams = { + 'threshold': threshold, + + + }; + + final Map 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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 @@ -417,20 +441,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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 4d3cc3e0..430a00c3 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,164 +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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index afe3ee86..6147b8dc 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1478 +1,1160 @@ 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, - }) async { - final String apiPath = '/messaging/messages'; + Future listMessages({List? queries, String? search}) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'cc': cc, - 'bcc': bcc, - 'attachments': attachments, - 'draft': draft, - 'html': html, - 'scheduledAt': scheduledAt, +'subject': subject, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'cc': cc, +'bcc': bcc, +'attachments': attachments, +'draft': draft, +'html': html, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'title': title, - 'body': body, - 'topics': topics, - 'users': users, - 'targets': targets, - '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.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'title': title, +'body': body, +'topics': topics, +'users': users, +'targets': targets, +'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.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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'draft': draft, - 'scheduledAt': scheduledAt, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'draft': draft, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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 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 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; - return res.data; - } + } /// Get the message activity logs listed by its unique ID. - Future listMessageLogs({ - required String messageId, - List? queries, - }) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listMessageLogs({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/providers'; + Future listProviders({List? queries, String? search}) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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. - 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, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, - 'enabled': enabled, +'name': name, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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 = { + 'name': name, - 'enabled': enabled, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, +'enabled': enabled, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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 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. - 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 = { + 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'enabled': enabled, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'enabled': enabled, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, - 'enabled': enabled, +'name': name, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, +'enabled': enabled, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'enabled': enabled, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - 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 = { + 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'from': from, - 'customerId': customerId, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'customerId': customerId, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'customerId': customerId, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'customerId': customerId, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'username': username, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'username': username, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'username': username, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'username': username, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'accountSid': accountSid, - 'authToken': authToken, - 'enabled': enabled, +'name': name, +'from': from, +'accountSid': accountSid, +'authToken': authToken, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'accountSid': accountSid, - 'authToken': authToken, - 'from': from, +'enabled': enabled, +'accountSid': accountSid, +'authToken': authToken, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'enabled': enabled, +'name': name, +'from': from, +'apiKey': apiKey, +'apiSecret': apiSecret, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'from': from, +'enabled': enabled, +'apiKey': apiKey, +'apiSecret': apiSecret, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } + } /// Get the provider activity logs listed by its unique ID. - Future listProviderLogs({ - required String providerId, - List? queries, - }) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( - '{providerId}', - providerId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listProviderLogs({required String providerId, List? queries}) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs' - .replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs({required String subscriberId, List? queries}) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); + + final Map apiParams = { + 'queries': queries, - final Map apiParams = {'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.LogList.fromMap(res.data); - } + + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({ - List? queries, - String? search, - }) async { - final String apiPath = '/messaging/topics'; + Future listTopics({List? queries, String? search}) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'subscribe': subscribe, +'name': name, +'subscribe': subscribe, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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; - } + return res.data; + + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs({ - required String topicId, - List? queries, - }) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( - '{topicId}', - topicId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTopicLogs({required String topicId, List? queries}) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( - '{topicId}', - topicId, - ); + Future listSubscribers({required String topicId, List? queries, String? search}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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 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); - - 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; - } -} + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/sites.dart b/lib/services/sites.dart index d89f2192..5481986e 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,296 +1,247 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? outputDirectory, - enums.Adapter? adapter, - String? installationId, - String? fallbackFile, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites'; final Map apiParams = { + 'siteId': siteId, - 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime.value, - 'adapter': adapter?.value, - 'installationId': installationId, - 'fallbackFile': fallbackFile, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime.value, +'adapter': adapter?.value, +'installationId': installationId, +'fallbackFile': fallbackFile, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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? outputDirectory, - enums.BuildRuntime? buildRuntime, - enums.Adapter? adapter, - String? fallbackFile, - String? installationId, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime?.value, - 'adapter': adapter?.value, - 'fallbackFile': fallbackFile, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime?.value, +'adapter': adapter?.value, +'fallbackFile': fallbackFile, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future listDeployments({required String siteId, List? queries, String? search}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({ - required String siteId, - required InputFile code, - required bool activate, - String? installCommand, - String? buildCommand, - String? outputDirectory, - Function(UploadProgress)? onProgress, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'code': code, - 'activate': activate, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -305,400 +256,331 @@ 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String siteId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll( - '{siteId}', - siteId, - ); + Future createVcsDeployment({required String siteId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll( - '{siteId}', - siteId, - ); + Future listLogs({required String siteId, List? queries}) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ee630883..ccdce915 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,226 +1,184 @@ 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, - }) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({List? queries, String? search}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { + 'bucketId': bucketId, - 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'name': name, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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, - }) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( - '{bucketId}', - bucketId, - ); + Future listFiles({required String bucketId, List? queries, String? search}) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'permissions': permissions, +'file': file, +'permissions': permissions, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -236,187 +194,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 = { + 'name': name, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 = { 'width': width, - 'height': height, - 'gravity': gravity?.value, - 'quality': quality, - 'borderWidth': borderWidth, - 'borderColor': borderColor, - 'borderRadius': borderRadius, - 'opacity': opacity, - 'rotation': rotation, - 'background': background, - 'output': output?.value, - 'token': token, - +'height': height, +'gravity': gravity?.value, +'quality': quality, +'borderWidth': borderWidth, +'borderColor': borderColor, +'borderRadius': borderRadius, +'opacity': opacity, +'rotation': rotation, +'background': background, +'output': output?.value, +'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 = { '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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 7cf31d00..288d730b 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1520 +1,1162 @@ 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, - }) async { - final String apiPath = '/tablesdb'; + Future list({List? queries, String? search}) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( - '{databaseId}', - databaseId, - ); + Future listTables({required String databaseId, List? queries, String? search}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createTable({ - required String databaseId, - required String tableId, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'tableId': tableId, - 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future updateTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - return res.data; - } + } /// List columns in the table. - Future listColumns({ - required String databaseId, - required String tableId, - List? queries, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listColumns({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + 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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listIndexes({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'columns': columns, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + 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 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); - - 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; - } + 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 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRow({ - required String databaseId, - required String tableId, - required String rowId, - required Map data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'rowId': rowId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future createRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - /// - Future upsertRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future upsertRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future updateRows({required String databaseId, required String tableId, Map? data, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future deleteRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future getRow({required String databaseId, required String tableId, required String rowId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future upsertRow({ - required String databaseId, - required String tableId, - required String rowId, - Map? data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - 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; - } + Future deleteRow({required String databaseId, required String tableId, required String rowId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future decrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? min}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future incrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? max}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/teams.dart b/lib/services/teams.dart index 5fd59641..c21a93af 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,147 +1,140 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'roles': roles, +'name': name, +'roles': roles, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiParams = {'name': name}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - 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, - }) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll( - '{teamId}', - teamId, - ); + Future listMemberships({required String teamId, List? queries, String? search}) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 @@ -149,210 +142,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 = { + 'email': email, - 'userId': userId, - 'phone': phone, - 'roles': roles, - 'url': url, - 'name': name, +'userId': userId, +'phone': phone, +'roles': roles, +'url': url, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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, - ); + /// + 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); 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 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; - 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); - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index 4e6915dc..cb04449b 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,113 +1,109 @@ 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, - }) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future list({required String bucketId, required String fileId, List? queries}) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); - - 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, - ); + 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); 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 apiParams = {'expire': expire}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/users.dart b/lib/services/users.dart index c98182b7..e6f80be3 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,359 +1,314 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'password': password, - 'name': name, +'email': email, +'phone': phone, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = '/users/identities'; + Future listIdentities({List? queries, String? search}) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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; - 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordCpu': passwordCpu, +'passwordMemory': passwordMemory, +'passwordParallel': passwordParallel, +'passwordLength': passwordLength, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordSaltSeparator': passwordSaltSeparator, +'passwordSignerKey': passwordSignerKey, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'passwordVersion': passwordVersion?.value, - 'name': name, +'email': email, +'password': password, +'passwordVersion': passwordVersion?.value, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -361,748 +316,648 @@ 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 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; - 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, - ); - - 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, - ); + 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); 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 = { + 'sessionId': sessionId, - 'duration': duration, +'duration': duration, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// Get the user activity logs list by its unique ID. - Future listLogs({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/logs'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listLogs({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll( - '{userId}', - userId, - ); + Future listMemberships({required String userId, List? queries, String? search}) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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. - 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 apiParams = {'mfa': mfa}; + final Map apiHeaders = { + 'content-type': 'application/json', - 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. - 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 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; - return 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. - 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. - 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 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. - 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 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } + + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll( - '{userId}', - userId, - ); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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 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 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; - 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 apiHeaders = { + 'content-type': 'application/json', - 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; - 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// List the messaging targets that are associated with a user. - Future listTargets({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/targets'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - 'providerId': providerId, - 'name': name, +'providerType': providerType.value, +'identifier': identifier, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'identifier': identifier, - 'providerId': providerId, - 'name': name, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - 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, - ); - - final Map apiParams = {'length': length, 'expire': expire}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future createToken({required String userId, int? length, int? expire}) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll('{userId}', userId); + + final Map apiParams = { + + 'length': length, +'expire': expire, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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); - } -} + + } +} \ No newline at end of file diff --git a/lib/src/client.dart b/lib/src/client.dart index d82d623a..0d9be210 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,8 +81,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 08d93b85..cd82d264 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,25 +2,21 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index c961873f..ea2cd62a 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,11 +9,14 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -31,66 +34,59 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format': '1.8.0', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -139,11 +135,7 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -170,19 +162,12 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 2bd7d639..f9e695bf 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,11 +10,17 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => - ClientIO(endPoint: endPoint, selfSigned: selfSigned); +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => + ClientIO( + endPoint: endPoint, + selfSigned: selfSigned, + ); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -37,68 +43,60 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent': - 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format': '1.8.0', + 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -153,16 +151,11 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, - file.path!, - filename: file.filename, - ); + paramName, file.path!, + filename: file.filename); } else { - 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, @@ -201,19 +194,12 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -258,7 +244,10 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse(res, responseType: responseType); + return prepareResponse( + res, + responseType: responseType, + ); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 06c9ebe3..658b79b6 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest).fields.addAll({ - "$key[$i]": v.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({"$key[$i]": v.toString()}); }); } else { - (request as http.MultipartRequest).fields.addAll({ - key: value.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({key: value.toString()}); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value) { + params = params.map((key, value){ if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,13 +51,12 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port, - ); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -67,9 +66,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); @@ -116,25 +113,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.dart b/lib/src/enums.dart index 0f250ea3..595afdc2 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes, + bytes } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 3341912f..2f198d4e 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 1bae5c8a..cd45b6a1 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 42954430..7d2d7016 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,16 +1,18 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 e20f48c6..af5ebaad 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,24 +1,26 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index b101d35f..8d86530d 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({required this.value}); + const IndexType({ + 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/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/name.dart b/lib/src/enums/name.dart index 74823feb..613bf5f1 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,22 +1,24 @@ 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'), - 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'), + 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 383e45b1..076c1c50 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,50 +1,52 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d4fef930..d34440ec 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index f01fcb01..0bf8e2ad 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({required this.value}); + const VCSDeploymentType({ + 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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index 4145f701..f174d569 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 4e901476..c9f67200 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 35c7b767..2fabb416 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index 7d27adba..fdcee07a 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index fec6f65a..120723df 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 0e80700f..504b5f8f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 bae6618f..5f3e1654 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 0ca54691..20dd7189 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1df01f19..a5b27b4f 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 21f8e9a3..96ce554b 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 298c181a..a4953a0e 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c6eecadd..03ba94c7 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1ef48332..8a5aa89d 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8c8fcb73..d17f414a 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index c5fa6adc..4098a5a1 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "attributes": attributes}; - } + Map toMap() { + return { + "total": total, + "attributes": attributes, + }; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 903c6290..050cbe14 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7374fa78..2202d255 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index f0bc295e..0c3ddf9e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index b8fb5e48..3bb374be 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 9d5b771b..29c56fe4 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Buckets List class BucketList implements Model { - /// Total number of buckets rows that matched your query. - final int total; + /// Total number of buckets rows 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))), + ); + } - Map toMap() { - return {"total": total, "buckets": buckets.map((p) => p.toMap()).toList()}; - } + 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 72de429d..c55110cf 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index b5ff3518..81104b31 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Collections List class CollectionList implements Model { - /// Total number of collections rows that matched your query. - final int total; + /// Total number of collections rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 60fcfa48..0ffc8fea 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c21a2260..367686d0 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 15d80695..7deb5e26 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 558b7d43..7bb56922 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 3b2f1335..c0547e11 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 9d637d92..acf0f6df 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 7bea7426..66213f0a 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,24 +2,28 @@ part of '../../models.dart'; /// Column Indexes List class ColumnIndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 2ba463cd..3823f425 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6672d7ce..4ac1fa12 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 8eb0171f..475c1c40 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "columns": columns}; - } + Map toMap() { + return { + "total": total, + "columns": columns, + }; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index 6221c01e..e55d1534 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7b560989..6fd6a3b0 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 66c0ce7b..94271aa6 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 7318b7ad..1a9c5038 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 651b5ae4..60b008ef 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Continents List class ContinentList implements Model { - /// Total number of continents rows that matched your query. - final int total; + /// Total number of continents rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 c52b50f2..565b1d66 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,19 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index ea839b51..3a3acd49 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Countries List class CountryList implements Model { - /// Total number of countries rows that matched your query. - final int total; + /// Total number of countries rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 27eef0c1..deafffe3 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 2ff28c61..34274e00 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Currencies List class CurrencyList implements Model { - /// Total number of currencies rows that matched your query. - final int total; + /// Total number of currencies rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 8d79e052..cab95b02 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 01e092f2..940a9610 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Databases List class DatabaseList implements Model { - /// Total number of databases rows that matched your query. - final int total; + /// Total number of databases rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 448c62c7..ecf7e791 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 1ca87150..7a2a38c2 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Deployments List class DeploymentList implements Model { - /// Total number of deployments rows that matched your query. - final int total; + /// Total number of deployments rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index cf85e457..be424a9c 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 b897a877..90bce66f 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,30 +2,31 @@ part of '../../models.dart'; /// Documents List class DocumentList implements Model { - /// Total number of documents rows that matched your query. - final int total; + /// Total number of documents rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 8618bcd6..0cfdbb4e 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,122 +2,118 @@ 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 upate date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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.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(), - trigger: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "trigger": trigger, - "status": status, - "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 upate date in ISO 8601 format. + final String $updatedAt; + + /// Execution roles. + final List $permissions; + + /// Function ID. + final String functionId; + + /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + final String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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.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(), + trigger: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "trigger": trigger, + "status": status, + "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 583d9fab..c30098a6 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Executions List class ExecutionList implements Model { - /// Total number of executions rows that matched your query. - final int total; + /// Total number of executions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 a6a9fa46..de8439ec 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index e7ca1bd5..164a281f 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Files List class FileList implements Model { - /// Total number of files rows that matched your query. - final int total; + /// Total number of files rows 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))), + ); + } - Map toMap() { - return {"total": total, "files": files.map((p) => p.toMap()).toList()}; - } + 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 693c9b07..ea6b601a 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,48 +2,46 @@ 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)), - ), - ); - } - - 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))), + ); + } + + 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 0b908240..7614616a 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5661bec4..bd39632e 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Frameworks List class FrameworkList implements Model { - /// Total number of frameworks rows that matched your query. - final int total; + /// Total number of frameworks rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 56c2eded..64401c3f 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index 24b199b1..b40dd517 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,25 +2,28 @@ part of '../../models.dart'; /// Functions List class FunctionList implements Model { - /// Total number of functions rows that matched your query. - final int total; + /// Total number of functions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 463cf696..ecf0a178 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "value": value}; - } + Map toMap() { + return { + "name": name, + "value": value, + }; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index fa402e97..54c31e70 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return {"version": version, "status": status}; - } + Map toMap() { + return { + "version": version, + "status": status, + }; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index d412eba9..0a5b6ce9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5f06906b..95da1235 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,16 +2,22 @@ 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'], + ); + } - Map toMap() { - return {"size": size}; - } + Map toMap() { + return { + "size": size, + }; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 59b7092c..0d6e7216 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,26 +2,34 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return {"name": name, "ping": ping, "status": status}; - } + Map toMap() { + return { + "name": name, + "ping": ping, + "status": status, + }; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index dec2d54f..102dfe77 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,30 +2,34 @@ 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'], + ); + } - Map toMap() { - return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; - } + Map toMap() { + return { + "remoteTime": remoteTime, + "localTime": localTime, + "diff": diff, + }; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index 807bdfd0..c43c4d57 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 51ddb64a..52fa04a6 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Identities List class IdentityList implements Model { - /// Total number of identities rows that matched your query. - final int total; + /// Total number of identities rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 9d6d7aec..b6717c4e 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 65207b94..390e9039 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Indexes List class IndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 490a1824..1b4ff7de 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"jwt": jwt}; - } + Map toMap() { + return { + "jwt": jwt, + }; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 9c45adb1..43eaad08 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,26 +2,34 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code, "nativeName": nativeName}; - } + 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 76a3f548..755c4e29 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Languages List class LanguageList implements Model { - /// Total number of languages rows that matched your query. - final int total; + /// Total number of languages rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 084475bf..b5e9ad1a 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 cd5a1155..10499ef5 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"code": code, "name": name}; - } + 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 5fa5c0ce..9e1e6034 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Locale codes list class LocaleCodeList implements Model { - /// Total number of localeCodes rows that matched your query. - final int total; + /// Total number of localeCodes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 7fb3f364..cb567bd7 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 4a771585..636d9166 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Logs List class LogList implements Model { - /// Total number of logs rows that matched your query. - final int total; + /// Total number of logs rows 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))), + ); + } - Map toMap() { - return {"total": total, "logs": logs.map((p) => p.toMap()).toList()}; - } + 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 8ee142ad..26610e46 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index 993f7206..566afb17 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Memberships List class MembershipList implements Model { - /// Total number of memberships rows that matched your query. - final int total; + /// Total number of memberships rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 9b93b00d..c4e9e858 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index c577ccc1..c5082c8e 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Message list class MessageList implements Model { - /// Total number of messages rows that matched your query. - final int total; + /// Total number of messages rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 96bf3c65..46c166fb 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 c930a23e..d49989d8 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 63411988..6c8b4e36 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,18 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"recoveryCodes": recoveryCodes}; - } + Map toMap() { + return { + "recoveryCodes": recoveryCodes, + }; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index fa57cb8b..01cf0857 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"secret": secret, "uri": uri}; - } + Map toMap() { + return { + "secret": secret, + "uri": uri, + }; + } } 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/phone.dart b/lib/src/models/phone.dart index 40f7bcd2..c8bbb95b 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 497aa36c..a40e3591 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Phones List class PhoneList implements Model { - /// Total number of phones rows that matched your query. - final int total; + /// Total number of phones rows 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))), + ); + } - Map toMap() { - return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "phones": phones.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index 7bc3abc9..edb6083e 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,17 +2,23 @@ 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); - } + factory Preferences.fromMap(Map map) { + return Preferences( + data: map, + ); + } - Map toMap() { - return {"data": data}; - } + 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/provider.dart b/lib/src/models/provider.dart index 1a762f85..4295c486 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 6d579bd0..c71c810d 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Provider list class ProviderList implements Model { - /// Total number of providers rows that matched your query. - final int total; + /// Total number of providers rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index dad35dcc..ed520cc4 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 fcbcbc3a..3c2d985f 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,24 +2,28 @@ part of '../../models.dart'; /// Resource Tokens List class ResourceTokenList implements Model { - /// Total number of tokens rows that matched your query. - final int total; + /// Total number of tokens rows 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))), + ); + } - Map toMap() { - return {"total": total, "tokens": tokens.map((p) => p.toMap()).toList()}; - } + 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 3700e577..62e69e5b 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 ae3f851d..42bdbfea 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,25 +2,31 @@ part of '../../models.dart'; /// Rows List class RowList implements Model { - /// Total number of rows rows that matched your query. - final int total; + /// Total number of rows 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))), + ); + } - Map toMap() { - return {"total": total, "rows": rows.map((p) => p.toMap()).toList()}; - } + 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 7c9677d8..35f82cfa 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 b93dbb8f..e574c63c 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Runtimes List class RuntimeList implements Model { - /// Total number of runtimes rows that matched your query. - final int total; + /// Total number of runtimes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 d2fe4f64..3a1d955f 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 563b04a4..160cb789 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Sessions List class SessionList implements Model { - /// Total number of sessions rows that matched your query. - final int total; + /// Total number of sessions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 1449f8bd..5cda6acc 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index eb1a5457..3164546a 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Sites List class SiteList implements Model { - /// Total number of sites rows that matched your query. - final int total; + /// Total number of sites rows 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))), + ); + } - Map toMap() { - return {"total": total, "sites": sites.map((p) => p.toMap()).toList()}; - } + 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 e8fb8c75..e49d399c 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,35 +2,40 @@ 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(), + ); + } - Map toMap() { - return {"memory": memory, "cpus": cpus, "enabled": enabled, "slug": slug}; - } + 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 9a7d0154..040dbcc7 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Specifications List class SpecificationList implements Model { - /// Total number of specifications rows that matched your query. - final int total; + /// Total number of specifications rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 0c926297..36e18a7e 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 d5c6c01d..20ce6ca5 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Subscriber list class SubscriberList implements Model { - /// Total number of subscribers rows that matched your query. - final int total; + /// Total number of subscribers rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 7ce86b9d..1c5b88fb 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,78 +2,76 @@ 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; - 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, - }); + 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, + }); - 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)), - ), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 7398c48f..2c285e55 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Tables List class TableList implements Model { - /// Total number of tables rows that matched your query. - final int total; + /// Total number of tables rows 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))), + ); + } - Map toMap() { - return {"total": total, "tables": tables.map((p) => p.toMap()).toList()}; - } + 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 4be8b545..f2b3b6b4 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 29667c94..c3c250a5 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Target list class TargetList implements Model { - /// Total number of targets rows that matched your query. - final int total; + /// Total number of targets rows 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))), + ); + } - Map toMap() { - return {"total": total, "targets": targets.map((p) => p.toMap()).toList()}; - } + 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 43df33a8..e9058b5b 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 b70f12c1..3b8547ca 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Teams List class TeamList implements Model { - /// Total number of teams rows that matched your query. - final int total; + /// Total number of teams rows 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))), + ); + } - Map toMap() { - return {"total": total, "teams": teams.map((p) => p.toMap()).toList()}; - } + 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 35115467..4f6b8454 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 430d44ac..461d5694 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 69a17ebc..1c0fdb32 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Topic list class TopicList implements Model { - /// Total number of topics rows that matched your query. - final int total; + /// Total number of topics rows 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))), + ); + } - Map toMap() { - return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "topics": topics.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index 50bfb3ce..effc397c 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 56cc1b5b..75b8f53b 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Users List class UserList implements Model { - /// Total number of users rows that matched your query. - final int total; + /// Total number of users rows 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))), + ); + } - Map toMap() { - return {"total": total, "users": users.map((p) => p.toMap()).toList()}; - } + 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 2a8e276a..58882a9f 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 cd90d85f..da6e6982 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Variables List class VariableList implements Model { - /// Total number of variables rows that matched your query. - final int total; + /// Total number of variables rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } From 4b6f8ba5f433d0f6d082e65e50e8d8a36bf8fd03 Mon Sep 17 00:00:00 2001 From: abnegate Date: Wed, 20 Aug 2025 06:40:01 +0000 Subject: [PATCH 08/22] Commit from GitHub Actions (Format and push) --- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1191 +++++------ lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 ++++++++++++------- lib/services/functions.dart | 869 ++++---- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 +++-- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 1852 ++++++++++------- lib/services/sites.dart | 822 ++++---- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 +++++++++------- lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1349 ++++++------ lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 232 ++- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 ++-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 ++-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 ++-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +-- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 164 files changed, 12559 insertions(+), 11067 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/query.dart b/lib/query.dart index 281aa756..c9a2fc91 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if(attribute != null) { + if (attribute != null) { map['attribute'] = attribute; } - - if(values != null) { + + if (values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} \ 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 89246ea7..b1358d47 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,27 +1,26 @@ 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 +29,32 @@ 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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,449 +63,442 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.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); - - final Map apiParams = { - - - }; + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/account/identities/{identityId}'.replaceAll( + '{identityId}', + identityId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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; + 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() async { - final String apiPath = '/account/jwts'; + Future createJWT() async { + final String apiPath = '/account/jwts'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.LogList.fromMap(res.data); - - } + } /// Enable or disable MFA on an account. - Future updateMFA({required bool mfa}) async { - final String apiPath = '/account/mfa'; - - final Map apiParams = { - - 'mfa': 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 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. - Future createMfaAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - - final Map apiParams = { - - - }; + Future createMfaAuthenticator({ + required enums.AuthenticatorType type, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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, - - }; + Future updateMfaAuthenticator({ + required enums.AuthenticatorType type, + required String otp, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - - final Map apiParams = { - - - }; + Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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; + 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. - Future createMfaChallenge({required enums.AuthenticationFactor factor}) async { - final String apiPath = '/account/mfa/challenge'; + Future createMfaChallenge({ + required enums.AuthenticationFactor factor, + }) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = { - - 'factor': factor.value, - - }; + final Map apiParams = {'factor': factor.value}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - Future updateMfaChallenge({required String challengeId, required String otp}) async { - final String apiPath = '/account/mfa/challenge'; + Future updateMfaChallenge({ + required String challengeId, + required String otp, + }) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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. - 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. - Future createMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; - - final Map apiParams = { - - - }; + Future createMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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 apiHeaders = { - 'content-type': 'application/json', + 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 apiParams = {'name': name}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'oldPassword': oldPassword, - + 'oldPassword': oldPassword, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 apiParams = {'prefs': prefs}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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 @@ -512,99 +508,98 @@ 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, + final Map apiParams = {'email': email, 'url': url}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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 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'; - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteSessions() async { + final String apiPath = '/account/sessions'; - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 @@ -613,213 +608,212 @@ 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 apiHeaders = { - 'content-type': 'application/json', + 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 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.') - Future updateMagicURLSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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.') - Future updatePhoneSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + final Map apiParams = {'userId': userId, 'secret': secret}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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); - - final Map apiParams = { - - - }; + Future updateSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 apiHeaders = { - 'content-type': 'application/json', + 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 /// provided user ID has not be registered, a new user will be created. Use the @@ -827,31 +821,34 @@ 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, -'phrase': phrase, - + 'email': email, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 @@ -862,66 +859,79 @@ 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, -'url': url, -'phrase': phrase, - + 'email': email, + 'url': url, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { 'success': success, -'failure': failure, -'scopes': scopes, + 'failure': failure, + 'scopes': scopes, - 'project': client.config['project'], }; 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)); + query.add( + Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item), + ); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -929,15 +939,16 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri(scheme: endpoint.scheme, + Uri url = Uri( + scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&') + 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 @@ -945,30 +956,29 @@ 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, + final Map apiParams = {'userId': userId, 'phone': phone}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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** @@ -979,56 +989,52 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; - - final Map apiParams = { - - 'url': url, - - }; + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 updateVerification({required String userId, required String secret}) async { - final String apiPath = '/account/verification'; + Future updateVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification'; - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; + final Map apiParams = {'userId': userId, 'secret': secret}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -1038,47 +1044,44 @@ 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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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/verification/phone'; + Future updatePhoneVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; + final Map apiParams = {'userId': userId, 'secret': secret}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index a91d6d3f..8033f1cd 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,189 +1,255 @@ 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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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, -'width': width, -'height': height, + 'width': width, + '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 = { 'name': name, -'width': width, -'height': height, -'background': background, + 'width': width, + 'height': height, + '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, -'size': size, -'margin': margin, -'download': download, + 'size': size, + 'margin': margin, + '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 22e279fc..ca557ea5 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1215 +1,1682 @@ 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}) 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, + }) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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.createDatabase` 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.createDatabase` instead.', + ) + Future create({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases'; final Map apiParams = { - 'databaseId': databaseId, -'name': name, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, bool? enabled}) async { - final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDb.update` instead.', + ) + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'collectionId': collectionId, -'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) 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, + required String name, + List? permissions, + bool? documentSecurity, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + @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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + @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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return 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/{key}/relationship'.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/{key}/relationship' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'onDelete': onDelete?.value, -'newKey': newKey, - + 'newKey': newKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - } + } /// 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'documentId': documentId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + final Map apiParams = {'queries': queries}; + + final Map 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, required Map data, List? permissions}) 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, + required Map data, + List? permissions, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - 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; - - } + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'attributes': attributes, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 index by 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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); - - 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; - - } -} \ No newline at end of file + @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 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/functions.dart b/lib/services/functions.dart index 05a7d5f7..e86f1afe 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,256 +1,316 @@ 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}) async { - final String apiPath = '/functions'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? specification}) 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? specification, + }) async { + final String apiPath = '/functions'; final Map apiParams = { - 'functionId': functionId, -'name': name, -'runtime': runtime.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'name': name, + 'runtime': runtime.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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? specification}) 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? specification, + }) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'name': name, -'runtime': runtime?.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'runtime': runtime?.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String functionId}) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateFunctionDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployment'.replaceAll( + '{functionId}', + functionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); + Future listDeployments({ + required String functionId, + List? queries, + String? search, + }) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 = { - 'entrypoint': entrypoint, -'commands': commands, -'code': code, -'activate': activate, - + 'commands': commands, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -265,361 +325,446 @@ 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, -'buildId': buildId, - + 'buildId': buildId, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String functionId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/functions/{functionId}/deployments/template' + .replaceAll('{functionId}', functionId); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll('{functionId}', functionId); + Future createVcsDeployment({ + required String functionId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployments/{deploymentId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 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}) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - - final Map apiParams = { - 'queries': queries, + Future listExecutions({ + required String functionId, + List? queries, + }) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll( + '{functionId}', + functionId, + ); - - }; + final Map apiParams = {'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.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 = { - 'body': body, -'async': xasync, -'path': path, -'method': method?.value, -'headers': headers, -'scheduledAt': scheduledAt, - + 'async': xasync, + 'path': path, + 'method': method?.value, + 'headers': headers, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteExecution({ + required String functionId, + required String executionId, + }) async { + final String apiPath = '/functions/{functionId}/executions/{executionId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{executionId}', executionId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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, + }) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index e2418b52..18eb54f1 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,51 +1,49 @@ 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 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); - - return res.data; + 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 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); - - return res.data; + final res = await client.call( + HttpMethod.post, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/health.dart b/lib/services/health.dart index 0cf64ac6..5250c91d 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,438 +1,414 @@ 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.HealthStatus.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 = { - 'domain': domain, + final Map apiParams = {'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); - - } + } /// 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.HealthStatus.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.HealthStatus.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 = { - 'threshold': threshold, - - - }; + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueCertificates({int? threshold}) async { + final String apiPath = '/health/queue/certificates'; - - }; + final Map apiParams = {'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 = { 'name': name, -'threshold': threshold, - - + '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 = { - 'threshold': threshold, + final Map apiParams = {'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); - - final Map apiParams = { - 'threshold': threshold, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future getFailedJobs({ + required enums.Name name, + int? threshold, + }) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll( + '{name}', + name.value, + ); + + final Map apiParams = {'threshold': threshold}; + + final Map 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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueFunctions({int? threshold}) async { + final String apiPath = '/health/queue/functions'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueStatsResources({int? threshold}) async { + final String apiPath = '/health/queue/stats-resources'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 @@ -441,21 +417,20 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 430a00c3..4d3cc3e0 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,172 +1,164 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 6147b8dc..afe3ee86 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1160 +1,1478 @@ 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}) async { - final String apiPath = '/messaging/messages'; + Future listMessages({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'topics': topics, -'users': users, -'targets': targets, -'cc': cc, -'bcc': bcc, -'attachments': attachments, -'draft': draft, -'html': html, -'scheduledAt': scheduledAt, - + 'subject': subject, + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'cc': cc, + 'bcc': bcc, + 'attachments': attachments, + 'draft': draft, + 'html': html, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'title': title, -'body': body, -'topics': topics, -'users': users, -'targets': targets, -'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.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'title': title, + 'body': body, + 'topics': topics, + 'users': users, + 'targets': targets, + '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.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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'topics': topics, -'users': users, -'targets': targets, -'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'draft': draft, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - /// - 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 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); - - final Map apiParams = { - - - }; + Future delete({required String messageId}) async { + final String apiPath = '/messaging/messages/{messageId}'.replaceAll( + '{messageId}', + messageId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listMessageLogs({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/providers'; + Future listProviders({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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. - 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, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - 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 = { - 'name': name, -'enabled': enabled, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - 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 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. - 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 = { - 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'enabled': enabled, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'enabled': enabled, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, -'enabled': enabled, - + 'name': name, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, - + 'enabled': enabled, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'enabled': enabled, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - 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, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. - 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 = { - 'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, -'from': from, -'customerId': customerId, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'customerId': customerId, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'customerId': customerId, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'customerId': customerId, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'from': from, -'username': username, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'username': username, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'username': username, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'username': username, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'from': from, -'accountSid': accountSid, -'authToken': authToken, -'enabled': enabled, - + 'name': name, + 'from': from, + 'accountSid': accountSid, + 'authToken': authToken, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'accountSid': accountSid, -'authToken': authToken, -'from': from, - + 'enabled': enabled, + 'accountSid': accountSid, + 'authToken': authToken, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'from': from, -'apiKey': apiKey, -'apiSecret': apiSecret, -'enabled': enabled, - + 'name': name, + 'from': from, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'apiSecret': apiSecret, -'from': from, - + 'enabled': enabled, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteProvider({required String providerId}) async { + final String apiPath = '/messaging/providers/{providerId}'.replaceAll( + '{providerId}', + providerId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listProviderLogs({ + required String providerId, + List? queries, + }) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( + '{providerId}', + providerId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); - - final Map apiParams = { - 'queries': queries, + Future listSubscriberLogs({ + required String subscriberId, + List? queries, + }) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs' + .replaceAll('{subscriberId}', subscriberId); - - }; + final Map apiParams = {'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.LogList.fromMap(res.data); - - } + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({List? queries, String? search}) async { - final String apiPath = '/messaging/topics'; + Future listTopics({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'subscribe': subscribe, - + 'name': name, + 'subscribe': subscribe, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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; - - } + return res.data; + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs({required String topicId, List? queries}) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTopicLogs({ + required String topicId, + List? queries, + }) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( + '{topicId}', + topicId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); + Future listSubscribers({ + required String topicId, + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( + '{topicId}', + topicId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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 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); - - 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; - - } -} \ No newline at end of file + 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 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/sites.dart b/lib/services/sites.dart index 5481986e..d89f2192 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,247 +1,296 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.Adapter? adapter, + String? installationId, + String? fallbackFile, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites'; final Map apiParams = { - 'siteId': siteId, -'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime.value, -'adapter': adapter?.value, -'installationId': installationId, -'fallbackFile': fallbackFile, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime.value, + 'adapter': adapter?.value, + 'installationId': installationId, + 'fallbackFile': fallbackFile, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.BuildRuntime? buildRuntime, + enums.Adapter? adapter, + String? fallbackFile, + String? installationId, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime?.value, -'adapter': adapter?.value, -'fallbackFile': fallbackFile, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime?.value, + 'adapter': adapter?.value, + 'fallbackFile': fallbackFile, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + Future delete({required String siteId}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateSiteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployment'.replaceAll( + '{siteId}', + siteId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future listDeployments({ + required String siteId, + List? queries, + String? search, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future createDeployment({ + required String siteId, + required InputFile code, + required bool activate, + String? installCommand, + String? buildCommand, + String? outputDirectory, + Function(UploadProgress)? onProgress, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'code': code, -'activate': activate, - + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -256,331 +305,400 @@ 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, + 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 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String siteId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll('{siteId}', siteId); + Future createVcsDeployment({ + required String siteId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - 'queries': queries, + Future listLogs({ + required String siteId, + List? queries, + }) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll( + '{siteId}', + siteId, + ); - - }; + final Map apiParams = {'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.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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ccdce915..ee630883 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,184 +1,226 @@ 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}) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({ + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { - 'bucketId': bucketId, -'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'name': name, + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) 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, + }) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { - 'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteBucket({required String bucketId}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); + Future listFiles({ + required String bucketId, + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'permissions': permissions, - + 'file': file, + 'permissions': permissions, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -194,137 +236,187 @@ 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 = { - 'name': name, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 = { 'width': width, -'height': height, -'gravity': gravity?.value, -'quality': quality, -'borderWidth': borderWidth, -'borderColor': borderColor, -'borderRadius': borderRadius, -'opacity': opacity, -'rotation': rotation, -'background': background, -'output': output?.value, -'token': token, - - + 'height': height, + 'gravity': gravity?.value, + 'quality': quality, + 'borderWidth': borderWidth, + 'borderColor': borderColor, + 'borderRadius': borderRadius, + 'opacity': opacity, + 'rotation': rotation, + 'background': background, + 'output': output?.value, + '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 = { '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 288d730b..7cf31d00 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1162 +1,1520 @@ 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}) async { - final String apiPath = '/tablesdb'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, required String name, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + Future listTables({ + required String databaseId, + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'tableId': tableId, -'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future updateTable({ + required String databaseId, + required String tableId, + required String name, + List? permissions, + bool? rowSecurity, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteTable({ + required String databaseId, + required String tableId, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listColumns({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - /// - 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); + /// + 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - /// - 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); + /// + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + 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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + 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 apiHeaders = {'content-type': 'application/json'}; + + 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listIndexes({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'columns': columns, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + 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 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); - - 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; - - } + 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 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRow({required String databaseId, required String tableId, required String rowId, required Map data, List? permissions}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'rowId': rowId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + Future createRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - /// - Future upsertRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future upsertRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future updateRows({ + required String databaseId, + required String tableId, + Map? data, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + Future deleteRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future getRow({ + required String databaseId, + required String tableId, + required String rowId, + List? queries, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future upsertRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - 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; - - } + Future deleteRow({ + required String databaseId, + required String tableId, + required String rowId, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future decrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? min, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future incrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? max, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.patch, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); return models.Row.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/teams.dart b/lib/services/teams.dart index c21a93af..5fd59641 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,140 +1,147 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'roles': roles, - + 'name': name, + 'roles': roles, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - 'name': name, + 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 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); + Future listMemberships({ + required String teamId, + List? queries, + String? search, + }) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll( + '{teamId}', + teamId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 @@ -142,182 +149,210 @@ 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 = { - 'email': email, -'userId': userId, -'phone': phone, -'roles': roles, -'url': url, -'name': name, - + 'userId': userId, + 'phone': phone, + 'roles': roles, + 'url': url, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - 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); + /// + 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, + ); 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index cb04449b..4e6915dc 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,109 +1,113 @@ 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}) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future list({ + required String bucketId, + required String fileId, + List? queries, + }) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); + + final Map apiParams = {'queries': queries}; + + final Map 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); - - 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); + 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, + ); 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); - - final Map apiParams = { - - 'expire': expire, + 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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String tokenId}) async { + final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/users.dart b/lib/services/users.dart index e6f80be3..c98182b7 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,314 +1,359 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'password': password, -'name': name, - + 'email': email, + 'phone': phone, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/users/identities'; + Future listIdentities({ + List? queries, + String? search, + }) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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); - - final Map apiParams = { - - - }; + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/users/identities/{identityId}'.replaceAll( + '{identityId}', + identityId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordCpu': passwordCpu, + 'passwordMemory': passwordMemory, + 'passwordParallel': passwordParallel, + 'passwordLength': passwordLength, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordSaltSeparator': passwordSaltSeparator, + 'passwordSignerKey': passwordSignerKey, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'passwordVersion': passwordVersion?.value, -'name': name, - + 'email': email, + 'password': password, + 'passwordVersion': passwordVersion?.value, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -316,648 +361,748 @@ 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); - - final Map apiParams = { - - - }; + Future delete({required String userId}) async { + final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); 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 = { - 'sessionId': sessionId, -'duration': duration, - + 'duration': duration, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// Get the user activity logs list by its unique ID. - Future listLogs({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listLogs({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/logs'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); + Future listMemberships({ + required String userId, + List? queries, + String? search, + }) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll( + '{userId}', + userId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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. - Future updateMfa({required String userId, required bool mfa}) async { - final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); - - final Map apiParams = { - - 'mfa': mfa, - - }; + Future updateMfa({ + required String userId, + required bool mfa, + }) async { + final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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 = { - - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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. - 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. - 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. - Future updateMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; + Future updateMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - Future createMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; + Future createMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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); - - final Map apiParams = { - - - }; + Future createSession({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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 res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// List the messaging targets that are associated with a user. - Future listTargets({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/targets'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, -'providerId': providerId, -'name': name, - + 'providerType': providerType.value, + 'identifier': identifier, + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'identifier': identifier, -'providerId': providerId, -'name': name, - + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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 res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'length': length, -'expire': expire, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future createToken({ + required String userId, + int? length, + int? expire, + }) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'length': length, 'expire': expire}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/src/client.dart b/lib/src/client.dart index 0d9be210..d82d623a 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,7 +81,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 cd82d264..08d93b85 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,21 +2,25 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index ea2cd62a..c961873f 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,14 +9,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => +ClientBase createClient({required String endPoint, required bool selfSigned}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -34,59 +31,66 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format' : '1.8.0', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -135,7 +139,11 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -162,12 +170,19 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index f9e695bf..2bd7d639 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,17 +10,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => - ClientIO( - endPoint: endPoint, - selfSigned: selfSigned, - ); +ClientBase createClient({required String endPoint, required bool selfSigned}) => + ClientIO(endPoint: endPoint, selfSigned: selfSigned); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -43,60 +37,68 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format' : '1.8.0', + 'user-agent': + 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -151,11 +153,16 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, file.path!, - filename: file.filename); + paramName, + file.path!, + filename: file.filename, + ); } else { - 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, @@ -194,12 +201,19 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -244,10 +258,7 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse( - res, - responseType: responseType, - ); + return prepareResponse(res, responseType: responseType); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 658b79b6..06c9ebe3 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest) - .fields - .addAll({"$key[$i]": v.toString()}); + (request as http.MultipartRequest).fields.addAll({ + "$key[$i]": v.toString(), + }); }); } else { - (request as http.MultipartRequest) - .fields - .addAll({key: value.toString()}); + (request as http.MultipartRequest).fields.addAll({ + key: value.toString(), + }); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value){ + params = params.map((key, value) { if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,12 +51,13 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port, + ); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -66,7 +67,9 @@ 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); @@ -113,18 +116,25 @@ 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.dart b/lib/src/enums.dart index 595afdc2..0f250ea3 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes + bytes, } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 2f198d4e..3341912f 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 cd45b6a1..1bae5c8a 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 7d2d7016..42954430 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,18 +1,16 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 af5ebaad..e20f48c6 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,26 +1,24 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index 8d86530d..b101d35f 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({ - required this.value - }); + const IndexType({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/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/name.dart b/lib/src/enums/name.dart index 613bf5f1..74823feb 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,24 +1,22 @@ 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'), - 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'), + 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 076c1c50..383e45b1 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,52 +1,50 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d34440ec..d4fef930 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index 0bf8e2ad..f01fcb01 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({ - required this.value - }); + const VCSDeploymentType({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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index f174d569..4145f701 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 c9f67200..4e901476 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 2fabb416..35c7b767 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index fdcee07a..7d27adba 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index 120723df..fec6f65a 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 504b5f8f..0e80700f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 5f3e1654..bae6618f 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 20dd7189..0ca54691 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a5b27b4f..1df01f19 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 96ce554b..21f8e9a3 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a4953a0e..298c181a 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 03ba94c7..c6eecadd 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8a5aa89d..1ef48332 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 d17f414a..8c8fcb73 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index 4098a5a1..c5fa6adc 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "attributes": attributes, - }; - } + Map toMap() { + return {"total": total, "attributes": attributes}; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 050cbe14..903c6290 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 2202d255..7374fa78 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index 0c3ddf9e..f0bc295e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index 3bb374be..b8fb5e48 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 29c56fe4..9d5b771b 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Buckets List class BucketList implements Model { - /// Total number of buckets rows that matched your query. - final int total; + /// Total number of buckets rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "buckets": buckets.map((p) => p.toMap()).toList(), - }; - } + 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 c55110cf..72de429d 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 81104b31..b5ff3518 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Collections List class CollectionList implements Model { - /// Total number of collections rows that matched your query. - final int total; + /// Total number of collections rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 0ffc8fea..60fcfa48 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 367686d0..c21a2260 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7deb5e26..15d80695 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7bb56922..558b7d43 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c0547e11..3b2f1335 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 acf0f6df..9d637d92 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 66213f0a..7bea7426 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,28 +2,24 @@ part of '../../models.dart'; /// Column Indexes List class ColumnIndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 3823f425..2ba463cd 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 4ac1fa12..6672d7ce 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 475c1c40..8eb0171f 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "columns": columns, - }; - } + Map toMap() { + return {"total": total, "columns": columns}; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index e55d1534..6221c01e 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6fd6a3b0..7b560989 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 94271aa6..66c0ce7b 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 1a9c5038..7318b7ad 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 60b008ef..651b5ae4 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Continents List class ContinentList implements Model { - /// Total number of continents rows that matched your query. - final int total; + /// Total number of continents rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 565b1d66..c52b50f2 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,28 +2,19 @@ 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()); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 3a3acd49..ea839b51 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Countries List class CountryList implements Model { - /// Total number of countries rows that matched your query. - final int total; + /// Total number of countries rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 deafffe3..27eef0c1 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 34274e00..2ff28c61 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Currencies List class CurrencyList implements Model { - /// Total number of currencies rows that matched your query. - final int total; + /// Total number of currencies rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 cab95b02..8d79e052 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 940a9610..01e092f2 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Databases List class DatabaseList implements Model { - /// Total number of databases rows that matched your query. - final int total; + /// Total number of databases rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 ecf7e791..448c62c7 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 7a2a38c2..1ca87150 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Deployments List class DeploymentList implements Model { - /// Total number of deployments rows that matched your query. - final int total; + /// Total number of deployments rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index be424a9c..cf85e457 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 90bce66f..b897a877 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,31 +2,30 @@ part of '../../models.dart'; /// Documents List class DocumentList implements Model { - /// Total number of documents rows that matched your query. - final int total; + /// Total number of documents rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 0cfdbb4e..8618bcd6 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,118 +2,122 @@ 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 upate date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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.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(), - trigger: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "trigger": trigger, - "status": status, - "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 upate date in ISO 8601 format. + final String $updatedAt; + + /// Execution roles. + final List $permissions; + + /// Function ID. + final String functionId; + + /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + final String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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.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(), + trigger: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "trigger": trigger, + "status": status, + "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 c30098a6..583d9fab 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Executions List class ExecutionList implements Model { - /// Total number of executions rows that matched your query. - final int total; + /// Total number of executions rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 de8439ec..a6a9fa46 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 164a281f..e7ca1bd5 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Files List class FileList implements Model { - /// Total number of files rows that matched your query. - final int total; + /// Total number of files rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "files": files.map((p) => p.toMap()).toList(), - }; - } + 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 ea6b601a..693c9b07 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,46 +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))), - ); - } - - 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)), + ), + ); + } + + 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 7614616a..0b908240 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 bd39632e..5661bec4 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Frameworks List class FrameworkList implements Model { - /// Total number of frameworks rows that matched your query. - final int total; + /// Total number of frameworks rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 64401c3f..56c2eded 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index b40dd517..24b199b1 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,28 +2,25 @@ part of '../../models.dart'; /// Functions List class FunctionList implements Model { - /// Total number of functions rows that matched your query. - final int total; + /// Total number of functions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 ecf0a178..463cf696 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "value": value, - }; - } + Map toMap() { + return {"name": name, "value": value}; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index 54c31e70..fa402e97 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "version": version, - "status": status, - }; - } + Map toMap() { + return {"version": version, "status": status}; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index 0a5b6ce9..d412eba9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 95da1235..5f06906b 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,22 +2,16 @@ 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']); + } - Map toMap() { - return { - "size": size, - }; - } + Map toMap() { + return {"size": size}; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 0d6e7216..59b7092c 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,34 +2,26 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "name": name, - "ping": ping, - "status": status, - }; - } + Map toMap() { + return {"name": name, "ping": ping, "status": status}; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index 102dfe77..dec2d54f 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,34 +2,30 @@ 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'], + ); + } - Map toMap() { - return { - "remoteTime": remoteTime, - "localTime": localTime, - "diff": diff, - }; - } + Map toMap() { + return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index c43c4d57..807bdfd0 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 52fa04a6..51ddb64a 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Identities List class IdentityList implements Model { - /// Total number of identities rows that matched your query. - final int total; + /// Total number of identities rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 b6717c4e..9d6d7aec 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 390e9039..65207b94 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Indexes List class IndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 1b4ff7de..490a1824 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "jwt": jwt, - }; - } + Map toMap() { + return {"jwt": jwt}; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 43eaad08..9c45adb1 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,34 +2,26 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - "nativeName": nativeName, - }; - } + 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 755c4e29..76a3f548 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Languages List class LanguageList implements Model { - /// Total number of languages rows that matched your query. - final int total; + /// Total number of languages rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 b5e9ad1a..084475bf 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 10499ef5..cd5a1155 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "name": name, - }; - } + 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 9e1e6034..5fa5c0ce 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Locale codes list class LocaleCodeList implements Model { - /// Total number of localeCodes rows that matched your query. - final int total; + /// Total number of localeCodes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 cb567bd7..7fb3f364 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 636d9166..4a771585 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Logs List class LogList implements Model { - /// Total number of logs rows that matched your query. - final int total; + /// Total number of logs rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "logs": logs.map((p) => p.toMap()).toList(), - }; - } + 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 26610e46..8ee142ad 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index 566afb17..993f7206 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Memberships List class MembershipList implements Model { - /// Total number of memberships rows that matched your query. - final int total; + /// Total number of memberships rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 c4e9e858..9b93b00d 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index c5082c8e..c577ccc1 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Message list class MessageList implements Model { - /// Total number of messages rows that matched your query. - final int total; + /// Total number of messages rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 46c166fb..96bf3c65 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 d49989d8..c930a23e 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 6c8b4e36..63411988 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,22 +2,18 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "recoveryCodes": recoveryCodes, - }; - } + Map toMap() { + return {"recoveryCodes": recoveryCodes}; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index 01cf0857..fa57cb8b 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "secret": secret, - "uri": uri, - }; - } + Map toMap() { + return {"secret": secret, "uri": uri}; + } } 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/phone.dart b/lib/src/models/phone.dart index c8bbb95b..40f7bcd2 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 a40e3591..497aa36c 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Phones List class PhoneList implements Model { - /// Total number of phones rows that matched your query. - final int total; + /// Total number of phones rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "phones": phones.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index edb6083e..7bc3abc9 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,23 +2,17 @@ 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, - ); - } + factory Preferences.fromMap(Map map) { + return Preferences(data: map); + } - Map toMap() { - return { - "data": data, - }; - } + 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/provider.dart b/lib/src/models/provider.dart index 4295c486..1a762f85 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 c71c810d..6d579bd0 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Provider list class ProviderList implements Model { - /// Total number of providers rows that matched your query. - final int total; + /// Total number of providers rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index ed520cc4..dad35dcc 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 3c2d985f..fcbcbc3a 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,28 +2,24 @@ part of '../../models.dart'; /// Resource Tokens List class ResourceTokenList implements Model { - /// Total number of tokens rows that matched your query. - final int total; + /// Total number of tokens rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "tokens": tokens.map((p) => p.toMap()).toList(), - }; - } + 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 62e69e5b..3700e577 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 42bdbfea..ae3f851d 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,31 +2,25 @@ part of '../../models.dart'; /// Rows List class RowList implements Model { - /// Total number of rows rows that matched your query. - final int total; + /// Total number of rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "rows": rows.map((p) => p.toMap()).toList(), - }; - } + 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 35f82cfa..7c9677d8 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 e574c63c..b93dbb8f 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Runtimes List class RuntimeList implements Model { - /// Total number of runtimes rows that matched your query. - final int total; + /// Total number of runtimes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 3a1d955f..d2fe4f64 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 160cb789..563b04a4 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Sessions List class SessionList implements Model { - /// Total number of sessions rows that matched your query. - final int total; + /// Total number of sessions rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 5cda6acc..1449f8bd 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index 3164546a..eb1a5457 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Sites List class SiteList implements Model { - /// Total number of sites rows that matched your query. - final int total; + /// Total number of sites rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "sites": sites.map((p) => p.toMap()).toList(), - }; - } + 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 e49d399c..e8fb8c75 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,40 +2,35 @@ 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(), + ); + } - Map toMap() { - return { - "memory": memory, - "cpus": cpus, - "enabled": enabled, - "slug": slug, - }; - } + 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 040dbcc7..9a7d0154 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Specifications List class SpecificationList implements Model { - /// Total number of specifications rows that matched your query. - final int total; + /// Total number of specifications rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 36e18a7e..0c926297 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 20ce6ca5..d5c6c01d 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Subscriber list class SubscriberList implements Model { - /// Total number of subscribers rows that matched your query. - final int total; + /// Total number of subscribers rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 1c5b88fb..7ce86b9d 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,76 +2,78 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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)), + ), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 2c285e55..7398c48f 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Tables List class TableList implements Model { - /// Total number of tables rows that matched your query. - final int total; + /// Total number of tables rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "tables": tables.map((p) => p.toMap()).toList(), - }; - } + 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 f2b3b6b4..4be8b545 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 c3c250a5..29667c94 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Target list class TargetList implements Model { - /// Total number of targets rows that matched your query. - final int total; + /// Total number of targets rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "targets": targets.map((p) => p.toMap()).toList(), - }; - } + 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 e9058b5b..43df33a8 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 3b8547ca..b70f12c1 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Teams List class TeamList implements Model { - /// Total number of teams rows that matched your query. - final int total; + /// Total number of teams rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "teams": teams.map((p) => p.toMap()).toList(), - }; - } + 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 4f6b8454..35115467 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 461d5694..430d44ac 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 1c0fdb32..69a17ebc 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Topic list class TopicList implements Model { - /// Total number of topics rows that matched your query. - final int total; + /// Total number of topics rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "topics": topics.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index effc397c..50bfb3ce 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 75b8f53b..56cc1b5b 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Users List class UserList implements Model { - /// Total number of users rows that matched your query. - final int total; + /// Total number of users rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "users": users.map((p) => p.toMap()).toList(), - }; - } + 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 58882a9f..2a8e276a 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 da6e6982..cd90d85f 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Variables List class VariableList implements Model { - /// Total number of variables rows that matched your query. - final int total; + /// Total number of variables rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } From 992b18de419a2359ae4f48bf6318a4bb51f69709 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 20 Aug 2025 19:20:48 +1200 Subject: [PATCH 09/22] Add 1.8.x support --- .../databases/decrement-document-attribute.md | 2 +- .../databases/increment-document-attribute.md | 2 +- .../examples/tablesdb/decrement-row-column.md | 2 +- .../examples/tablesdb/increment-row-column.md | 2 +- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1191 +++++----- lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 +++++++---------- lib/services/functions.dart | 869 +++---- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 +++-- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 1852 ++++++--------- lib/services/sites.dart | 822 +++---- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 ++++++--------- lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1349 +++++------ lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 232 +- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 +-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 +-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 +-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 168 files changed, 11071 insertions(+), 12563 deletions(-) diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md index c8ec38da..e4624487 100644 --- a/docs/examples/databases/decrement-document-attribute.md +++ b/docs/examples/databases/decrement-document-attribute.md @@ -3,7 +3,7 @@ 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 + .setSession(''); // The user session to authenticate with Databases databases = Databases(client); diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md index 6e5134b0..a2d26226 100644 --- a/docs/examples/databases/increment-document-attribute.md +++ b/docs/examples/databases/increment-document-attribute.md @@ -3,7 +3,7 @@ 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 + .setSession(''); // The user session to authenticate with Databases databases = Databases(client); diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md index d881c19d..1f3a5e91 100644 --- a/docs/examples/tablesdb/decrement-row-column.md +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -3,7 +3,7 @@ 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 + .setSession(''); // The user session to authenticate with TablesDb tablesDb = TablesDb(client); diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md index ad9d1b9d..35cc48d3 100644 --- a/docs/examples/tablesdb/increment-row-column.md +++ b/docs/examples/tablesdb/increment-row-column.md @@ -3,7 +3,7 @@ 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 + .setSession(''); // The user session to authenticate with TablesDb tablesDb = TablesDb(client); 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/query.dart b/lib/query.dart index c9a2fc91..281aa756 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if (attribute != null) { + if(attribute != null) { map['attribute'] = attribute; } - - if (values != null) { + + if(values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} +} \ 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 b1358d47..89246ea7 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,26 +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 @@ -29,32 +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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -63,442 +60,449 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 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; - 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() async { - final String apiPath = '/account/jwts'; + Future createJWT() async { + final String apiPath = '/account/jwts'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 apiParams = {'mfa': mfa}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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 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. - 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 apiParams = { + + 'otp': otp, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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. - Future createMfaChallenge({ - required enums.AuthenticationFactor factor, - }) async { - final String apiPath = '/account/mfa/challenge'; + Future createMfaChallenge({required enums.AuthenticationFactor factor}) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = {'factor': factor.value}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - Future updateMfaChallenge({ - required String challengeId, - required String otp, - }) async { - final String apiPath = '/account/mfa/challenge'; + Future updateMfaChallenge({required String challengeId, required String otp}) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { + 'challengeId': challengeId, - 'otp': otp, +'otp': otp, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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. - 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. - 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 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. - 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 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 apiParams = { + + 'name': name, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'oldPassword': oldPassword, +'oldPassword': oldPassword, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 apiParams = { + + 'prefs': prefs, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 @@ -508,98 +512,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}; + final Map apiParams = { + + 'email': email, +'url': url, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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; - } + 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 @@ -608,212 +613,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 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 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.') - Future updateMagicURLSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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.') - Future updatePhoneSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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; - } + 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 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 /// provided user ID has not be registered, a new user will be created. Use the @@ -821,34 +827,31 @@ 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, - 'phrase': phrase, +'email': email, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -859,79 +862,66 @@ 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, - 'url': url, - 'phrase': phrase, +'email': email, +'url': url, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { 'success': success, - 'failure': failure, - 'scopes': scopes, +'failure': failure, +'scopes': scopes, + 'project': client.config['project'], }; 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), - ); + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -939,16 +929,15 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri( - scheme: endpoint.scheme, + Uri url = Uri(scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&'), + 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 @@ -956,29 +945,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}; + final Map apiParams = { + + 'userId': userId, +'phone': phone, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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** @@ -989,52 +979,56 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'url': url}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 updateVerification({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/verification'; + Future updateVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 @@ -1044,44 +1038,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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/verification/phone'; + Future updatePhoneVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index 8033f1cd..a91d6d3f 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,255 +1,189 @@ 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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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, - 'width': width, - 'height': height, +'width': width, +'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 = { 'name': name, - 'width': width, - 'height': height, - 'background': background, +'width': width, +'height': height, +'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, - 'size': size, - 'margin': margin, - 'download': download, +'size': size, +'margin': margin, +'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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/databases.dart b/lib/services/databases.dart index ca557ea5..22e279fc 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1682 +1,1215 @@ 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, - }) 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}) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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.createDatabase` 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.createDatabase` instead.') + Future create({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases'; final Map apiParams = { + 'databaseId': databaseId, - 'name': name, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/databases/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDb.update` instead.') + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'collectionId': collectionId, - 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - List? permissions, - bool? documentSecurity, - bool? enabled, - }) 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + @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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + @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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return 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/{key}/relationship' - .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/{key}/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'onDelete': onDelete?.value, - 'newKey': newKey, +'newKey': newKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'documentId': documentId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - required Map data, - List? permissions, - }) 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, required Map data, List? permissions}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - 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; - } + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'attributes': attributes, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 index by 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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); - - 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; - } -} + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/functions.dart b/lib/services/functions.dart index e86f1afe..05a7d5f7 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,316 +1,256 @@ 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, - }) async { - final String apiPath = '/functions'; + Future list({List? queries, String? search}) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? specification, - }) 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? specification}) async { + final String apiPath = '/functions'; final Map apiParams = { + 'functionId': functionId, - 'name': name, - 'runtime': runtime.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'name': name, +'runtime': runtime.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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? specification, - }) 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? specification}) async { + final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'name': name, - 'runtime': runtime?.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'runtime': runtime?.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll( - '{functionId}', - functionId, - ); + Future listDeployments({required String functionId, List? queries, String? search}) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 = { + 'entrypoint': entrypoint, - 'commands': commands, - 'code': code, - 'activate': activate, +'commands': commands, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -325,446 +265,361 @@ 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, - 'buildId': buildId, +'buildId': buildId, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String functionId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/functions/{functionId}/deployments/template'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll( - '{functionId}', - functionId, - ); + Future createVcsDeployment({required String functionId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll( - '{functionId}', - functionId, - ); + Future listExecutions({required String functionId, List? queries}) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 = { + 'body': body, - 'async': xasync, - 'path': path, - 'method': method?.value, - 'headers': headers, - 'scheduledAt': scheduledAt, +'async': xasync, +'path': path, +'method': method?.value, +'headers': headers, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index 18eb54f1..e2418b52 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,49 +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 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; - 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 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/health.dart b/lib/services/health.dart index 5250c91d..0cf64ac6 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,414 +1,438 @@ 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.HealthStatus.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 = {'domain': domain}; + final Map apiParams = { + 'domain': domain, - 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.HealthCertificate.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.HealthStatus.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.HealthStatus.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = { + 'threshold': threshold, - final Map apiParams = {'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 = { 'name': name, - 'threshold': threshold, +'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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, - ); - - final Map apiParams = {'threshold': threshold}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future getFailedJobs({required enums.Name name, int? threshold}) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll('{name}', name.value); + + final Map apiParams = { + 'threshold': threshold, + + + }; + + final Map 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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 @@ -417,20 +441,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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 4d3cc3e0..430a00c3 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,164 +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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index afe3ee86..6147b8dc 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1478 +1,1160 @@ 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, - }) async { - final String apiPath = '/messaging/messages'; + Future listMessages({List? queries, String? search}) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'cc': cc, - 'bcc': bcc, - 'attachments': attachments, - 'draft': draft, - 'html': html, - 'scheduledAt': scheduledAt, +'subject': subject, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'cc': cc, +'bcc': bcc, +'attachments': attachments, +'draft': draft, +'html': html, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'title': title, - 'body': body, - 'topics': topics, - 'users': users, - 'targets': targets, - '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.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'title': title, +'body': body, +'topics': topics, +'users': users, +'targets': targets, +'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.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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'draft': draft, - 'scheduledAt': scheduledAt, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'draft': draft, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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 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 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; - return res.data; - } + } /// Get the message activity logs listed by its unique ID. - Future listMessageLogs({ - required String messageId, - List? queries, - }) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listMessageLogs({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/providers'; + Future listProviders({List? queries, String? search}) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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. - 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, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, - 'enabled': enabled, +'name': name, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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 = { + 'name': name, - 'enabled': enabled, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, +'enabled': enabled, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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 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. - 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 = { + 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'enabled': enabled, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'enabled': enabled, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, - 'enabled': enabled, +'name': name, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, +'enabled': enabled, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'enabled': enabled, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - 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 = { + 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'from': from, - 'customerId': customerId, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'customerId': customerId, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'customerId': customerId, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'customerId': customerId, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'username': username, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'username': username, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'username': username, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'username': username, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'accountSid': accountSid, - 'authToken': authToken, - 'enabled': enabled, +'name': name, +'from': from, +'accountSid': accountSid, +'authToken': authToken, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'accountSid': accountSid, - 'authToken': authToken, - 'from': from, +'enabled': enabled, +'accountSid': accountSid, +'authToken': authToken, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'enabled': enabled, +'name': name, +'from': from, +'apiKey': apiKey, +'apiSecret': apiSecret, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'from': from, +'enabled': enabled, +'apiKey': apiKey, +'apiSecret': apiSecret, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } + } /// Get the provider activity logs listed by its unique ID. - Future listProviderLogs({ - required String providerId, - List? queries, - }) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( - '{providerId}', - providerId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listProviderLogs({required String providerId, List? queries}) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs' - .replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs({required String subscriberId, List? queries}) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); + + final Map apiParams = { + 'queries': queries, - final Map apiParams = {'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.LogList.fromMap(res.data); - } + + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({ - List? queries, - String? search, - }) async { - final String apiPath = '/messaging/topics'; + Future listTopics({List? queries, String? search}) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'subscribe': subscribe, +'name': name, +'subscribe': subscribe, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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; - } + return res.data; + + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs({ - required String topicId, - List? queries, - }) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( - '{topicId}', - topicId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTopicLogs({required String topicId, List? queries}) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( - '{topicId}', - topicId, - ); + Future listSubscribers({required String topicId, List? queries, String? search}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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 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); - - 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; - } -} + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/sites.dart b/lib/services/sites.dart index d89f2192..5481986e 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,296 +1,247 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? outputDirectory, - enums.Adapter? adapter, - String? installationId, - String? fallbackFile, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites'; final Map apiParams = { + 'siteId': siteId, - 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime.value, - 'adapter': adapter?.value, - 'installationId': installationId, - 'fallbackFile': fallbackFile, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime.value, +'adapter': adapter?.value, +'installationId': installationId, +'fallbackFile': fallbackFile, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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? outputDirectory, - enums.BuildRuntime? buildRuntime, - enums.Adapter? adapter, - String? fallbackFile, - String? installationId, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime?.value, - 'adapter': adapter?.value, - 'fallbackFile': fallbackFile, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime?.value, +'adapter': adapter?.value, +'fallbackFile': fallbackFile, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future listDeployments({required String siteId, List? queries, String? search}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({ - required String siteId, - required InputFile code, - required bool activate, - String? installCommand, - String? buildCommand, - String? outputDirectory, - Function(UploadProgress)? onProgress, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'code': code, - 'activate': activate, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -305,400 +256,331 @@ 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String siteId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll( - '{siteId}', - siteId, - ); + Future createVcsDeployment({required String siteId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll( - '{siteId}', - siteId, - ); + Future listLogs({required String siteId, List? queries}) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ee630883..ccdce915 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,226 +1,184 @@ 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, - }) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({List? queries, String? search}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { + 'bucketId': bucketId, - 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'name': name, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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, - }) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( - '{bucketId}', - bucketId, - ); + Future listFiles({required String bucketId, List? queries, String? search}) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'permissions': permissions, +'file': file, +'permissions': permissions, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -236,187 +194,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 = { + 'name': name, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 = { 'width': width, - 'height': height, - 'gravity': gravity?.value, - 'quality': quality, - 'borderWidth': borderWidth, - 'borderColor': borderColor, - 'borderRadius': borderRadius, - 'opacity': opacity, - 'rotation': rotation, - 'background': background, - 'output': output?.value, - 'token': token, - +'height': height, +'gravity': gravity?.value, +'quality': quality, +'borderWidth': borderWidth, +'borderColor': borderColor, +'borderRadius': borderRadius, +'opacity': opacity, +'rotation': rotation, +'background': background, +'output': output?.value, +'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 = { '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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 7cf31d00..288d730b 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1520 +1,1162 @@ 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, - }) async { - final String apiPath = '/tablesdb'; + Future list({List? queries, String? search}) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( - '{databaseId}', - databaseId, - ); + Future listTables({required String databaseId, List? queries, String? search}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createTable({ - required String databaseId, - required String tableId, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'tableId': tableId, - 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future updateTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - return res.data; - } + } /// List columns in the table. - Future listColumns({ - required String databaseId, - required String tableId, - List? queries, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listColumns({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + 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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listIndexes({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'columns': columns, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + 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 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); - - 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; - } + 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 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRow({ - required String databaseId, - required String tableId, - required String rowId, - required Map data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'rowId': rowId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future createRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - /// - Future upsertRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future upsertRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future updateRows({required String databaseId, required String tableId, Map? data, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future deleteRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future getRow({required String databaseId, required String tableId, required String rowId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future upsertRow({ - required String databaseId, - required String tableId, - required String rowId, - Map? data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - 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; - } + Future deleteRow({required String databaseId, required String tableId, required String rowId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future decrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? min}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future incrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? max}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/teams.dart b/lib/services/teams.dart index 5fd59641..c21a93af 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,147 +1,140 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'roles': roles, +'name': name, +'roles': roles, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiParams = {'name': name}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - 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, - }) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll( - '{teamId}', - teamId, - ); + Future listMemberships({required String teamId, List? queries, String? search}) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 @@ -149,210 +142,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 = { + 'email': email, - 'userId': userId, - 'phone': phone, - 'roles': roles, - 'url': url, - 'name': name, +'userId': userId, +'phone': phone, +'roles': roles, +'url': url, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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, - ); + /// + 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); 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 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; - 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); - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index 4e6915dc..cb04449b 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,113 +1,109 @@ 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, - }) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future list({required String bucketId, required String fileId, List? queries}) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); - - 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, - ); + 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); 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 apiParams = {'expire': expire}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/users.dart b/lib/services/users.dart index c98182b7..e6f80be3 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,359 +1,314 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'password': password, - 'name': name, +'email': email, +'phone': phone, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = '/users/identities'; + Future listIdentities({List? queries, String? search}) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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; - 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordCpu': passwordCpu, +'passwordMemory': passwordMemory, +'passwordParallel': passwordParallel, +'passwordLength': passwordLength, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordSaltSeparator': passwordSaltSeparator, +'passwordSignerKey': passwordSignerKey, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'passwordVersion': passwordVersion?.value, - 'name': name, +'email': email, +'password': password, +'passwordVersion': passwordVersion?.value, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -361,748 +316,648 @@ 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 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; - 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, - ); - - 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, - ); + 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); 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 = { + 'sessionId': sessionId, - 'duration': duration, +'duration': duration, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// Get the user activity logs list by its unique ID. - Future listLogs({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/logs'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listLogs({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll( - '{userId}', - userId, - ); + Future listMemberships({required String userId, List? queries, String? search}) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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. - 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 apiParams = {'mfa': mfa}; + final Map apiHeaders = { + 'content-type': 'application/json', - 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. - 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 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; - return 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. - 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. - 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 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. - 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 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } + + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll( - '{userId}', - userId, - ); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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 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 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; - 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 apiHeaders = { + 'content-type': 'application/json', - 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; - 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// List the messaging targets that are associated with a user. - Future listTargets({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/targets'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - 'providerId': providerId, - 'name': name, +'providerType': providerType.value, +'identifier': identifier, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'identifier': identifier, - 'providerId': providerId, - 'name': name, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - 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, - ); - - final Map apiParams = {'length': length, 'expire': expire}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future createToken({required String userId, int? length, int? expire}) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll('{userId}', userId); + + final Map apiParams = { + + 'length': length, +'expire': expire, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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); - } -} + + } +} \ No newline at end of file diff --git a/lib/src/client.dart b/lib/src/client.dart index d82d623a..0d9be210 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,8 +81,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 08d93b85..cd82d264 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,25 +2,21 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index c961873f..ea2cd62a 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,11 +9,14 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -31,66 +34,59 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format': '1.8.0', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -139,11 +135,7 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -170,19 +162,12 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 2bd7d639..f9e695bf 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,11 +10,17 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => - ClientIO(endPoint: endPoint, selfSigned: selfSigned); +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => + ClientIO( + endPoint: endPoint, + selfSigned: selfSigned, + ); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -37,68 +43,60 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent': - 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format': '1.8.0', + 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -153,16 +151,11 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, - file.path!, - filename: file.filename, - ); + paramName, file.path!, + filename: file.filename); } else { - 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, @@ -201,19 +194,12 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -258,7 +244,10 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse(res, responseType: responseType); + return prepareResponse( + res, + responseType: responseType, + ); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 06c9ebe3..658b79b6 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest).fields.addAll({ - "$key[$i]": v.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({"$key[$i]": v.toString()}); }); } else { - (request as http.MultipartRequest).fields.addAll({ - key: value.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({key: value.toString()}); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value) { + params = params.map((key, value){ if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,13 +51,12 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port, - ); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -67,9 +66,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); @@ -116,25 +113,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.dart b/lib/src/enums.dart index 0f250ea3..595afdc2 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes, + bytes } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 3341912f..2f198d4e 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 1bae5c8a..cd45b6a1 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 42954430..7d2d7016 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,16 +1,18 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 e20f48c6..af5ebaad 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,24 +1,26 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index b101d35f..8d86530d 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({required this.value}); + const IndexType({ + 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/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/name.dart b/lib/src/enums/name.dart index 74823feb..613bf5f1 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,22 +1,24 @@ 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'), - 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'), + 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 383e45b1..076c1c50 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,50 +1,52 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d4fef930..d34440ec 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index f01fcb01..0bf8e2ad 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({required this.value}); + const VCSDeploymentType({ + 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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index 4145f701..f174d569 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 4e901476..c9f67200 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 35c7b767..2fabb416 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index 7d27adba..fdcee07a 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index fec6f65a..120723df 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 0e80700f..504b5f8f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 bae6618f..5f3e1654 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 0ca54691..20dd7189 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1df01f19..a5b27b4f 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 21f8e9a3..96ce554b 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 298c181a..a4953a0e 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c6eecadd..03ba94c7 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1ef48332..8a5aa89d 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8c8fcb73..d17f414a 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index c5fa6adc..4098a5a1 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "attributes": attributes}; - } + Map toMap() { + return { + "total": total, + "attributes": attributes, + }; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 903c6290..050cbe14 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7374fa78..2202d255 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index f0bc295e..0c3ddf9e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index b8fb5e48..3bb374be 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 9d5b771b..29c56fe4 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Buckets List class BucketList implements Model { - /// Total number of buckets rows that matched your query. - final int total; + /// Total number of buckets rows 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))), + ); + } - Map toMap() { - return {"total": total, "buckets": buckets.map((p) => p.toMap()).toList()}; - } + 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 72de429d..c55110cf 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index b5ff3518..81104b31 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Collections List class CollectionList implements Model { - /// Total number of collections rows that matched your query. - final int total; + /// Total number of collections rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 60fcfa48..0ffc8fea 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c21a2260..367686d0 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 15d80695..7deb5e26 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 558b7d43..7bb56922 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 3b2f1335..c0547e11 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 9d637d92..acf0f6df 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 7bea7426..66213f0a 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,24 +2,28 @@ part of '../../models.dart'; /// Column Indexes List class ColumnIndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 2ba463cd..3823f425 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6672d7ce..4ac1fa12 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 8eb0171f..475c1c40 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "columns": columns}; - } + Map toMap() { + return { + "total": total, + "columns": columns, + }; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index 6221c01e..e55d1534 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7b560989..6fd6a3b0 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 66c0ce7b..94271aa6 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 7318b7ad..1a9c5038 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 651b5ae4..60b008ef 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Continents List class ContinentList implements Model { - /// Total number of continents rows that matched your query. - final int total; + /// Total number of continents rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 c52b50f2..565b1d66 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,19 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index ea839b51..3a3acd49 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Countries List class CountryList implements Model { - /// Total number of countries rows that matched your query. - final int total; + /// Total number of countries rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 27eef0c1..deafffe3 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 2ff28c61..34274e00 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Currencies List class CurrencyList implements Model { - /// Total number of currencies rows that matched your query. - final int total; + /// Total number of currencies rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 8d79e052..cab95b02 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 01e092f2..940a9610 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Databases List class DatabaseList implements Model { - /// Total number of databases rows that matched your query. - final int total; + /// Total number of databases rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 448c62c7..ecf7e791 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 1ca87150..7a2a38c2 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Deployments List class DeploymentList implements Model { - /// Total number of deployments rows that matched your query. - final int total; + /// Total number of deployments rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index cf85e457..be424a9c 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 b897a877..90bce66f 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,30 +2,31 @@ part of '../../models.dart'; /// Documents List class DocumentList implements Model { - /// Total number of documents rows that matched your query. - final int total; + /// Total number of documents rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 8618bcd6..0cfdbb4e 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,122 +2,118 @@ 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 upate date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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.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(), - trigger: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "trigger": trigger, - "status": status, - "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 upate date in ISO 8601 format. + final String $updatedAt; + + /// Execution roles. + final List $permissions; + + /// Function ID. + final String functionId; + + /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + final String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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.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(), + trigger: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "trigger": trigger, + "status": status, + "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 583d9fab..c30098a6 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Executions List class ExecutionList implements Model { - /// Total number of executions rows that matched your query. - final int total; + /// Total number of executions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 a6a9fa46..de8439ec 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index e7ca1bd5..164a281f 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Files List class FileList implements Model { - /// Total number of files rows that matched your query. - final int total; + /// Total number of files rows 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))), + ); + } - Map toMap() { - return {"total": total, "files": files.map((p) => p.toMap()).toList()}; - } + 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 693c9b07..ea6b601a 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,48 +2,46 @@ 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)), - ), - ); - } - - 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))), + ); + } + + 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 0b908240..7614616a 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5661bec4..bd39632e 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Frameworks List class FrameworkList implements Model { - /// Total number of frameworks rows that matched your query. - final int total; + /// Total number of frameworks rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 56c2eded..64401c3f 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index 24b199b1..b40dd517 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,25 +2,28 @@ part of '../../models.dart'; /// Functions List class FunctionList implements Model { - /// Total number of functions rows that matched your query. - final int total; + /// Total number of functions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 463cf696..ecf0a178 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "value": value}; - } + Map toMap() { + return { + "name": name, + "value": value, + }; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index fa402e97..54c31e70 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return {"version": version, "status": status}; - } + Map toMap() { + return { + "version": version, + "status": status, + }; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index d412eba9..0a5b6ce9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5f06906b..95da1235 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,16 +2,22 @@ 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'], + ); + } - Map toMap() { - return {"size": size}; - } + Map toMap() { + return { + "size": size, + }; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 59b7092c..0d6e7216 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,26 +2,34 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return {"name": name, "ping": ping, "status": status}; - } + Map toMap() { + return { + "name": name, + "ping": ping, + "status": status, + }; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index dec2d54f..102dfe77 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,30 +2,34 @@ 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'], + ); + } - Map toMap() { - return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; - } + Map toMap() { + return { + "remoteTime": remoteTime, + "localTime": localTime, + "diff": diff, + }; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index 807bdfd0..c43c4d57 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 51ddb64a..52fa04a6 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Identities List class IdentityList implements Model { - /// Total number of identities rows that matched your query. - final int total; + /// Total number of identities rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 9d6d7aec..b6717c4e 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 65207b94..390e9039 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Indexes List class IndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 490a1824..1b4ff7de 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"jwt": jwt}; - } + Map toMap() { + return { + "jwt": jwt, + }; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 9c45adb1..43eaad08 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,26 +2,34 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code, "nativeName": nativeName}; - } + 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 76a3f548..755c4e29 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Languages List class LanguageList implements Model { - /// Total number of languages rows that matched your query. - final int total; + /// Total number of languages rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 084475bf..b5e9ad1a 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 cd5a1155..10499ef5 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"code": code, "name": name}; - } + 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 5fa5c0ce..9e1e6034 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Locale codes list class LocaleCodeList implements Model { - /// Total number of localeCodes rows that matched your query. - final int total; + /// Total number of localeCodes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 7fb3f364..cb567bd7 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 4a771585..636d9166 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Logs List class LogList implements Model { - /// Total number of logs rows that matched your query. - final int total; + /// Total number of logs rows 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))), + ); + } - Map toMap() { - return {"total": total, "logs": logs.map((p) => p.toMap()).toList()}; - } + 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 8ee142ad..26610e46 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index 993f7206..566afb17 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Memberships List class MembershipList implements Model { - /// Total number of memberships rows that matched your query. - final int total; + /// Total number of memberships rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 9b93b00d..c4e9e858 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index c577ccc1..c5082c8e 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Message list class MessageList implements Model { - /// Total number of messages rows that matched your query. - final int total; + /// Total number of messages rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 96bf3c65..46c166fb 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 c930a23e..d49989d8 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 63411988..6c8b4e36 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,18 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"recoveryCodes": recoveryCodes}; - } + Map toMap() { + return { + "recoveryCodes": recoveryCodes, + }; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index fa57cb8b..01cf0857 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"secret": secret, "uri": uri}; - } + Map toMap() { + return { + "secret": secret, + "uri": uri, + }; + } } 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/phone.dart b/lib/src/models/phone.dart index 40f7bcd2..c8bbb95b 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 497aa36c..a40e3591 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Phones List class PhoneList implements Model { - /// Total number of phones rows that matched your query. - final int total; + /// Total number of phones rows 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))), + ); + } - Map toMap() { - return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "phones": phones.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index 7bc3abc9..edb6083e 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,17 +2,23 @@ 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); - } + factory Preferences.fromMap(Map map) { + return Preferences( + data: map, + ); + } - Map toMap() { - return {"data": data}; - } + 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/provider.dart b/lib/src/models/provider.dart index 1a762f85..4295c486 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 6d579bd0..c71c810d 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Provider list class ProviderList implements Model { - /// Total number of providers rows that matched your query. - final int total; + /// Total number of providers rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index dad35dcc..ed520cc4 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 fcbcbc3a..3c2d985f 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,24 +2,28 @@ part of '../../models.dart'; /// Resource Tokens List class ResourceTokenList implements Model { - /// Total number of tokens rows that matched your query. - final int total; + /// Total number of tokens rows 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))), + ); + } - Map toMap() { - return {"total": total, "tokens": tokens.map((p) => p.toMap()).toList()}; - } + 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 3700e577..62e69e5b 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 ae3f851d..42bdbfea 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,25 +2,31 @@ part of '../../models.dart'; /// Rows List class RowList implements Model { - /// Total number of rows rows that matched your query. - final int total; + /// Total number of rows 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))), + ); + } - Map toMap() { - return {"total": total, "rows": rows.map((p) => p.toMap()).toList()}; - } + 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 7c9677d8..35f82cfa 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 b93dbb8f..e574c63c 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Runtimes List class RuntimeList implements Model { - /// Total number of runtimes rows that matched your query. - final int total; + /// Total number of runtimes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 d2fe4f64..3a1d955f 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 563b04a4..160cb789 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Sessions List class SessionList implements Model { - /// Total number of sessions rows that matched your query. - final int total; + /// Total number of sessions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 1449f8bd..5cda6acc 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index eb1a5457..3164546a 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Sites List class SiteList implements Model { - /// Total number of sites rows that matched your query. - final int total; + /// Total number of sites rows 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))), + ); + } - Map toMap() { - return {"total": total, "sites": sites.map((p) => p.toMap()).toList()}; - } + 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 e8fb8c75..e49d399c 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,35 +2,40 @@ 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(), + ); + } - Map toMap() { - return {"memory": memory, "cpus": cpus, "enabled": enabled, "slug": slug}; - } + 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 9a7d0154..040dbcc7 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Specifications List class SpecificationList implements Model { - /// Total number of specifications rows that matched your query. - final int total; + /// Total number of specifications rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 0c926297..36e18a7e 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 d5c6c01d..20ce6ca5 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Subscriber list class SubscriberList implements Model { - /// Total number of subscribers rows that matched your query. - final int total; + /// Total number of subscribers rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 7ce86b9d..1c5b88fb 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,78 +2,76 @@ 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; - 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, - }); + 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, + }); - 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)), - ), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 7398c48f..2c285e55 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Tables List class TableList implements Model { - /// Total number of tables rows that matched your query. - final int total; + /// Total number of tables rows 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))), + ); + } - Map toMap() { - return {"total": total, "tables": tables.map((p) => p.toMap()).toList()}; - } + 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 4be8b545..f2b3b6b4 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 29667c94..c3c250a5 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Target list class TargetList implements Model { - /// Total number of targets rows that matched your query. - final int total; + /// Total number of targets rows 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))), + ); + } - Map toMap() { - return {"total": total, "targets": targets.map((p) => p.toMap()).toList()}; - } + 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 43df33a8..e9058b5b 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 b70f12c1..3b8547ca 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Teams List class TeamList implements Model { - /// Total number of teams rows that matched your query. - final int total; + /// Total number of teams rows 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))), + ); + } - Map toMap() { - return {"total": total, "teams": teams.map((p) => p.toMap()).toList()}; - } + 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 35115467..4f6b8454 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 430d44ac..461d5694 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 69a17ebc..1c0fdb32 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Topic list class TopicList implements Model { - /// Total number of topics rows that matched your query. - final int total; + /// Total number of topics rows 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))), + ); + } - Map toMap() { - return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "topics": topics.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index 50bfb3ce..effc397c 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 56cc1b5b..75b8f53b 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Users List class UserList implements Model { - /// Total number of users rows that matched your query. - final int total; + /// Total number of users rows 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))), + ); + } - Map toMap() { - return {"total": total, "users": users.map((p) => p.toMap()).toList()}; - } + 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 2a8e276a..58882a9f 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 cd90d85f..da6e6982 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Variables List class VariableList implements Model { - /// Total number of variables rows that matched your query. - final int total; + /// Total number of variables rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } From 4c86a953e66d1ade8b5de21aba57c531cb1dbc3b Mon Sep 17 00:00:00 2001 From: abnegate Date: Wed, 20 Aug 2025 07:21:15 +0000 Subject: [PATCH 10/22] Commit from GitHub Actions (Format and push) --- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1191 +++++------ lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 ++++++++++++------- lib/services/functions.dart | 869 ++++---- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 +++-- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 1852 ++++++++++------- lib/services/sites.dart | 822 ++++---- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 +++++++++------- lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1349 ++++++------ lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 232 ++- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 ++-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 ++-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 ++-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +-- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 164 files changed, 12559 insertions(+), 11067 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/query.dart b/lib/query.dart index 281aa756..c9a2fc91 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if(attribute != null) { + if (attribute != null) { map['attribute'] = attribute; } - - if(values != null) { + + if (values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} \ 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 89246ea7..b1358d47 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,27 +1,26 @@ 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 +29,32 @@ 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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,449 +63,442 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.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); - - final Map apiParams = { - - - }; + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/account/identities/{identityId}'.replaceAll( + '{identityId}', + identityId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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; + 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() async { - final String apiPath = '/account/jwts'; + Future createJWT() async { + final String apiPath = '/account/jwts'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.LogList.fromMap(res.data); - - } + } /// Enable or disable MFA on an account. - Future updateMFA({required bool mfa}) async { - final String apiPath = '/account/mfa'; - - final Map apiParams = { - - 'mfa': 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 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. - Future createMfaAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - - final Map apiParams = { - - - }; + Future createMfaAuthenticator({ + required enums.AuthenticatorType type, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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, - - }; + Future updateMfaAuthenticator({ + required enums.AuthenticatorType type, + required String otp, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - - final Map apiParams = { - - - }; + Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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; + 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. - Future createMfaChallenge({required enums.AuthenticationFactor factor}) async { - final String apiPath = '/account/mfa/challenge'; + Future createMfaChallenge({ + required enums.AuthenticationFactor factor, + }) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = { - - 'factor': factor.value, - - }; + final Map apiParams = {'factor': factor.value}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - Future updateMfaChallenge({required String challengeId, required String otp}) async { - final String apiPath = '/account/mfa/challenge'; + Future updateMfaChallenge({ + required String challengeId, + required String otp, + }) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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. - 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. - Future createMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; - - final Map apiParams = { - - - }; + Future createMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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 apiHeaders = { - 'content-type': 'application/json', + 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 apiParams = {'name': name}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'oldPassword': oldPassword, - + 'oldPassword': oldPassword, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 apiParams = {'prefs': prefs}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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 @@ -512,99 +508,98 @@ 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, + final Map apiParams = {'email': email, 'url': url}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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 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'; - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteSessions() async { + final String apiPath = '/account/sessions'; - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 @@ -613,213 +608,212 @@ 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 apiHeaders = { - 'content-type': 'application/json', + 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 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.') - Future updateMagicURLSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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.') - Future updatePhoneSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + final Map apiParams = {'userId': userId, 'secret': secret}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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); - - final Map apiParams = { - - - }; + Future updateSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 apiHeaders = { - 'content-type': 'application/json', + 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 /// provided user ID has not be registered, a new user will be created. Use the @@ -827,31 +821,34 @@ 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, -'phrase': phrase, - + 'email': email, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 @@ -862,66 +859,79 @@ 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, -'url': url, -'phrase': phrase, - + 'email': email, + 'url': url, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { 'success': success, -'failure': failure, -'scopes': scopes, + 'failure': failure, + 'scopes': scopes, - 'project': client.config['project'], }; 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)); + query.add( + Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item), + ); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -929,15 +939,16 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri(scheme: endpoint.scheme, + Uri url = Uri( + scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&') + 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 @@ -945,30 +956,29 @@ 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, + final Map apiParams = {'userId': userId, 'phone': phone}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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** @@ -979,56 +989,52 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; - - final Map apiParams = { - - 'url': url, - - }; + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 updateVerification({required String userId, required String secret}) async { - final String apiPath = '/account/verification'; + Future updateVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification'; - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; + final Map apiParams = {'userId': userId, 'secret': secret}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -1038,47 +1044,44 @@ 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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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/verification/phone'; + Future updatePhoneVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; + final Map apiParams = {'userId': userId, 'secret': secret}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index a91d6d3f..8033f1cd 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,189 +1,255 @@ 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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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, -'width': width, -'height': height, + 'width': width, + '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 = { 'name': name, -'width': width, -'height': height, -'background': background, + 'width': width, + 'height': height, + '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, -'size': size, -'margin': margin, -'download': download, + 'size': size, + 'margin': margin, + '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 22e279fc..ca557ea5 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1215 +1,1682 @@ 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}) 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, + }) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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.createDatabase` 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.createDatabase` instead.', + ) + Future create({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases'; final Map apiParams = { - 'databaseId': databaseId, -'name': name, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, bool? enabled}) async { - final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDb.update` instead.', + ) + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'collectionId': collectionId, -'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) 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, + required String name, + List? permissions, + bool? documentSecurity, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + @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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + @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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return 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/{key}/relationship'.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/{key}/relationship' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'onDelete': onDelete?.value, -'newKey': newKey, - + 'newKey': newKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - } + } /// 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'documentId': documentId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + final Map apiParams = {'queries': queries}; + + final Map 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, required Map data, List? permissions}) 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, + required Map data, + List? permissions, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - 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; - - } + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'attributes': attributes, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 index by 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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); - - 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; - - } -} \ No newline at end of file + @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 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/functions.dart b/lib/services/functions.dart index 05a7d5f7..e86f1afe 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,256 +1,316 @@ 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}) async { - final String apiPath = '/functions'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? specification}) 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? specification, + }) async { + final String apiPath = '/functions'; final Map apiParams = { - 'functionId': functionId, -'name': name, -'runtime': runtime.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'name': name, + 'runtime': runtime.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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? specification}) 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? specification, + }) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'name': name, -'runtime': runtime?.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'runtime': runtime?.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String functionId}) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateFunctionDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployment'.replaceAll( + '{functionId}', + functionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); + Future listDeployments({ + required String functionId, + List? queries, + String? search, + }) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 = { - 'entrypoint': entrypoint, -'commands': commands, -'code': code, -'activate': activate, - + 'commands': commands, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -265,361 +325,446 @@ 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, -'buildId': buildId, - + 'buildId': buildId, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String functionId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/functions/{functionId}/deployments/template' + .replaceAll('{functionId}', functionId); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll('{functionId}', functionId); + Future createVcsDeployment({ + required String functionId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployments/{deploymentId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 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}) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - - final Map apiParams = { - 'queries': queries, + Future listExecutions({ + required String functionId, + List? queries, + }) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll( + '{functionId}', + functionId, + ); - - }; + final Map apiParams = {'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.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 = { - 'body': body, -'async': xasync, -'path': path, -'method': method?.value, -'headers': headers, -'scheduledAt': scheduledAt, - + 'async': xasync, + 'path': path, + 'method': method?.value, + 'headers': headers, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteExecution({ + required String functionId, + required String executionId, + }) async { + final String apiPath = '/functions/{functionId}/executions/{executionId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{executionId}', executionId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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, + }) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index e2418b52..18eb54f1 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,51 +1,49 @@ 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 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); - - return res.data; + 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 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); - - return res.data; + final res = await client.call( + HttpMethod.post, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/health.dart b/lib/services/health.dart index 0cf64ac6..5250c91d 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,438 +1,414 @@ 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.HealthStatus.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 = { - 'domain': domain, + final Map apiParams = {'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); - - } + } /// 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.HealthStatus.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.HealthStatus.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 = { - 'threshold': threshold, - - - }; + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueCertificates({int? threshold}) async { + final String apiPath = '/health/queue/certificates'; - - }; + final Map apiParams = {'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 = { 'name': name, -'threshold': threshold, - - + '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 = { - 'threshold': threshold, + final Map apiParams = {'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); - - final Map apiParams = { - 'threshold': threshold, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future getFailedJobs({ + required enums.Name name, + int? threshold, + }) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll( + '{name}', + name.value, + ); + + final Map apiParams = {'threshold': threshold}; + + final Map 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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueFunctions({int? threshold}) async { + final String apiPath = '/health/queue/functions'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueStatsResources({int? threshold}) async { + final String apiPath = '/health/queue/stats-resources'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 @@ -441,21 +417,20 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 430a00c3..4d3cc3e0 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,172 +1,164 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 6147b8dc..afe3ee86 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1160 +1,1478 @@ 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}) async { - final String apiPath = '/messaging/messages'; + Future listMessages({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'topics': topics, -'users': users, -'targets': targets, -'cc': cc, -'bcc': bcc, -'attachments': attachments, -'draft': draft, -'html': html, -'scheduledAt': scheduledAt, - + 'subject': subject, + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'cc': cc, + 'bcc': bcc, + 'attachments': attachments, + 'draft': draft, + 'html': html, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'title': title, -'body': body, -'topics': topics, -'users': users, -'targets': targets, -'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.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'title': title, + 'body': body, + 'topics': topics, + 'users': users, + 'targets': targets, + '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.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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'topics': topics, -'users': users, -'targets': targets, -'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'draft': draft, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - /// - 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 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); - - final Map apiParams = { - - - }; + Future delete({required String messageId}) async { + final String apiPath = '/messaging/messages/{messageId}'.replaceAll( + '{messageId}', + messageId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listMessageLogs({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/providers'; + Future listProviders({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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. - 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, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - 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 = { - 'name': name, -'enabled': enabled, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - 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 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. - 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 = { - 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'enabled': enabled, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'enabled': enabled, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, -'enabled': enabled, - + 'name': name, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, - + 'enabled': enabled, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'enabled': enabled, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - 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, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. - 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 = { - 'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, -'from': from, -'customerId': customerId, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'customerId': customerId, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'customerId': customerId, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'customerId': customerId, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'from': from, -'username': username, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'username': username, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'username': username, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'username': username, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'from': from, -'accountSid': accountSid, -'authToken': authToken, -'enabled': enabled, - + 'name': name, + 'from': from, + 'accountSid': accountSid, + 'authToken': authToken, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'accountSid': accountSid, -'authToken': authToken, -'from': from, - + 'enabled': enabled, + 'accountSid': accountSid, + 'authToken': authToken, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'from': from, -'apiKey': apiKey, -'apiSecret': apiSecret, -'enabled': enabled, - + 'name': name, + 'from': from, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'apiSecret': apiSecret, -'from': from, - + 'enabled': enabled, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteProvider({required String providerId}) async { + final String apiPath = '/messaging/providers/{providerId}'.replaceAll( + '{providerId}', + providerId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listProviderLogs({ + required String providerId, + List? queries, + }) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( + '{providerId}', + providerId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); - - final Map apiParams = { - 'queries': queries, + Future listSubscriberLogs({ + required String subscriberId, + List? queries, + }) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs' + .replaceAll('{subscriberId}', subscriberId); - - }; + final Map apiParams = {'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.LogList.fromMap(res.data); - - } + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({List? queries, String? search}) async { - final String apiPath = '/messaging/topics'; + Future listTopics({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'subscribe': subscribe, - + 'name': name, + 'subscribe': subscribe, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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; - - } + return res.data; + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs({required String topicId, List? queries}) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTopicLogs({ + required String topicId, + List? queries, + }) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( + '{topicId}', + topicId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); + Future listSubscribers({ + required String topicId, + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( + '{topicId}', + topicId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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 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); - - 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; - - } -} \ No newline at end of file + 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 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/sites.dart b/lib/services/sites.dart index 5481986e..d89f2192 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,247 +1,296 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.Adapter? adapter, + String? installationId, + String? fallbackFile, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites'; final Map apiParams = { - 'siteId': siteId, -'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime.value, -'adapter': adapter?.value, -'installationId': installationId, -'fallbackFile': fallbackFile, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime.value, + 'adapter': adapter?.value, + 'installationId': installationId, + 'fallbackFile': fallbackFile, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.BuildRuntime? buildRuntime, + enums.Adapter? adapter, + String? fallbackFile, + String? installationId, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime?.value, -'adapter': adapter?.value, -'fallbackFile': fallbackFile, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime?.value, + 'adapter': adapter?.value, + 'fallbackFile': fallbackFile, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + Future delete({required String siteId}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateSiteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployment'.replaceAll( + '{siteId}', + siteId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future listDeployments({ + required String siteId, + List? queries, + String? search, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future createDeployment({ + required String siteId, + required InputFile code, + required bool activate, + String? installCommand, + String? buildCommand, + String? outputDirectory, + Function(UploadProgress)? onProgress, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'code': code, -'activate': activate, - + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -256,331 +305,400 @@ 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, + 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 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String siteId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll('{siteId}', siteId); + Future createVcsDeployment({ + required String siteId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - 'queries': queries, + Future listLogs({ + required String siteId, + List? queries, + }) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll( + '{siteId}', + siteId, + ); - - }; + final Map apiParams = {'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.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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ccdce915..ee630883 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,184 +1,226 @@ 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}) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({ + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { - 'bucketId': bucketId, -'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'name': name, + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) 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, + }) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { - 'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteBucket({required String bucketId}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); + Future listFiles({ + required String bucketId, + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'permissions': permissions, - + 'file': file, + 'permissions': permissions, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -194,137 +236,187 @@ 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 = { - 'name': name, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 = { 'width': width, -'height': height, -'gravity': gravity?.value, -'quality': quality, -'borderWidth': borderWidth, -'borderColor': borderColor, -'borderRadius': borderRadius, -'opacity': opacity, -'rotation': rotation, -'background': background, -'output': output?.value, -'token': token, - - + 'height': height, + 'gravity': gravity?.value, + 'quality': quality, + 'borderWidth': borderWidth, + 'borderColor': borderColor, + 'borderRadius': borderRadius, + 'opacity': opacity, + 'rotation': rotation, + 'background': background, + 'output': output?.value, + '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 = { '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 288d730b..7cf31d00 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1162 +1,1520 @@ 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}) async { - final String apiPath = '/tablesdb'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, required String name, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + Future listTables({ + required String databaseId, + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'tableId': tableId, -'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future updateTable({ + required String databaseId, + required String tableId, + required String name, + List? permissions, + bool? rowSecurity, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteTable({ + required String databaseId, + required String tableId, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listColumns({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - /// - 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); + /// + 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - /// - 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); + /// + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + 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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + 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 apiHeaders = {'content-type': 'application/json'}; + + 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listIndexes({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'columns': columns, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + 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 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); - - 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; - - } + 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 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRow({required String databaseId, required String tableId, required String rowId, required Map data, List? permissions}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'rowId': rowId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + Future createRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - /// - Future upsertRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future upsertRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future updateRows({ + required String databaseId, + required String tableId, + Map? data, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + Future deleteRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future getRow({ + required String databaseId, + required String tableId, + required String rowId, + List? queries, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future upsertRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - 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; - - } + Future deleteRow({ + required String databaseId, + required String tableId, + required String rowId, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future decrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? min, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future incrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? max, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.patch, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); return models.Row.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/teams.dart b/lib/services/teams.dart index c21a93af..5fd59641 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,140 +1,147 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'roles': roles, - + 'name': name, + 'roles': roles, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - 'name': name, + 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 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); + Future listMemberships({ + required String teamId, + List? queries, + String? search, + }) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll( + '{teamId}', + teamId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 @@ -142,182 +149,210 @@ 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 = { - 'email': email, -'userId': userId, -'phone': phone, -'roles': roles, -'url': url, -'name': name, - + 'userId': userId, + 'phone': phone, + 'roles': roles, + 'url': url, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - 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); + /// + 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, + ); 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index cb04449b..4e6915dc 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,109 +1,113 @@ 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}) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future list({ + required String bucketId, + required String fileId, + List? queries, + }) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); + + final Map apiParams = {'queries': queries}; + + final Map 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); - - 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); + 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, + ); 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); - - final Map apiParams = { - - 'expire': expire, + 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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String tokenId}) async { + final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/users.dart b/lib/services/users.dart index e6f80be3..c98182b7 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,314 +1,359 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'password': password, -'name': name, - + 'email': email, + 'phone': phone, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/users/identities'; + Future listIdentities({ + List? queries, + String? search, + }) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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); - - final Map apiParams = { - - - }; + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/users/identities/{identityId}'.replaceAll( + '{identityId}', + identityId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordCpu': passwordCpu, + 'passwordMemory': passwordMemory, + 'passwordParallel': passwordParallel, + 'passwordLength': passwordLength, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordSaltSeparator': passwordSaltSeparator, + 'passwordSignerKey': passwordSignerKey, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'passwordVersion': passwordVersion?.value, -'name': name, - + 'email': email, + 'password': password, + 'passwordVersion': passwordVersion?.value, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -316,648 +361,748 @@ 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); - - final Map apiParams = { - - - }; + Future delete({required String userId}) async { + final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); 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 = { - 'sessionId': sessionId, -'duration': duration, - + 'duration': duration, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// Get the user activity logs list by its unique ID. - Future listLogs({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listLogs({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/logs'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); + Future listMemberships({ + required String userId, + List? queries, + String? search, + }) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll( + '{userId}', + userId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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. - Future updateMfa({required String userId, required bool mfa}) async { - final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); - - final Map apiParams = { - - 'mfa': mfa, - - }; + Future updateMfa({ + required String userId, + required bool mfa, + }) async { + final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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 = { - - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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. - 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. - 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. - Future updateMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; + Future updateMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - Future createMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; + Future createMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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); - - final Map apiParams = { - - - }; + Future createSession({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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 res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// List the messaging targets that are associated with a user. - Future listTargets({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/targets'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, -'providerId': providerId, -'name': name, - + 'providerType': providerType.value, + 'identifier': identifier, + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'identifier': identifier, -'providerId': providerId, -'name': name, - + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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 res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'length': length, -'expire': expire, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future createToken({ + required String userId, + int? length, + int? expire, + }) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'length': length, 'expire': expire}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/src/client.dart b/lib/src/client.dart index 0d9be210..d82d623a 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,7 +81,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 cd82d264..08d93b85 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,21 +2,25 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index ea2cd62a..c961873f 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,14 +9,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => +ClientBase createClient({required String endPoint, required bool selfSigned}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -34,59 +31,66 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format' : '1.8.0', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -135,7 +139,11 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -162,12 +170,19 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index f9e695bf..2bd7d639 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,17 +10,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => - ClientIO( - endPoint: endPoint, - selfSigned: selfSigned, - ); +ClientBase createClient({required String endPoint, required bool selfSigned}) => + ClientIO(endPoint: endPoint, selfSigned: selfSigned); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -43,60 +37,68 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format' : '1.8.0', + 'user-agent': + 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -151,11 +153,16 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, file.path!, - filename: file.filename); + paramName, + file.path!, + filename: file.filename, + ); } else { - 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, @@ -194,12 +201,19 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -244,10 +258,7 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse( - res, - responseType: responseType, - ); + return prepareResponse(res, responseType: responseType); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 658b79b6..06c9ebe3 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest) - .fields - .addAll({"$key[$i]": v.toString()}); + (request as http.MultipartRequest).fields.addAll({ + "$key[$i]": v.toString(), + }); }); } else { - (request as http.MultipartRequest) - .fields - .addAll({key: value.toString()}); + (request as http.MultipartRequest).fields.addAll({ + key: value.toString(), + }); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value){ + params = params.map((key, value) { if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,12 +51,13 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port, + ); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -66,7 +67,9 @@ 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); @@ -113,18 +116,25 @@ 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.dart b/lib/src/enums.dart index 595afdc2..0f250ea3 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes + bytes, } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 2f198d4e..3341912f 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 cd45b6a1..1bae5c8a 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 7d2d7016..42954430 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,18 +1,16 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 af5ebaad..e20f48c6 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,26 +1,24 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index 8d86530d..b101d35f 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({ - required this.value - }); + const IndexType({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/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/name.dart b/lib/src/enums/name.dart index 613bf5f1..74823feb 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,24 +1,22 @@ 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'), - 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'), + 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 076c1c50..383e45b1 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,52 +1,50 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d34440ec..d4fef930 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index 0bf8e2ad..f01fcb01 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({ - required this.value - }); + const VCSDeploymentType({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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index f174d569..4145f701 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 c9f67200..4e901476 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 2fabb416..35c7b767 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index fdcee07a..7d27adba 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index 120723df..fec6f65a 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 504b5f8f..0e80700f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 5f3e1654..bae6618f 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 20dd7189..0ca54691 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a5b27b4f..1df01f19 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 96ce554b..21f8e9a3 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a4953a0e..298c181a 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 03ba94c7..c6eecadd 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8a5aa89d..1ef48332 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 d17f414a..8c8fcb73 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index 4098a5a1..c5fa6adc 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "attributes": attributes, - }; - } + Map toMap() { + return {"total": total, "attributes": attributes}; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 050cbe14..903c6290 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 2202d255..7374fa78 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index 0c3ddf9e..f0bc295e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index 3bb374be..b8fb5e48 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 29c56fe4..9d5b771b 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Buckets List class BucketList implements Model { - /// Total number of buckets rows that matched your query. - final int total; + /// Total number of buckets rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "buckets": buckets.map((p) => p.toMap()).toList(), - }; - } + 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 c55110cf..72de429d 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 81104b31..b5ff3518 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Collections List class CollectionList implements Model { - /// Total number of collections rows that matched your query. - final int total; + /// Total number of collections rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 0ffc8fea..60fcfa48 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 367686d0..c21a2260 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7deb5e26..15d80695 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7bb56922..558b7d43 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c0547e11..3b2f1335 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 acf0f6df..9d637d92 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 66213f0a..7bea7426 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,28 +2,24 @@ part of '../../models.dart'; /// Column Indexes List class ColumnIndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 3823f425..2ba463cd 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 4ac1fa12..6672d7ce 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 475c1c40..8eb0171f 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "columns": columns, - }; - } + Map toMap() { + return {"total": total, "columns": columns}; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index e55d1534..6221c01e 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6fd6a3b0..7b560989 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 94271aa6..66c0ce7b 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 1a9c5038..7318b7ad 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 60b008ef..651b5ae4 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Continents List class ContinentList implements Model { - /// Total number of continents rows that matched your query. - final int total; + /// Total number of continents rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 565b1d66..c52b50f2 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,28 +2,19 @@ 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()); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 3a3acd49..ea839b51 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Countries List class CountryList implements Model { - /// Total number of countries rows that matched your query. - final int total; + /// Total number of countries rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 deafffe3..27eef0c1 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 34274e00..2ff28c61 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Currencies List class CurrencyList implements Model { - /// Total number of currencies rows that matched your query. - final int total; + /// Total number of currencies rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 cab95b02..8d79e052 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 940a9610..01e092f2 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Databases List class DatabaseList implements Model { - /// Total number of databases rows that matched your query. - final int total; + /// Total number of databases rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 ecf7e791..448c62c7 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 7a2a38c2..1ca87150 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Deployments List class DeploymentList implements Model { - /// Total number of deployments rows that matched your query. - final int total; + /// Total number of deployments rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index be424a9c..cf85e457 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 90bce66f..b897a877 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,31 +2,30 @@ part of '../../models.dart'; /// Documents List class DocumentList implements Model { - /// Total number of documents rows that matched your query. - final int total; + /// Total number of documents rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 0cfdbb4e..8618bcd6 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,118 +2,122 @@ 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 upate date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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.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(), - trigger: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "trigger": trigger, - "status": status, - "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 upate date in ISO 8601 format. + final String $updatedAt; + + /// Execution roles. + final List $permissions; + + /// Function ID. + final String functionId; + + /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + final String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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.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(), + trigger: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "trigger": trigger, + "status": status, + "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 c30098a6..583d9fab 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Executions List class ExecutionList implements Model { - /// Total number of executions rows that matched your query. - final int total; + /// Total number of executions rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 de8439ec..a6a9fa46 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 164a281f..e7ca1bd5 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Files List class FileList implements Model { - /// Total number of files rows that matched your query. - final int total; + /// Total number of files rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "files": files.map((p) => p.toMap()).toList(), - }; - } + 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 ea6b601a..693c9b07 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,46 +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))), - ); - } - - 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)), + ), + ); + } + + 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 7614616a..0b908240 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 bd39632e..5661bec4 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Frameworks List class FrameworkList implements Model { - /// Total number of frameworks rows that matched your query. - final int total; + /// Total number of frameworks rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 64401c3f..56c2eded 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index b40dd517..24b199b1 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,28 +2,25 @@ part of '../../models.dart'; /// Functions List class FunctionList implements Model { - /// Total number of functions rows that matched your query. - final int total; + /// Total number of functions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 ecf0a178..463cf696 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "value": value, - }; - } + Map toMap() { + return {"name": name, "value": value}; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index 54c31e70..fa402e97 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "version": version, - "status": status, - }; - } + Map toMap() { + return {"version": version, "status": status}; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index 0a5b6ce9..d412eba9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 95da1235..5f06906b 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,22 +2,16 @@ 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']); + } - Map toMap() { - return { - "size": size, - }; - } + Map toMap() { + return {"size": size}; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 0d6e7216..59b7092c 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,34 +2,26 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "name": name, - "ping": ping, - "status": status, - }; - } + Map toMap() { + return {"name": name, "ping": ping, "status": status}; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index 102dfe77..dec2d54f 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,34 +2,30 @@ 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'], + ); + } - Map toMap() { - return { - "remoteTime": remoteTime, - "localTime": localTime, - "diff": diff, - }; - } + Map toMap() { + return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index c43c4d57..807bdfd0 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 52fa04a6..51ddb64a 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Identities List class IdentityList implements Model { - /// Total number of identities rows that matched your query. - final int total; + /// Total number of identities rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 b6717c4e..9d6d7aec 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 390e9039..65207b94 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Indexes List class IndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 1b4ff7de..490a1824 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "jwt": jwt, - }; - } + Map toMap() { + return {"jwt": jwt}; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 43eaad08..9c45adb1 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,34 +2,26 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - "nativeName": nativeName, - }; - } + 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 755c4e29..76a3f548 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Languages List class LanguageList implements Model { - /// Total number of languages rows that matched your query. - final int total; + /// Total number of languages rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 b5e9ad1a..084475bf 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 10499ef5..cd5a1155 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "name": name, - }; - } + 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 9e1e6034..5fa5c0ce 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Locale codes list class LocaleCodeList implements Model { - /// Total number of localeCodes rows that matched your query. - final int total; + /// Total number of localeCodes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 cb567bd7..7fb3f364 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 636d9166..4a771585 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Logs List class LogList implements Model { - /// Total number of logs rows that matched your query. - final int total; + /// Total number of logs rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "logs": logs.map((p) => p.toMap()).toList(), - }; - } + 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 26610e46..8ee142ad 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index 566afb17..993f7206 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Memberships List class MembershipList implements Model { - /// Total number of memberships rows that matched your query. - final int total; + /// Total number of memberships rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 c4e9e858..9b93b00d 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index c5082c8e..c577ccc1 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Message list class MessageList implements Model { - /// Total number of messages rows that matched your query. - final int total; + /// Total number of messages rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 46c166fb..96bf3c65 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 d49989d8..c930a23e 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 6c8b4e36..63411988 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,22 +2,18 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "recoveryCodes": recoveryCodes, - }; - } + Map toMap() { + return {"recoveryCodes": recoveryCodes}; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index 01cf0857..fa57cb8b 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "secret": secret, - "uri": uri, - }; - } + Map toMap() { + return {"secret": secret, "uri": uri}; + } } 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/phone.dart b/lib/src/models/phone.dart index c8bbb95b..40f7bcd2 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 a40e3591..497aa36c 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Phones List class PhoneList implements Model { - /// Total number of phones rows that matched your query. - final int total; + /// Total number of phones rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "phones": phones.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index edb6083e..7bc3abc9 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,23 +2,17 @@ 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, - ); - } + factory Preferences.fromMap(Map map) { + return Preferences(data: map); + } - Map toMap() { - return { - "data": data, - }; - } + 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/provider.dart b/lib/src/models/provider.dart index 4295c486..1a762f85 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 c71c810d..6d579bd0 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Provider list class ProviderList implements Model { - /// Total number of providers rows that matched your query. - final int total; + /// Total number of providers rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index ed520cc4..dad35dcc 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 3c2d985f..fcbcbc3a 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,28 +2,24 @@ part of '../../models.dart'; /// Resource Tokens List class ResourceTokenList implements Model { - /// Total number of tokens rows that matched your query. - final int total; + /// Total number of tokens rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "tokens": tokens.map((p) => p.toMap()).toList(), - }; - } + 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 62e69e5b..3700e577 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 42bdbfea..ae3f851d 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,31 +2,25 @@ part of '../../models.dart'; /// Rows List class RowList implements Model { - /// Total number of rows rows that matched your query. - final int total; + /// Total number of rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "rows": rows.map((p) => p.toMap()).toList(), - }; - } + 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 35f82cfa..7c9677d8 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 e574c63c..b93dbb8f 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Runtimes List class RuntimeList implements Model { - /// Total number of runtimes rows that matched your query. - final int total; + /// Total number of runtimes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 3a1d955f..d2fe4f64 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 160cb789..563b04a4 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Sessions List class SessionList implements Model { - /// Total number of sessions rows that matched your query. - final int total; + /// Total number of sessions rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 5cda6acc..1449f8bd 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index 3164546a..eb1a5457 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Sites List class SiteList implements Model { - /// Total number of sites rows that matched your query. - final int total; + /// Total number of sites rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "sites": sites.map((p) => p.toMap()).toList(), - }; - } + 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 e49d399c..e8fb8c75 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,40 +2,35 @@ 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(), + ); + } - Map toMap() { - return { - "memory": memory, - "cpus": cpus, - "enabled": enabled, - "slug": slug, - }; - } + 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 040dbcc7..9a7d0154 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Specifications List class SpecificationList implements Model { - /// Total number of specifications rows that matched your query. - final int total; + /// Total number of specifications rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 36e18a7e..0c926297 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 20ce6ca5..d5c6c01d 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Subscriber list class SubscriberList implements Model { - /// Total number of subscribers rows that matched your query. - final int total; + /// Total number of subscribers rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 1c5b88fb..7ce86b9d 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,76 +2,78 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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)), + ), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 2c285e55..7398c48f 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Tables List class TableList implements Model { - /// Total number of tables rows that matched your query. - final int total; + /// Total number of tables rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "tables": tables.map((p) => p.toMap()).toList(), - }; - } + 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 f2b3b6b4..4be8b545 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 c3c250a5..29667c94 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Target list class TargetList implements Model { - /// Total number of targets rows that matched your query. - final int total; + /// Total number of targets rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "targets": targets.map((p) => p.toMap()).toList(), - }; - } + 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 e9058b5b..43df33a8 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 3b8547ca..b70f12c1 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Teams List class TeamList implements Model { - /// Total number of teams rows that matched your query. - final int total; + /// Total number of teams rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "teams": teams.map((p) => p.toMap()).toList(), - }; - } + 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 4f6b8454..35115467 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 461d5694..430d44ac 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 1c0fdb32..69a17ebc 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Topic list class TopicList implements Model { - /// Total number of topics rows that matched your query. - final int total; + /// Total number of topics rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "topics": topics.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index effc397c..50bfb3ce 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 75b8f53b..56cc1b5b 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Users List class UserList implements Model { - /// Total number of users rows that matched your query. - final int total; + /// Total number of users rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "users": users.map((p) => p.toMap()).toList(), - }; - } + 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 58882a9f..2a8e276a 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 da6e6982..cd90d85f 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Variables List class VariableList implements Model { - /// Total number of variables rows that matched your query. - final int total; + /// Total number of variables rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } From 92d084b97a49c9554e7bb6c8733e7a800aed9ca8 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 20 Aug 2025 21:36:29 +1200 Subject: [PATCH 11/22] Add 1.8.x support --- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1191 ++++++----- lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 +++++++------------ lib/services/functions.dart | 869 ++++---- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 ++--- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 1852 +++++++---------- lib/services/sites.dart | 822 ++++---- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 +++++++--------- lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1349 ++++++------ lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 232 +-- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 ++-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 ++-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 ++-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +-- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 164 files changed, 11067 insertions(+), 12559 deletions(-) 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/query.dart b/lib/query.dart index c9a2fc91..281aa756 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if (attribute != null) { + if(attribute != null) { map['attribute'] = attribute; } - - if (values != null) { + + if(values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} +} \ 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 b1358d47..89246ea7 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,26 +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 @@ -29,32 +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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -63,442 +60,449 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 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; - 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() async { - final String apiPath = '/account/jwts'; + Future createJWT() async { + final String apiPath = '/account/jwts'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 apiParams = {'mfa': mfa}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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 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. - 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 apiParams = { + + 'otp': otp, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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. - Future createMfaChallenge({ - required enums.AuthenticationFactor factor, - }) async { - final String apiPath = '/account/mfa/challenge'; + Future createMfaChallenge({required enums.AuthenticationFactor factor}) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = {'factor': factor.value}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - Future updateMfaChallenge({ - required String challengeId, - required String otp, - }) async { - final String apiPath = '/account/mfa/challenge'; + Future updateMfaChallenge({required String challengeId, required String otp}) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { + 'challengeId': challengeId, - 'otp': otp, +'otp': otp, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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. - 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. - 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 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. - 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 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 apiParams = { + + 'name': name, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'oldPassword': oldPassword, +'oldPassword': oldPassword, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 apiParams = { + + 'prefs': prefs, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 @@ -508,98 +512,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}; + final Map apiParams = { + + 'email': email, +'url': url, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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; - } + 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 @@ -608,212 +613,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 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 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.') - Future updateMagicURLSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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.') - Future updatePhoneSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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; - } + 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 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 /// provided user ID has not be registered, a new user will be created. Use the @@ -821,34 +827,31 @@ 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, - 'phrase': phrase, +'email': email, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -859,79 +862,66 @@ 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, - 'url': url, - 'phrase': phrase, +'email': email, +'url': url, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { 'success': success, - 'failure': failure, - 'scopes': scopes, +'failure': failure, +'scopes': scopes, + 'project': client.config['project'], }; 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), - ); + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -939,16 +929,15 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri( - scheme: endpoint.scheme, + Uri url = Uri(scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&'), + 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 @@ -956,29 +945,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}; + final Map apiParams = { + + 'userId': userId, +'phone': phone, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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** @@ -989,52 +979,56 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'url': url}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 updateVerification({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/verification'; + Future updateVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 @@ -1044,44 +1038,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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/verification/phone'; + Future updatePhoneVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index 8033f1cd..a91d6d3f 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,255 +1,189 @@ 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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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, - 'width': width, - 'height': height, +'width': width, +'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 = { 'name': name, - 'width': width, - 'height': height, - 'background': background, +'width': width, +'height': height, +'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, - 'size': size, - 'margin': margin, - 'download': download, +'size': size, +'margin': margin, +'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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/databases.dart b/lib/services/databases.dart index ca557ea5..22e279fc 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1682 +1,1215 @@ 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, - }) 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}) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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.createDatabase` 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.createDatabase` instead.') + Future create({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases'; final Map apiParams = { + 'databaseId': databaseId, - 'name': name, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/databases/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDb.update` instead.') + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'collectionId': collectionId, - 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - List? permissions, - bool? documentSecurity, - bool? enabled, - }) 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + @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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + @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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return 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/{key}/relationship' - .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/{key}/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'onDelete': onDelete?.value, - 'newKey': newKey, +'newKey': newKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'documentId': documentId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - required Map data, - List? permissions, - }) 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, required Map data, List? permissions}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - 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; - } + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'attributes': attributes, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 index by 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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); - - 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; - } -} + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/functions.dart b/lib/services/functions.dart index e86f1afe..05a7d5f7 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,316 +1,256 @@ 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, - }) async { - final String apiPath = '/functions'; + Future list({List? queries, String? search}) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? specification, - }) 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? specification}) async { + final String apiPath = '/functions'; final Map apiParams = { + 'functionId': functionId, - 'name': name, - 'runtime': runtime.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'name': name, +'runtime': runtime.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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? specification, - }) 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? specification}) async { + final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'name': name, - 'runtime': runtime?.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'runtime': runtime?.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll( - '{functionId}', - functionId, - ); + Future listDeployments({required String functionId, List? queries, String? search}) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 = { + 'entrypoint': entrypoint, - 'commands': commands, - 'code': code, - 'activate': activate, +'commands': commands, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -325,446 +265,361 @@ 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, - 'buildId': buildId, +'buildId': buildId, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String functionId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/functions/{functionId}/deployments/template'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll( - '{functionId}', - functionId, - ); + Future createVcsDeployment({required String functionId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll( - '{functionId}', - functionId, - ); + Future listExecutions({required String functionId, List? queries}) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 = { + 'body': body, - 'async': xasync, - 'path': path, - 'method': method?.value, - 'headers': headers, - 'scheduledAt': scheduledAt, +'async': xasync, +'path': path, +'method': method?.value, +'headers': headers, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index 18eb54f1..e2418b52 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,49 +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 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; - 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 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/health.dart b/lib/services/health.dart index 5250c91d..0cf64ac6 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,414 +1,438 @@ 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.HealthStatus.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 = {'domain': domain}; + final Map apiParams = { + 'domain': domain, - 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.HealthCertificate.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.HealthStatus.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.HealthStatus.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = { + 'threshold': threshold, - final Map apiParams = {'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 = { 'name': name, - 'threshold': threshold, +'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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, - ); - - final Map apiParams = {'threshold': threshold}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future getFailedJobs({required enums.Name name, int? threshold}) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll('{name}', name.value); + + final Map apiParams = { + 'threshold': threshold, + + + }; + + final Map 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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 @@ -417,20 +441,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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 4d3cc3e0..430a00c3 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,164 +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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index afe3ee86..6147b8dc 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1478 +1,1160 @@ 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, - }) async { - final String apiPath = '/messaging/messages'; + Future listMessages({List? queries, String? search}) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'cc': cc, - 'bcc': bcc, - 'attachments': attachments, - 'draft': draft, - 'html': html, - 'scheduledAt': scheduledAt, +'subject': subject, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'cc': cc, +'bcc': bcc, +'attachments': attachments, +'draft': draft, +'html': html, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'title': title, - 'body': body, - 'topics': topics, - 'users': users, - 'targets': targets, - '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.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'title': title, +'body': body, +'topics': topics, +'users': users, +'targets': targets, +'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.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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'draft': draft, - 'scheduledAt': scheduledAt, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'draft': draft, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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 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 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; - return res.data; - } + } /// Get the message activity logs listed by its unique ID. - Future listMessageLogs({ - required String messageId, - List? queries, - }) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listMessageLogs({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/providers'; + Future listProviders({List? queries, String? search}) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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. - 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, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, - 'enabled': enabled, +'name': name, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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 = { + 'name': name, - 'enabled': enabled, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, +'enabled': enabled, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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 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. - 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 = { + 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'enabled': enabled, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'enabled': enabled, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, - 'enabled': enabled, +'name': name, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, +'enabled': enabled, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'enabled': enabled, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - 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, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - 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 = { + 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'from': from, - 'customerId': customerId, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'customerId': customerId, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'customerId': customerId, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'customerId': customerId, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'username': username, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'username': username, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'username': username, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'username': username, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'accountSid': accountSid, - 'authToken': authToken, - 'enabled': enabled, +'name': name, +'from': from, +'accountSid': accountSid, +'authToken': authToken, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'accountSid': accountSid, - 'authToken': authToken, - 'from': from, +'enabled': enabled, +'accountSid': accountSid, +'authToken': authToken, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'enabled': enabled, +'name': name, +'from': from, +'apiKey': apiKey, +'apiSecret': apiSecret, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'from': from, +'enabled': enabled, +'apiKey': apiKey, +'apiSecret': apiSecret, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } + } /// Get the provider activity logs listed by its unique ID. - Future listProviderLogs({ - required String providerId, - List? queries, - }) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( - '{providerId}', - providerId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listProviderLogs({required String providerId, List? queries}) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs' - .replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs({required String subscriberId, List? queries}) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); + + final Map apiParams = { + 'queries': queries, - final Map apiParams = {'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.LogList.fromMap(res.data); - } + + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({ - List? queries, - String? search, - }) async { - final String apiPath = '/messaging/topics'; + Future listTopics({List? queries, String? search}) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'subscribe': subscribe, +'name': name, +'subscribe': subscribe, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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; - } + return res.data; + + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs({ - required String topicId, - List? queries, - }) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( - '{topicId}', - topicId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTopicLogs({required String topicId, List? queries}) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( - '{topicId}', - topicId, - ); + Future listSubscribers({required String topicId, List? queries, String? search}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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 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); - - 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; - } -} + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/sites.dart b/lib/services/sites.dart index d89f2192..5481986e 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,296 +1,247 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? outputDirectory, - enums.Adapter? adapter, - String? installationId, - String? fallbackFile, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites'; final Map apiParams = { + 'siteId': siteId, - 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime.value, - 'adapter': adapter?.value, - 'installationId': installationId, - 'fallbackFile': fallbackFile, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime.value, +'adapter': adapter?.value, +'installationId': installationId, +'fallbackFile': fallbackFile, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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? outputDirectory, - enums.BuildRuntime? buildRuntime, - enums.Adapter? adapter, - String? fallbackFile, - String? installationId, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime?.value, - 'adapter': adapter?.value, - 'fallbackFile': fallbackFile, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime?.value, +'adapter': adapter?.value, +'fallbackFile': fallbackFile, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future listDeployments({required String siteId, List? queries, String? search}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({ - required String siteId, - required InputFile code, - required bool activate, - String? installCommand, - String? buildCommand, - String? outputDirectory, - Function(UploadProgress)? onProgress, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'code': code, - 'activate': activate, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -305,400 +256,331 @@ 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String siteId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll( - '{siteId}', - siteId, - ); + Future createVcsDeployment({required String siteId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll( - '{siteId}', - siteId, - ); + Future listLogs({required String siteId, List? queries}) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ee630883..ccdce915 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,226 +1,184 @@ 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, - }) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({List? queries, String? search}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { + 'bucketId': bucketId, - 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'name': name, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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, - }) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( - '{bucketId}', - bucketId, - ); + Future listFiles({required String bucketId, List? queries, String? search}) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'permissions': permissions, +'file': file, +'permissions': permissions, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -236,187 +194,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 = { + 'name': name, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 = { 'width': width, - 'height': height, - 'gravity': gravity?.value, - 'quality': quality, - 'borderWidth': borderWidth, - 'borderColor': borderColor, - 'borderRadius': borderRadius, - 'opacity': opacity, - 'rotation': rotation, - 'background': background, - 'output': output?.value, - 'token': token, - +'height': height, +'gravity': gravity?.value, +'quality': quality, +'borderWidth': borderWidth, +'borderColor': borderColor, +'borderRadius': borderRadius, +'opacity': opacity, +'rotation': rotation, +'background': background, +'output': output?.value, +'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 = { '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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 7cf31d00..288d730b 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1520 +1,1162 @@ 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, - }) async { - final String apiPath = '/tablesdb'; + Future list({List? queries, String? search}) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( - '{databaseId}', - databaseId, - ); + Future listTables({required String databaseId, List? queries, String? search}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createTable({ - required String databaseId, - required String tableId, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'tableId': tableId, - 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future updateTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - return res.data; - } + } /// List columns in the table. - Future listColumns({ - required String databaseId, - required String tableId, - List? queries, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listColumns({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + 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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listIndexes({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'columns': columns, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + 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 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); - - 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; - } + 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 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRow({ - required String databaseId, - required String tableId, - required String rowId, - required Map data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'rowId': rowId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future createRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - /// - Future upsertRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future upsertRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future updateRows({required String databaseId, required String tableId, Map? data, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future deleteRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future getRow({required String databaseId, required String tableId, required String rowId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future upsertRow({ - required String databaseId, - required String tableId, - required String rowId, - Map? data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - 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; - } + Future deleteRow({required String databaseId, required String tableId, required String rowId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future decrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? min}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future incrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? max}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/teams.dart b/lib/services/teams.dart index 5fd59641..c21a93af 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,147 +1,140 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'roles': roles, +'name': name, +'roles': roles, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiParams = {'name': name}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - 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, - }) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll( - '{teamId}', - teamId, - ); + Future listMemberships({required String teamId, List? queries, String? search}) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 @@ -149,210 +142,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 = { + 'email': email, - 'userId': userId, - 'phone': phone, - 'roles': roles, - 'url': url, - 'name': name, +'userId': userId, +'phone': phone, +'roles': roles, +'url': url, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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, - ); + /// + 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); 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 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; - 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); - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index 4e6915dc..cb04449b 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,113 +1,109 @@ 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, - }) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future list({required String bucketId, required String fileId, List? queries}) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); - - 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, - ); + 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); 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 apiParams = {'expire': expire}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/users.dart b/lib/services/users.dart index c98182b7..e6f80be3 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,359 +1,314 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'password': password, - 'name': name, +'email': email, +'phone': phone, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = '/users/identities'; + Future listIdentities({List? queries, String? search}) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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; - 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordCpu': passwordCpu, +'passwordMemory': passwordMemory, +'passwordParallel': passwordParallel, +'passwordLength': passwordLength, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordSaltSeparator': passwordSaltSeparator, +'passwordSignerKey': passwordSignerKey, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'passwordVersion': passwordVersion?.value, - 'name': name, +'email': email, +'password': password, +'passwordVersion': passwordVersion?.value, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -361,748 +316,648 @@ 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 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; - 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, - ); - - 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, - ); + 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); 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 = { + 'sessionId': sessionId, - 'duration': duration, +'duration': duration, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// Get the user activity logs list by its unique ID. - Future listLogs({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/logs'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listLogs({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll( - '{userId}', - userId, - ); + Future listMemberships({required String userId, List? queries, String? search}) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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. - 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 apiParams = {'mfa': mfa}; + final Map apiHeaders = { + 'content-type': 'application/json', - 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. - 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 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; - return 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. - 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. - 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 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. - 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 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } + + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll( - '{userId}', - userId, - ); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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 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 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; - 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 apiHeaders = { + 'content-type': 'application/json', - 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; - 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// List the messaging targets that are associated with a user. - Future listTargets({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/targets'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - 'providerId': providerId, - 'name': name, +'providerType': providerType.value, +'identifier': identifier, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'identifier': identifier, - 'providerId': providerId, - 'name': name, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - 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, - ); - - final Map apiParams = {'length': length, 'expire': expire}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future createToken({required String userId, int? length, int? expire}) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll('{userId}', userId); + + final Map apiParams = { + + 'length': length, +'expire': expire, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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); - } -} + + } +} \ No newline at end of file diff --git a/lib/src/client.dart b/lib/src/client.dart index d82d623a..0d9be210 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,8 +81,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 08d93b85..cd82d264 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,25 +2,21 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index c961873f..ea2cd62a 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,11 +9,14 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -31,66 +34,59 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format': '1.8.0', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -139,11 +135,7 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -170,19 +162,12 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 2bd7d639..f9e695bf 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,11 +10,17 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => - ClientIO(endPoint: endPoint, selfSigned: selfSigned); +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => + ClientIO( + endPoint: endPoint, + selfSigned: selfSigned, + ); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -37,68 +43,60 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent': - 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format': '1.8.0', + 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -153,16 +151,11 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, - file.path!, - filename: file.filename, - ); + paramName, file.path!, + filename: file.filename); } else { - 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, @@ -201,19 +194,12 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -258,7 +244,10 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse(res, responseType: responseType); + return prepareResponse( + res, + responseType: responseType, + ); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 06c9ebe3..658b79b6 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest).fields.addAll({ - "$key[$i]": v.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({"$key[$i]": v.toString()}); }); } else { - (request as http.MultipartRequest).fields.addAll({ - key: value.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({key: value.toString()}); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value) { + params = params.map((key, value){ if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,13 +51,12 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port, - ); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -67,9 +66,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); @@ -116,25 +113,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.dart b/lib/src/enums.dart index 0f250ea3..595afdc2 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes, + bytes } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 3341912f..2f198d4e 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 1bae5c8a..cd45b6a1 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 42954430..7d2d7016 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,16 +1,18 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 e20f48c6..af5ebaad 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,24 +1,26 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index b101d35f..8d86530d 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({required this.value}); + const IndexType({ + 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/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/name.dart b/lib/src/enums/name.dart index 74823feb..613bf5f1 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,22 +1,24 @@ 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'), - 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'), + 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 383e45b1..076c1c50 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,50 +1,52 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d4fef930..d34440ec 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index f01fcb01..0bf8e2ad 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({required this.value}); + const VCSDeploymentType({ + 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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index 4145f701..f174d569 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 4e901476..c9f67200 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 35c7b767..2fabb416 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index 7d27adba..fdcee07a 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index fec6f65a..120723df 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 0e80700f..504b5f8f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 bae6618f..5f3e1654 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 0ca54691..20dd7189 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1df01f19..a5b27b4f 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 21f8e9a3..96ce554b 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 298c181a..a4953a0e 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c6eecadd..03ba94c7 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1ef48332..8a5aa89d 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8c8fcb73..d17f414a 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index c5fa6adc..4098a5a1 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "attributes": attributes}; - } + Map toMap() { + return { + "total": total, + "attributes": attributes, + }; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 903c6290..050cbe14 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7374fa78..2202d255 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index f0bc295e..0c3ddf9e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index b8fb5e48..3bb374be 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 9d5b771b..29c56fe4 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Buckets List class BucketList implements Model { - /// Total number of buckets rows that matched your query. - final int total; + /// Total number of buckets rows 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))), + ); + } - Map toMap() { - return {"total": total, "buckets": buckets.map((p) => p.toMap()).toList()}; - } + 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 72de429d..c55110cf 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index b5ff3518..81104b31 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Collections List class CollectionList implements Model { - /// Total number of collections rows that matched your query. - final int total; + /// Total number of collections rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 60fcfa48..0ffc8fea 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c21a2260..367686d0 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 15d80695..7deb5e26 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 558b7d43..7bb56922 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 3b2f1335..c0547e11 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 9d637d92..acf0f6df 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 7bea7426..66213f0a 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,24 +2,28 @@ part of '../../models.dart'; /// Column Indexes List class ColumnIndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 2ba463cd..3823f425 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6672d7ce..4ac1fa12 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 8eb0171f..475c1c40 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "columns": columns}; - } + Map toMap() { + return { + "total": total, + "columns": columns, + }; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index 6221c01e..e55d1534 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7b560989..6fd6a3b0 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 66c0ce7b..94271aa6 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 7318b7ad..1a9c5038 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 651b5ae4..60b008ef 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Continents List class ContinentList implements Model { - /// Total number of continents rows that matched your query. - final int total; + /// Total number of continents rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 c52b50f2..565b1d66 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,19 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index ea839b51..3a3acd49 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Countries List class CountryList implements Model { - /// Total number of countries rows that matched your query. - final int total; + /// Total number of countries rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 27eef0c1..deafffe3 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 2ff28c61..34274e00 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Currencies List class CurrencyList implements Model { - /// Total number of currencies rows that matched your query. - final int total; + /// Total number of currencies rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 8d79e052..cab95b02 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 01e092f2..940a9610 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Databases List class DatabaseList implements Model { - /// Total number of databases rows that matched your query. - final int total; + /// Total number of databases rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 448c62c7..ecf7e791 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 1ca87150..7a2a38c2 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Deployments List class DeploymentList implements Model { - /// Total number of deployments rows that matched your query. - final int total; + /// Total number of deployments rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index cf85e457..be424a9c 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 b897a877..90bce66f 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,30 +2,31 @@ part of '../../models.dart'; /// Documents List class DocumentList implements Model { - /// Total number of documents rows that matched your query. - final int total; + /// Total number of documents rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 8618bcd6..0cfdbb4e 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,122 +2,118 @@ 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 upate date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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.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(), - trigger: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "trigger": trigger, - "status": status, - "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 upate date in ISO 8601 format. + final String $updatedAt; + + /// Execution roles. + final List $permissions; + + /// Function ID. + final String functionId; + + /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + final String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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.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(), + trigger: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "trigger": trigger, + "status": status, + "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 583d9fab..c30098a6 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Executions List class ExecutionList implements Model { - /// Total number of executions rows that matched your query. - final int total; + /// Total number of executions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 a6a9fa46..de8439ec 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index e7ca1bd5..164a281f 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Files List class FileList implements Model { - /// Total number of files rows that matched your query. - final int total; + /// Total number of files rows 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))), + ); + } - Map toMap() { - return {"total": total, "files": files.map((p) => p.toMap()).toList()}; - } + 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 693c9b07..ea6b601a 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,48 +2,46 @@ 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)), - ), - ); - } - - 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))), + ); + } + + 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 0b908240..7614616a 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5661bec4..bd39632e 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Frameworks List class FrameworkList implements Model { - /// Total number of frameworks rows that matched your query. - final int total; + /// Total number of frameworks rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 56c2eded..64401c3f 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index 24b199b1..b40dd517 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,25 +2,28 @@ part of '../../models.dart'; /// Functions List class FunctionList implements Model { - /// Total number of functions rows that matched your query. - final int total; + /// Total number of functions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 463cf696..ecf0a178 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "value": value}; - } + Map toMap() { + return { + "name": name, + "value": value, + }; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index fa402e97..54c31e70 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return {"version": version, "status": status}; - } + Map toMap() { + return { + "version": version, + "status": status, + }; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index d412eba9..0a5b6ce9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5f06906b..95da1235 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,16 +2,22 @@ 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'], + ); + } - Map toMap() { - return {"size": size}; - } + Map toMap() { + return { + "size": size, + }; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 59b7092c..0d6e7216 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,26 +2,34 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return {"name": name, "ping": ping, "status": status}; - } + Map toMap() { + return { + "name": name, + "ping": ping, + "status": status, + }; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index dec2d54f..102dfe77 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,30 +2,34 @@ 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'], + ); + } - Map toMap() { - return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; - } + Map toMap() { + return { + "remoteTime": remoteTime, + "localTime": localTime, + "diff": diff, + }; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index 807bdfd0..c43c4d57 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 51ddb64a..52fa04a6 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Identities List class IdentityList implements Model { - /// Total number of identities rows that matched your query. - final int total; + /// Total number of identities rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 9d6d7aec..b6717c4e 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 65207b94..390e9039 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Indexes List class IndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 490a1824..1b4ff7de 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"jwt": jwt}; - } + Map toMap() { + return { + "jwt": jwt, + }; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 9c45adb1..43eaad08 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,26 +2,34 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code, "nativeName": nativeName}; - } + 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 76a3f548..755c4e29 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Languages List class LanguageList implements Model { - /// Total number of languages rows that matched your query. - final int total; + /// Total number of languages rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 084475bf..b5e9ad1a 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 cd5a1155..10499ef5 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"code": code, "name": name}; - } + 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 5fa5c0ce..9e1e6034 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Locale codes list class LocaleCodeList implements Model { - /// Total number of localeCodes rows that matched your query. - final int total; + /// Total number of localeCodes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 7fb3f364..cb567bd7 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 4a771585..636d9166 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Logs List class LogList implements Model { - /// Total number of logs rows that matched your query. - final int total; + /// Total number of logs rows 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))), + ); + } - Map toMap() { - return {"total": total, "logs": logs.map((p) => p.toMap()).toList()}; - } + 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 8ee142ad..26610e46 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index 993f7206..566afb17 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Memberships List class MembershipList implements Model { - /// Total number of memberships rows that matched your query. - final int total; + /// Total number of memberships rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 9b93b00d..c4e9e858 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index c577ccc1..c5082c8e 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Message list class MessageList implements Model { - /// Total number of messages rows that matched your query. - final int total; + /// Total number of messages rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 96bf3c65..46c166fb 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 c930a23e..d49989d8 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 63411988..6c8b4e36 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,18 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"recoveryCodes": recoveryCodes}; - } + Map toMap() { + return { + "recoveryCodes": recoveryCodes, + }; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index fa57cb8b..01cf0857 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"secret": secret, "uri": uri}; - } + Map toMap() { + return { + "secret": secret, + "uri": uri, + }; + } } 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/phone.dart b/lib/src/models/phone.dart index 40f7bcd2..c8bbb95b 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 497aa36c..a40e3591 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Phones List class PhoneList implements Model { - /// Total number of phones rows that matched your query. - final int total; + /// Total number of phones rows 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))), + ); + } - Map toMap() { - return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "phones": phones.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index 7bc3abc9..edb6083e 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,17 +2,23 @@ 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); - } + factory Preferences.fromMap(Map map) { + return Preferences( + data: map, + ); + } - Map toMap() { - return {"data": data}; - } + 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/provider.dart b/lib/src/models/provider.dart index 1a762f85..4295c486 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 6d579bd0..c71c810d 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Provider list class ProviderList implements Model { - /// Total number of providers rows that matched your query. - final int total; + /// Total number of providers rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index dad35dcc..ed520cc4 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 fcbcbc3a..3c2d985f 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,24 +2,28 @@ part of '../../models.dart'; /// Resource Tokens List class ResourceTokenList implements Model { - /// Total number of tokens rows that matched your query. - final int total; + /// Total number of tokens rows 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))), + ); + } - Map toMap() { - return {"total": total, "tokens": tokens.map((p) => p.toMap()).toList()}; - } + 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 3700e577..62e69e5b 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 ae3f851d..42bdbfea 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,25 +2,31 @@ part of '../../models.dart'; /// Rows List class RowList implements Model { - /// Total number of rows rows that matched your query. - final int total; + /// Total number of rows 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))), + ); + } - Map toMap() { - return {"total": total, "rows": rows.map((p) => p.toMap()).toList()}; - } + 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 7c9677d8..35f82cfa 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 b93dbb8f..e574c63c 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Runtimes List class RuntimeList implements Model { - /// Total number of runtimes rows that matched your query. - final int total; + /// Total number of runtimes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 d2fe4f64..3a1d955f 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 563b04a4..160cb789 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Sessions List class SessionList implements Model { - /// Total number of sessions rows that matched your query. - final int total; + /// Total number of sessions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 1449f8bd..5cda6acc 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index eb1a5457..3164546a 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Sites List class SiteList implements Model { - /// Total number of sites rows that matched your query. - final int total; + /// Total number of sites rows 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))), + ); + } - Map toMap() { - return {"total": total, "sites": sites.map((p) => p.toMap()).toList()}; - } + 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 e8fb8c75..e49d399c 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,35 +2,40 @@ 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(), + ); + } - Map toMap() { - return {"memory": memory, "cpus": cpus, "enabled": enabled, "slug": slug}; - } + 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 9a7d0154..040dbcc7 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Specifications List class SpecificationList implements Model { - /// Total number of specifications rows that matched your query. - final int total; + /// Total number of specifications rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 0c926297..36e18a7e 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 d5c6c01d..20ce6ca5 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Subscriber list class SubscriberList implements Model { - /// Total number of subscribers rows that matched your query. - final int total; + /// Total number of subscribers rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 7ce86b9d..1c5b88fb 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,78 +2,76 @@ 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; - 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, - }); + 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, + }); - 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)), - ), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 7398c48f..2c285e55 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Tables List class TableList implements Model { - /// Total number of tables rows that matched your query. - final int total; + /// Total number of tables rows 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))), + ); + } - Map toMap() { - return {"total": total, "tables": tables.map((p) => p.toMap()).toList()}; - } + 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 4be8b545..f2b3b6b4 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 29667c94..c3c250a5 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Target list class TargetList implements Model { - /// Total number of targets rows that matched your query. - final int total; + /// Total number of targets rows 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))), + ); + } - Map toMap() { - return {"total": total, "targets": targets.map((p) => p.toMap()).toList()}; - } + 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 43df33a8..e9058b5b 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 b70f12c1..3b8547ca 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Teams List class TeamList implements Model { - /// Total number of teams rows that matched your query. - final int total; + /// Total number of teams rows 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))), + ); + } - Map toMap() { - return {"total": total, "teams": teams.map((p) => p.toMap()).toList()}; - } + 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 35115467..4f6b8454 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 430d44ac..461d5694 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 69a17ebc..1c0fdb32 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Topic list class TopicList implements Model { - /// Total number of topics rows that matched your query. - final int total; + /// Total number of topics rows 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))), + ); + } - Map toMap() { - return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "topics": topics.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index 50bfb3ce..effc397c 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 56cc1b5b..75b8f53b 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Users List class UserList implements Model { - /// Total number of users rows that matched your query. - final int total; + /// Total number of users rows 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))), + ); + } - Map toMap() { - return {"total": total, "users": users.map((p) => p.toMap()).toList()}; - } + 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 2a8e276a..58882a9f 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 cd90d85f..da6e6982 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Variables List class VariableList implements Model { - /// Total number of variables rows that matched your query. - final int total; + /// Total number of variables rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } From 72bb93016be5513ae48c052e40f3f4681efdc60e Mon Sep 17 00:00:00 2001 From: abnegate Date: Wed, 20 Aug 2025 09:36:59 +0000 Subject: [PATCH 12/22] Commit from GitHub Actions (Format and push) --- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1191 +++++------ lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 ++++++++++++------- lib/services/functions.dart | 869 ++++---- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 +++-- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 1852 ++++++++++------- lib/services/sites.dart | 822 ++++---- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 +++++++++------- lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1349 ++++++------ lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 232 ++- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 ++-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 ++-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 ++-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +-- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 164 files changed, 12559 insertions(+), 11067 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/query.dart b/lib/query.dart index 281aa756..c9a2fc91 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if(attribute != null) { + if (attribute != null) { map['attribute'] = attribute; } - - if(values != null) { + + if (values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} \ 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 89246ea7..b1358d47 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,27 +1,26 @@ 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 +29,32 @@ 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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,449 +63,442 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.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); - - final Map apiParams = { - - - }; + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/account/identities/{identityId}'.replaceAll( + '{identityId}', + identityId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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; + 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() async { - final String apiPath = '/account/jwts'; + Future createJWT() async { + final String apiPath = '/account/jwts'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.LogList.fromMap(res.data); - - } + } /// Enable or disable MFA on an account. - Future updateMFA({required bool mfa}) async { - final String apiPath = '/account/mfa'; - - final Map apiParams = { - - 'mfa': 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 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. - Future createMfaAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - - final Map apiParams = { - - - }; + Future createMfaAuthenticator({ + required enums.AuthenticatorType type, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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, - - }; + Future updateMfaAuthenticator({ + required enums.AuthenticatorType type, + required String otp, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - - final Map apiParams = { - - - }; + Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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; + 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. - Future createMfaChallenge({required enums.AuthenticationFactor factor}) async { - final String apiPath = '/account/mfa/challenge'; + Future createMfaChallenge({ + required enums.AuthenticationFactor factor, + }) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = { - - 'factor': factor.value, - - }; + final Map apiParams = {'factor': factor.value}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - Future updateMfaChallenge({required String challengeId, required String otp}) async { - final String apiPath = '/account/mfa/challenge'; + Future updateMfaChallenge({ + required String challengeId, + required String otp, + }) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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. - 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. - Future createMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; - - final Map apiParams = { - - - }; + Future createMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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 apiHeaders = { - 'content-type': 'application/json', + 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 apiParams = {'name': name}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'oldPassword': oldPassword, - + 'oldPassword': oldPassword, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 apiParams = {'prefs': prefs}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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 @@ -512,99 +508,98 @@ 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, + final Map apiParams = {'email': email, 'url': url}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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 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'; - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteSessions() async { + final String apiPath = '/account/sessions'; - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 @@ -613,213 +608,212 @@ 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 apiHeaders = { - 'content-type': 'application/json', + 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 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.') - Future updateMagicURLSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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.') - Future updatePhoneSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, + final Map apiParams = {'userId': userId, 'secret': secret}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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); - - final Map apiParams = { - - - }; + Future updateSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 apiHeaders = { - 'content-type': 'application/json', + 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 /// provided user ID has not be registered, a new user will be created. Use the @@ -827,31 +821,34 @@ 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, -'phrase': phrase, - + 'email': email, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 @@ -862,66 +859,79 @@ 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, -'url': url, -'phrase': phrase, - + 'email': email, + 'url': url, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { 'success': success, -'failure': failure, -'scopes': scopes, + 'failure': failure, + 'scopes': scopes, - 'project': client.config['project'], }; 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)); + query.add( + Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item), + ); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -929,15 +939,16 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri(scheme: endpoint.scheme, + Uri url = Uri( + scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&') + 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 @@ -945,30 +956,29 @@ 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, + final Map apiParams = {'userId': userId, 'phone': phone}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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** @@ -979,56 +989,52 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; - - final Map apiParams = { - - 'url': url, - - }; + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 updateVerification({required String userId, required String secret}) async { - final String apiPath = '/account/verification'; + Future updateVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification'; - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; + final Map apiParams = {'userId': userId, 'secret': secret}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -1038,47 +1044,44 @@ 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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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/verification/phone'; + Future updatePhoneVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; + final Map apiParams = {'userId': userId, 'secret': secret}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index a91d6d3f..8033f1cd 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,189 +1,255 @@ 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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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, -'width': width, -'height': height, + 'width': width, + '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 = { 'name': name, -'width': width, -'height': height, -'background': background, + 'width': width, + 'height': height, + '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, -'size': size, -'margin': margin, -'download': download, + 'size': size, + 'margin': margin, + '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 22e279fc..ca557ea5 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1215 +1,1682 @@ 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}) 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, + }) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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.createDatabase` 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.createDatabase` instead.', + ) + Future create({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases'; final Map apiParams = { - 'databaseId': databaseId, -'name': name, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, bool? enabled}) async { - final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDb.update` instead.', + ) + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'collectionId': collectionId, -'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) 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, + required String name, + List? permissions, + bool? documentSecurity, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + @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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + @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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return 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/{key}/relationship'.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/{key}/relationship' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'onDelete': onDelete?.value, -'newKey': newKey, - + 'newKey': newKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - } + } /// 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'documentId': documentId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + final Map apiParams = {'queries': queries}; + + final Map 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, required Map data, List? permissions}) 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, + required Map data, + List? permissions, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - 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; - - } + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'attributes': attributes, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 index by 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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); - - 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; - - } -} \ No newline at end of file + @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 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/functions.dart b/lib/services/functions.dart index 05a7d5f7..e86f1afe 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,256 +1,316 @@ 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}) async { - final String apiPath = '/functions'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? specification}) 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? specification, + }) async { + final String apiPath = '/functions'; final Map apiParams = { - 'functionId': functionId, -'name': name, -'runtime': runtime.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'name': name, + 'runtime': runtime.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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? specification}) 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? specification, + }) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'name': name, -'runtime': runtime?.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'runtime': runtime?.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String functionId}) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateFunctionDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployment'.replaceAll( + '{functionId}', + functionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); + Future listDeployments({ + required String functionId, + List? queries, + String? search, + }) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 = { - 'entrypoint': entrypoint, -'commands': commands, -'code': code, -'activate': activate, - + 'commands': commands, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -265,361 +325,446 @@ 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, -'buildId': buildId, - + 'buildId': buildId, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String functionId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/functions/{functionId}/deployments/template' + .replaceAll('{functionId}', functionId); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll('{functionId}', functionId); + Future createVcsDeployment({ + required String functionId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployments/{deploymentId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 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}) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - - final Map apiParams = { - 'queries': queries, + Future listExecutions({ + required String functionId, + List? queries, + }) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll( + '{functionId}', + functionId, + ); - - }; + final Map apiParams = {'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.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 = { - 'body': body, -'async': xasync, -'path': path, -'method': method?.value, -'headers': headers, -'scheduledAt': scheduledAt, - + 'async': xasync, + 'path': path, + 'method': method?.value, + 'headers': headers, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteExecution({ + required String functionId, + required String executionId, + }) async { + final String apiPath = '/functions/{functionId}/executions/{executionId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{executionId}', executionId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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, + }) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index e2418b52..18eb54f1 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,51 +1,49 @@ 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 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); - - return res.data; + 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 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); - - return res.data; + final res = await client.call( + HttpMethod.post, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/health.dart b/lib/services/health.dart index 0cf64ac6..5250c91d 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,438 +1,414 @@ 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.HealthStatus.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 = { - 'domain': domain, + final Map apiParams = {'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); - - } + } /// 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.HealthStatus.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.HealthStatus.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 = { - 'threshold': threshold, - - - }; + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueCertificates({int? threshold}) async { + final String apiPath = '/health/queue/certificates'; - - }; + final Map apiParams = {'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 = { 'name': name, -'threshold': threshold, - - + '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 = { - 'threshold': threshold, + final Map apiParams = {'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); - - final Map apiParams = { - 'threshold': threshold, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future getFailedJobs({ + required enums.Name name, + int? threshold, + }) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll( + '{name}', + name.value, + ); + + final Map apiParams = {'threshold': threshold}; + + final Map 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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueFunctions({int? threshold}) async { + final String apiPath = '/health/queue/functions'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueStatsResources({int? threshold}) async { + final String apiPath = '/health/queue/stats-resources'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 @@ -441,21 +417,20 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 430a00c3..4d3cc3e0 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,172 +1,164 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 6147b8dc..afe3ee86 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1160 +1,1478 @@ 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}) async { - final String apiPath = '/messaging/messages'; + Future listMessages({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'topics': topics, -'users': users, -'targets': targets, -'cc': cc, -'bcc': bcc, -'attachments': attachments, -'draft': draft, -'html': html, -'scheduledAt': scheduledAt, - + 'subject': subject, + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'cc': cc, + 'bcc': bcc, + 'attachments': attachments, + 'draft': draft, + 'html': html, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'title': title, -'body': body, -'topics': topics, -'users': users, -'targets': targets, -'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.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'title': title, + 'body': body, + 'topics': topics, + 'users': users, + 'targets': targets, + '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.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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'topics': topics, -'users': users, -'targets': targets, -'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'draft': draft, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - /// - 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 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); - - final Map apiParams = { - - - }; + Future delete({required String messageId}) async { + final String apiPath = '/messaging/messages/{messageId}'.replaceAll( + '{messageId}', + messageId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listMessageLogs({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/providers'; + Future listProviders({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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. - 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, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - 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 = { - 'name': name, -'enabled': enabled, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - 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 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. - 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 = { - 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'enabled': enabled, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'enabled': enabled, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, -'enabled': enabled, - + 'name': name, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, - + 'enabled': enabled, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'enabled': enabled, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - 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, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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. - 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 = { - 'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, -'from': from, -'customerId': customerId, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'customerId': customerId, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'customerId': customerId, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'customerId': customerId, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'from': from, -'username': username, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'username': username, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'username': username, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'username': username, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'from': from, -'accountSid': accountSid, -'authToken': authToken, -'enabled': enabled, - + 'name': name, + 'from': from, + 'accountSid': accountSid, + 'authToken': authToken, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'accountSid': accountSid, -'authToken': authToken, -'from': from, - + 'enabled': enabled, + 'accountSid': accountSid, + 'authToken': authToken, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'from': from, -'apiKey': apiKey, -'apiSecret': apiSecret, -'enabled': enabled, - + 'name': name, + 'from': from, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'apiSecret': apiSecret, -'from': from, - + 'enabled': enabled, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteProvider({required String providerId}) async { + final String apiPath = '/messaging/providers/{providerId}'.replaceAll( + '{providerId}', + providerId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listProviderLogs({ + required String providerId, + List? queries, + }) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( + '{providerId}', + providerId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); - - final Map apiParams = { - 'queries': queries, + Future listSubscriberLogs({ + required String subscriberId, + List? queries, + }) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs' + .replaceAll('{subscriberId}', subscriberId); - - }; + final Map apiParams = {'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.LogList.fromMap(res.data); - - } + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({List? queries, String? search}) async { - final String apiPath = '/messaging/topics'; + Future listTopics({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'subscribe': subscribe, - + 'name': name, + 'subscribe': subscribe, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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; - - } + return res.data; + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs({required String topicId, List? queries}) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTopicLogs({ + required String topicId, + List? queries, + }) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( + '{topicId}', + topicId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); + Future listSubscribers({ + required String topicId, + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( + '{topicId}', + topicId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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 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); - - 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; - - } -} \ No newline at end of file + 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 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/sites.dart b/lib/services/sites.dart index 5481986e..d89f2192 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,247 +1,296 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.Adapter? adapter, + String? installationId, + String? fallbackFile, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites'; final Map apiParams = { - 'siteId': siteId, -'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime.value, -'adapter': adapter?.value, -'installationId': installationId, -'fallbackFile': fallbackFile, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime.value, + 'adapter': adapter?.value, + 'installationId': installationId, + 'fallbackFile': fallbackFile, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.BuildRuntime? buildRuntime, + enums.Adapter? adapter, + String? fallbackFile, + String? installationId, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime?.value, -'adapter': adapter?.value, -'fallbackFile': fallbackFile, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime?.value, + 'adapter': adapter?.value, + 'fallbackFile': fallbackFile, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + Future delete({required String siteId}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateSiteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployment'.replaceAll( + '{siteId}', + siteId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future listDeployments({ + required String siteId, + List? queries, + String? search, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future createDeployment({ + required String siteId, + required InputFile code, + required bool activate, + String? installCommand, + String? buildCommand, + String? outputDirectory, + Function(UploadProgress)? onProgress, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'code': code, -'activate': activate, - + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -256,331 +305,400 @@ 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, + 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 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String siteId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll('{siteId}', siteId); + Future createVcsDeployment({ + required String siteId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - 'queries': queries, + Future listLogs({ + required String siteId, + List? queries, + }) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll( + '{siteId}', + siteId, + ); - - }; + final Map apiParams = {'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.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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ccdce915..ee630883 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,184 +1,226 @@ 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}) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({ + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { - 'bucketId': bucketId, -'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'name': name, + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) 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, + }) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { - 'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteBucket({required String bucketId}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); + Future listFiles({ + required String bucketId, + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'permissions': permissions, - + 'file': file, + 'permissions': permissions, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -194,137 +236,187 @@ 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 = { - 'name': name, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 = { 'width': width, -'height': height, -'gravity': gravity?.value, -'quality': quality, -'borderWidth': borderWidth, -'borderColor': borderColor, -'borderRadius': borderRadius, -'opacity': opacity, -'rotation': rotation, -'background': background, -'output': output?.value, -'token': token, - - + 'height': height, + 'gravity': gravity?.value, + 'quality': quality, + 'borderWidth': borderWidth, + 'borderColor': borderColor, + 'borderRadius': borderRadius, + 'opacity': opacity, + 'rotation': rotation, + 'background': background, + 'output': output?.value, + '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 = { '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 288d730b..7cf31d00 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1162 +1,1520 @@ 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}) async { - final String apiPath = '/tablesdb'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, required String name, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + Future listTables({ + required String databaseId, + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'tableId': tableId, -'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future updateTable({ + required String databaseId, + required String tableId, + required String name, + List? permissions, + bool? rowSecurity, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteTable({ + required String databaseId, + required String tableId, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listColumns({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - /// - 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); + /// + 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - /// - 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); + /// + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + 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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + 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 apiHeaders = {'content-type': 'application/json'}; + + 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listIndexes({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'columns': columns, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + 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 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); - - 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; - - } + 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 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRow({required String databaseId, required String tableId, required String rowId, required Map data, List? permissions}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'rowId': rowId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future createRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + Future createRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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/server/databases#databasesCreateTable) /// API or directly from your database console. - /// - Future upsertRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future upsertRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future updateRows({ + required String databaseId, + required String tableId, + Map? data, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + Future deleteRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future getRow({ + required String databaseId, + required String tableId, + required String rowId, + List? queries, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/databases#databasesCreateTable) /// API or directly from your database console. - Future upsertRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - 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; - - } + Future deleteRow({ + required String databaseId, + required String tableId, + required String rowId, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future decrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? min, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future incrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? max, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.patch, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); return models.Row.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/teams.dart b/lib/services/teams.dart index c21a93af..5fd59641 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,140 +1,147 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'roles': roles, - + 'name': name, + 'roles': roles, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - 'name': name, + 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 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); + Future listMemberships({ + required String teamId, + List? queries, + String? search, + }) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll( + '{teamId}', + teamId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 @@ -142,182 +149,210 @@ 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 = { - 'email': email, -'userId': userId, -'phone': phone, -'roles': roles, -'url': url, -'name': name, - + 'userId': userId, + 'phone': phone, + 'roles': roles, + 'url': url, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - 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); + /// + 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, + ); 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index cb04449b..4e6915dc 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,109 +1,113 @@ 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}) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future list({ + required String bucketId, + required String fileId, + List? queries, + }) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); + + final Map apiParams = {'queries': queries}; + + final Map 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); - - 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); + 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, + ); 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); - - final Map apiParams = { - - 'expire': expire, + 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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String tokenId}) async { + final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/users.dart b/lib/services/users.dart index e6f80be3..c98182b7 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,314 +1,359 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'password': password, -'name': name, - + 'email': email, + 'phone': phone, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/users/identities'; + Future listIdentities({ + List? queries, + String? search, + }) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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); - - final Map apiParams = { - - - }; + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/users/identities/{identityId}'.replaceAll( + '{identityId}', + identityId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordCpu': passwordCpu, + 'passwordMemory': passwordMemory, + 'passwordParallel': passwordParallel, + 'passwordLength': passwordLength, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordSaltSeparator': passwordSaltSeparator, + 'passwordSignerKey': passwordSignerKey, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'passwordVersion': passwordVersion?.value, -'name': name, - + 'email': email, + 'password': password, + 'passwordVersion': passwordVersion?.value, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -316,648 +361,748 @@ 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); - - final Map apiParams = { - - - }; + Future delete({required String userId}) async { + final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); 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 = { - 'sessionId': sessionId, -'duration': duration, - + 'duration': duration, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// Get the user activity logs list by its unique ID. - Future listLogs({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listLogs({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/logs'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); + Future listMemberships({ + required String userId, + List? queries, + String? search, + }) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll( + '{userId}', + userId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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. - Future updateMfa({required String userId, required bool mfa}) async { - final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); - - final Map apiParams = { - - 'mfa': mfa, - - }; + Future updateMfa({ + required String userId, + required bool mfa, + }) async { + final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - 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 = { - - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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. - 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. - 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. - Future updateMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; + Future updateMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - Future createMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; + Future createMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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); - - final Map apiParams = { - - - }; + Future createSession({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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 res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// List the messaging targets that are associated with a user. - Future listTargets({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/targets'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, -'providerId': providerId, -'name': name, - + 'providerType': providerType.value, + 'identifier': identifier, + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'identifier': identifier, -'providerId': providerId, -'name': name, - + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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 res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'length': length, -'expire': expire, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future createToken({ + required String userId, + int? length, + int? expire, + }) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'length': length, 'expire': expire}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/src/client.dart b/lib/src/client.dart index 0d9be210..d82d623a 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,7 +81,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 cd82d264..08d93b85 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,21 +2,25 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index ea2cd62a..c961873f 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,14 +9,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => +ClientBase createClient({required String endPoint, required bool selfSigned}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -34,59 +31,66 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format' : '1.8.0', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -135,7 +139,11 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -162,12 +170,19 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index f9e695bf..2bd7d639 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,17 +10,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => - ClientIO( - endPoint: endPoint, - selfSigned: selfSigned, - ); +ClientBase createClient({required String endPoint, required bool selfSigned}) => + ClientIO(endPoint: endPoint, selfSigned: selfSigned); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -43,60 +37,68 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format' : '1.8.0', + 'user-agent': + 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -151,11 +153,16 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, file.path!, - filename: file.filename); + paramName, + file.path!, + filename: file.filename, + ); } else { - 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, @@ -194,12 +201,19 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -244,10 +258,7 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse( - res, - responseType: responseType, - ); + return prepareResponse(res, responseType: responseType); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 658b79b6..06c9ebe3 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest) - .fields - .addAll({"$key[$i]": v.toString()}); + (request as http.MultipartRequest).fields.addAll({ + "$key[$i]": v.toString(), + }); }); } else { - (request as http.MultipartRequest) - .fields - .addAll({key: value.toString()}); + (request as http.MultipartRequest).fields.addAll({ + key: value.toString(), + }); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value){ + params = params.map((key, value) { if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,12 +51,13 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port, + ); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -66,7 +67,9 @@ 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); @@ -113,18 +116,25 @@ 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.dart b/lib/src/enums.dart index 595afdc2..0f250ea3 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes + bytes, } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 2f198d4e..3341912f 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 cd45b6a1..1bae5c8a 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 7d2d7016..42954430 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,18 +1,16 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 af5ebaad..e20f48c6 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,26 +1,24 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index 8d86530d..b101d35f 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({ - required this.value - }); + const IndexType({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/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/name.dart b/lib/src/enums/name.dart index 613bf5f1..74823feb 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,24 +1,22 @@ 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'), - 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'), + 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 076c1c50..383e45b1 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,52 +1,50 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d34440ec..d4fef930 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index 0bf8e2ad..f01fcb01 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({ - required this.value - }); + const VCSDeploymentType({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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index f174d569..4145f701 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 c9f67200..4e901476 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 2fabb416..35c7b767 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index fdcee07a..7d27adba 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index 120723df..fec6f65a 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 504b5f8f..0e80700f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 5f3e1654..bae6618f 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 20dd7189..0ca54691 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a5b27b4f..1df01f19 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 96ce554b..21f8e9a3 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a4953a0e..298c181a 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 03ba94c7..c6eecadd 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8a5aa89d..1ef48332 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 d17f414a..8c8fcb73 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index 4098a5a1..c5fa6adc 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "attributes": attributes, - }; - } + Map toMap() { + return {"total": total, "attributes": attributes}; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 050cbe14..903c6290 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 2202d255..7374fa78 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index 0c3ddf9e..f0bc295e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index 3bb374be..b8fb5e48 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 29c56fe4..9d5b771b 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Buckets List class BucketList implements Model { - /// Total number of buckets rows that matched your query. - final int total; + /// Total number of buckets rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "buckets": buckets.map((p) => p.toMap()).toList(), - }; - } + 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 c55110cf..72de429d 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 81104b31..b5ff3518 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Collections List class CollectionList implements Model { - /// Total number of collections rows that matched your query. - final int total; + /// Total number of collections rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 0ffc8fea..60fcfa48 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 367686d0..c21a2260 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7deb5e26..15d80695 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7bb56922..558b7d43 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c0547e11..3b2f1335 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 acf0f6df..9d637d92 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 66213f0a..7bea7426 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,28 +2,24 @@ part of '../../models.dart'; /// Column Indexes List class ColumnIndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 3823f425..2ba463cd 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 4ac1fa12..6672d7ce 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 475c1c40..8eb0171f 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "columns": columns, - }; - } + Map toMap() { + return {"total": total, "columns": columns}; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index e55d1534..6221c01e 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6fd6a3b0..7b560989 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 94271aa6..66c0ce7b 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 1a9c5038..7318b7ad 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 60b008ef..651b5ae4 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Continents List class ContinentList implements Model { - /// Total number of continents rows that matched your query. - final int total; + /// Total number of continents rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 565b1d66..c52b50f2 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,28 +2,19 @@ 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()); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 3a3acd49..ea839b51 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Countries List class CountryList implements Model { - /// Total number of countries rows that matched your query. - final int total; + /// Total number of countries rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 deafffe3..27eef0c1 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 34274e00..2ff28c61 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Currencies List class CurrencyList implements Model { - /// Total number of currencies rows that matched your query. - final int total; + /// Total number of currencies rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 cab95b02..8d79e052 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 940a9610..01e092f2 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Databases List class DatabaseList implements Model { - /// Total number of databases rows that matched your query. - final int total; + /// Total number of databases rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 ecf7e791..448c62c7 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 7a2a38c2..1ca87150 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Deployments List class DeploymentList implements Model { - /// Total number of deployments rows that matched your query. - final int total; + /// Total number of deployments rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index be424a9c..cf85e457 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 90bce66f..b897a877 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,31 +2,30 @@ part of '../../models.dart'; /// Documents List class DocumentList implements Model { - /// Total number of documents rows that matched your query. - final int total; + /// Total number of documents rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 0cfdbb4e..8618bcd6 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,118 +2,122 @@ 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 upate date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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.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(), - trigger: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "trigger": trigger, - "status": status, - "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 upate date in ISO 8601 format. + final String $updatedAt; + + /// Execution roles. + final List $permissions; + + /// Function ID. + final String functionId; + + /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + final String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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.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(), + trigger: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "trigger": trigger, + "status": status, + "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 c30098a6..583d9fab 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Executions List class ExecutionList implements Model { - /// Total number of executions rows that matched your query. - final int total; + /// Total number of executions rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 de8439ec..a6a9fa46 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 164a281f..e7ca1bd5 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Files List class FileList implements Model { - /// Total number of files rows that matched your query. - final int total; + /// Total number of files rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "files": files.map((p) => p.toMap()).toList(), - }; - } + 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 ea6b601a..693c9b07 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,46 +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))), - ); - } - - 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)), + ), + ); + } + + 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 7614616a..0b908240 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 bd39632e..5661bec4 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Frameworks List class FrameworkList implements Model { - /// Total number of frameworks rows that matched your query. - final int total; + /// Total number of frameworks rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 64401c3f..56c2eded 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index b40dd517..24b199b1 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,28 +2,25 @@ part of '../../models.dart'; /// Functions List class FunctionList implements Model { - /// Total number of functions rows that matched your query. - final int total; + /// Total number of functions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 ecf0a178..463cf696 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "value": value, - }; - } + Map toMap() { + return {"name": name, "value": value}; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index 54c31e70..fa402e97 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "version": version, - "status": status, - }; - } + Map toMap() { + return {"version": version, "status": status}; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index 0a5b6ce9..d412eba9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 95da1235..5f06906b 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,22 +2,16 @@ 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']); + } - Map toMap() { - return { - "size": size, - }; - } + Map toMap() { + return {"size": size}; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 0d6e7216..59b7092c 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,34 +2,26 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "name": name, - "ping": ping, - "status": status, - }; - } + Map toMap() { + return {"name": name, "ping": ping, "status": status}; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index 102dfe77..dec2d54f 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,34 +2,30 @@ 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'], + ); + } - Map toMap() { - return { - "remoteTime": remoteTime, - "localTime": localTime, - "diff": diff, - }; - } + Map toMap() { + return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index c43c4d57..807bdfd0 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 52fa04a6..51ddb64a 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Identities List class IdentityList implements Model { - /// Total number of identities rows that matched your query. - final int total; + /// Total number of identities rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 b6717c4e..9d6d7aec 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 390e9039..65207b94 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Indexes List class IndexList implements Model { - /// Total number of indexes rows that matched your query. - final int total; + /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 1b4ff7de..490a1824 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "jwt": jwt, - }; - } + Map toMap() { + return {"jwt": jwt}; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 43eaad08..9c45adb1 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,34 +2,26 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - "nativeName": nativeName, - }; - } + 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 755c4e29..76a3f548 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Languages List class LanguageList implements Model { - /// Total number of languages rows that matched your query. - final int total; + /// Total number of languages rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 b5e9ad1a..084475bf 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 10499ef5..cd5a1155 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "name": name, - }; - } + 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 9e1e6034..5fa5c0ce 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Locale codes list class LocaleCodeList implements Model { - /// Total number of localeCodes rows that matched your query. - final int total; + /// Total number of localeCodes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 cb567bd7..7fb3f364 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 636d9166..4a771585 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Logs List class LogList implements Model { - /// Total number of logs rows that matched your query. - final int total; + /// Total number of logs rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "logs": logs.map((p) => p.toMap()).toList(), - }; - } + 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 26610e46..8ee142ad 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index 566afb17..993f7206 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Memberships List class MembershipList implements Model { - /// Total number of memberships rows that matched your query. - final int total; + /// Total number of memberships rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 c4e9e858..9b93b00d 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index c5082c8e..c577ccc1 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Message list class MessageList implements Model { - /// Total number of messages rows that matched your query. - final int total; + /// Total number of messages rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 46c166fb..96bf3c65 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 d49989d8..c930a23e 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 6c8b4e36..63411988 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,22 +2,18 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "recoveryCodes": recoveryCodes, - }; - } + Map toMap() { + return {"recoveryCodes": recoveryCodes}; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index 01cf0857..fa57cb8b 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "secret": secret, - "uri": uri, - }; - } + Map toMap() { + return {"secret": secret, "uri": uri}; + } } 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/phone.dart b/lib/src/models/phone.dart index c8bbb95b..40f7bcd2 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 a40e3591..497aa36c 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Phones List class PhoneList implements Model { - /// Total number of phones rows that matched your query. - final int total; + /// Total number of phones rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "phones": phones.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index edb6083e..7bc3abc9 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,23 +2,17 @@ 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, - ); - } + factory Preferences.fromMap(Map map) { + return Preferences(data: map); + } - Map toMap() { - return { - "data": data, - }; - } + 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/provider.dart b/lib/src/models/provider.dart index 4295c486..1a762f85 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 c71c810d..6d579bd0 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Provider list class ProviderList implements Model { - /// Total number of providers rows that matched your query. - final int total; + /// Total number of providers rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index ed520cc4..dad35dcc 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 3c2d985f..fcbcbc3a 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,28 +2,24 @@ part of '../../models.dart'; /// Resource Tokens List class ResourceTokenList implements Model { - /// Total number of tokens rows that matched your query. - final int total; + /// Total number of tokens rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "tokens": tokens.map((p) => p.toMap()).toList(), - }; - } + 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 62e69e5b..3700e577 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 42bdbfea..ae3f851d 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,31 +2,25 @@ part of '../../models.dart'; /// Rows List class RowList implements Model { - /// Total number of rows rows that matched your query. - final int total; + /// Total number of rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "rows": rows.map((p) => p.toMap()).toList(), - }; - } + 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 35f82cfa..7c9677d8 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 e574c63c..b93dbb8f 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Runtimes List class RuntimeList implements Model { - /// Total number of runtimes rows that matched your query. - final int total; + /// Total number of runtimes rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 3a1d955f..d2fe4f64 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 160cb789..563b04a4 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Sessions List class SessionList implements Model { - /// Total number of sessions rows that matched your query. - final int total; + /// Total number of sessions rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 5cda6acc..1449f8bd 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index 3164546a..eb1a5457 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Sites List class SiteList implements Model { - /// Total number of sites rows that matched your query. - final int total; + /// Total number of sites rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "sites": sites.map((p) => p.toMap()).toList(), - }; - } + 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 e49d399c..e8fb8c75 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,40 +2,35 @@ 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(), + ); + } - Map toMap() { - return { - "memory": memory, - "cpus": cpus, - "enabled": enabled, - "slug": slug, - }; - } + 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 040dbcc7..9a7d0154 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Specifications List class SpecificationList implements Model { - /// Total number of specifications rows that matched your query. - final int total; + /// Total number of specifications rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 36e18a7e..0c926297 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 20ce6ca5..d5c6c01d 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Subscriber list class SubscriberList implements Model { - /// Total number of subscribers rows that matched your query. - final int total; + /// Total number of subscribers rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 1c5b88fb..7ce86b9d 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,76 +2,78 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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)), + ), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 2c285e55..7398c48f 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Tables List class TableList implements Model { - /// Total number of tables rows that matched your query. - final int total; + /// Total number of tables rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "tables": tables.map((p) => p.toMap()).toList(), - }; - } + 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 f2b3b6b4..4be8b545 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 c3c250a5..29667c94 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Target list class TargetList implements Model { - /// Total number of targets rows that matched your query. - final int total; + /// Total number of targets rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "targets": targets.map((p) => p.toMap()).toList(), - }; - } + 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 e9058b5b..43df33a8 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 3b8547ca..b70f12c1 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Teams List class TeamList implements Model { - /// Total number of teams rows that matched your query. - final int total; + /// Total number of teams rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "teams": teams.map((p) => p.toMap()).toList(), - }; - } + 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 4f6b8454..35115467 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 461d5694..430d44ac 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 1c0fdb32..69a17ebc 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Topic list class TopicList implements Model { - /// Total number of topics rows that matched your query. - final int total; + /// Total number of topics rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "topics": topics.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index effc397c..50bfb3ce 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 75b8f53b..56cc1b5b 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Users List class UserList implements Model { - /// Total number of users rows that matched your query. - final int total; + /// Total number of users rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "users": users.map((p) => p.toMap()).toList(), - }; - } + 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 58882a9f..2a8e276a 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 da6e6982..cd90d85f 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,28 +2,27 @@ part of '../../models.dart'; /// Variables List class VariableList implements Model { - /// Total number of variables rows that matched your query. - final int total; + /// Total number of variables rows 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } From 9a283cca69a4c119b4b08494bb424acdb6e0cc76 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 21 Aug 2025 22:19:54 +1200 Subject: [PATCH 13/22] Fix casing --- .../account/create-m-f-a-authenticator.md | 12 + .../account/create-m-f-a-challenge.md | 11 + .../account/create-m-f-a-recovery-codes.md | 10 + .../account/delete-m-f-a-authenticator.md | 12 + .../account/get-m-f-a-recovery-codes.md | 10 + docs/examples/account/list-m-f-a-factors.md | 10 + .../account/update-m-f-a-authenticator.md | 13 + .../account/update-m-f-a-challenge.md | 13 + .../account/update-m-f-a-recovery-codes.md | 10 + .../messaging/create-a-p-n-s-provider.md | 19 + .../messaging/create-f-c-m-provider.md | 15 + docs/examples/messaging/create-s-m-s.md | 18 + .../messaging/create-s-m-t-p-provider.md | 25 + .../messaging/update-a-p-n-s-provider.md | 19 + .../messaging/update-f-c-m-provider.md | 15 + docs/examples/messaging/update-s-m-s.md | 18 + .../messaging/update-s-m-t-p-provider.md | 25 + .../tablesdb/create-boolean-column.md | 4 +- .../tablesdb/create-datetime-column.md | 4 +- docs/examples/tablesdb/create-email-column.md | 4 +- docs/examples/tablesdb/create-enum-column.md | 4 +- docs/examples/tablesdb/create-float-column.md | 4 +- docs/examples/tablesdb/create-index.md | 4 +- .../tablesdb/create-integer-column.md | 4 +- docs/examples/tablesdb/create-ip-column.md | 4 +- .../tablesdb/create-relationship-column.md | 4 +- docs/examples/tablesdb/create-row.md | 4 +- docs/examples/tablesdb/create-rows.md | 4 +- .../examples/tablesdb/create-string-column.md | 4 +- docs/examples/tablesdb/create-table.md | 4 +- docs/examples/tablesdb/create-url-column.md | 4 +- docs/examples/tablesdb/create.md | 4 +- .../examples/tablesdb/decrement-row-column.md | 4 +- docs/examples/tablesdb/delete-column.md | 4 +- docs/examples/tablesdb/delete-index.md | 4 +- docs/examples/tablesdb/delete-row.md | 4 +- docs/examples/tablesdb/delete-rows.md | 4 +- docs/examples/tablesdb/delete-table.md | 4 +- docs/examples/tablesdb/delete.md | 4 +- docs/examples/tablesdb/get-column.md | 4 +- docs/examples/tablesdb/get-index.md | 4 +- docs/examples/tablesdb/get-row.md | 4 +- docs/examples/tablesdb/get-table.md | 4 +- docs/examples/tablesdb/get.md | 4 +- .../examples/tablesdb/increment-row-column.md | 4 +- docs/examples/tablesdb/list-columns.md | 4 +- docs/examples/tablesdb/list-indexes.md | 4 +- docs/examples/tablesdb/list-rows.md | 4 +- docs/examples/tablesdb/list-tables.md | 4 +- docs/examples/tablesdb/list.md | 4 +- .../tablesdb/update-boolean-column.md | 4 +- .../tablesdb/update-datetime-column.md | 4 +- docs/examples/tablesdb/update-email-column.md | 4 +- docs/examples/tablesdb/update-enum-column.md | 4 +- docs/examples/tablesdb/update-float-column.md | 4 +- .../tablesdb/update-integer-column.md | 4 +- docs/examples/tablesdb/update-ip-column.md | 4 +- .../tablesdb/update-relationship-column.md | 4 +- docs/examples/tablesdb/update-row.md | 4 +- docs/examples/tablesdb/update-rows.md | 4 +- .../examples/tablesdb/update-string-column.md | 4 +- docs/examples/tablesdb/update-table.md | 4 +- docs/examples/tablesdb/update-url-column.md | 4 +- docs/examples/tablesdb/update.md | 4 +- docs/examples/tablesdb/upsert-row.md | 4 +- docs/examples/tablesdb/upsert-rows.md | 4 +- .../users/create-m-f-a-recovery-codes.md | 12 + .../users/delete-m-f-a-authenticator.md | 13 + .../users/get-m-f-a-recovery-codes.md | 12 + docs/examples/users/list-m-f-a-factors.md | 12 + .../users/update-m-f-a-recovery-codes.md | 12 + docs/examples/users/update-m-f-a.md | 13 + lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/dart_appwrite.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1403 ++++++----- lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 +++++++---------- lib/services/functions.dart | 869 +++---- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 +++-- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 2077 ++++++++-------- lib/services/sites.dart | 822 +++---- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1860 ++++++--------- lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1483 ++++++------ lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 232 +- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 +-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 +-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 +-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- test/services/account_test.dart | 197 ++ test/services/messaging_test.dart | 201 ++ test/services/tables_db_test.dart | 104 +- test/services/users_test.dart | 118 + 241 files changed, 12644 insertions(+), 12712 deletions(-) create mode 100644 docs/examples/account/create-m-f-a-authenticator.md create mode 100644 docs/examples/account/create-m-f-a-challenge.md create mode 100644 docs/examples/account/create-m-f-a-recovery-codes.md create mode 100644 docs/examples/account/delete-m-f-a-authenticator.md create mode 100644 docs/examples/account/get-m-f-a-recovery-codes.md create mode 100644 docs/examples/account/list-m-f-a-factors.md create mode 100644 docs/examples/account/update-m-f-a-authenticator.md create mode 100644 docs/examples/account/update-m-f-a-challenge.md create mode 100644 docs/examples/account/update-m-f-a-recovery-codes.md create mode 100644 docs/examples/messaging/create-a-p-n-s-provider.md create mode 100644 docs/examples/messaging/create-f-c-m-provider.md create mode 100644 docs/examples/messaging/create-s-m-s.md create mode 100644 docs/examples/messaging/create-s-m-t-p-provider.md create mode 100644 docs/examples/messaging/update-a-p-n-s-provider.md create mode 100644 docs/examples/messaging/update-f-c-m-provider.md create mode 100644 docs/examples/messaging/update-s-m-s.md create mode 100644 docs/examples/messaging/update-s-m-t-p-provider.md create mode 100644 docs/examples/users/create-m-f-a-recovery-codes.md create mode 100644 docs/examples/users/delete-m-f-a-authenticator.md create mode 100644 docs/examples/users/get-m-f-a-recovery-codes.md create mode 100644 docs/examples/users/list-m-f-a-factors.md create mode 100644 docs/examples/users/update-m-f-a-recovery-codes.md create mode 100644 docs/examples/users/update-m-f-a.md diff --git a/docs/examples/account/create-m-f-a-authenticator.md b/docs/examples/account/create-m-f-a-authenticator.md new file mode 100644 index 00000000..4dd2191f --- /dev/null +++ b/docs/examples/account/create-m-f-a-authenticator.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +MfaType result = await account.createMFAAuthenticator( + type: AuthenticatorType.totp, +); diff --git a/docs/examples/account/create-m-f-a-challenge.md b/docs/examples/account/create-m-f-a-challenge.md new file mode 100644 index 00000000..5df3abad --- /dev/null +++ b/docs/examples/account/create-m-f-a-challenge.md @@ -0,0 +1,11 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +MfaChallenge result = await account.createMFAChallenge( + factor: AuthenticationFactor.email, +); diff --git a/docs/examples/account/create-m-f-a-recovery-codes.md b/docs/examples/account/create-m-f-a-recovery-codes.md new file mode 100644 index 00000000..1e8d4788 --- /dev/null +++ b/docs/examples/account/create-m-f-a-recovery-codes.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +MfaRecoveryCodes result = await account.createMFARecoveryCodes(); diff --git a/docs/examples/account/delete-m-f-a-authenticator.md b/docs/examples/account/delete-m-f-a-authenticator.md new file mode 100644 index 00000000..7f3f4ab1 --- /dev/null +++ b/docs/examples/account/delete-m-f-a-authenticator.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +await account.deleteMFAAuthenticator( + type: AuthenticatorType.totp, +); diff --git a/docs/examples/account/get-m-f-a-recovery-codes.md b/docs/examples/account/get-m-f-a-recovery-codes.md new file mode 100644 index 00000000..5ff858fd --- /dev/null +++ b/docs/examples/account/get-m-f-a-recovery-codes.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +MfaRecoveryCodes result = await account.getMFARecoveryCodes(); diff --git a/docs/examples/account/list-m-f-a-factors.md b/docs/examples/account/list-m-f-a-factors.md new file mode 100644 index 00000000..083b51d6 --- /dev/null +++ b/docs/examples/account/list-m-f-a-factors.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +MfaFactors result = await account.listMFAFactors(); diff --git a/docs/examples/account/update-m-f-a-authenticator.md b/docs/examples/account/update-m-f-a-authenticator.md new file mode 100644 index 00000000..c475d30e --- /dev/null +++ b/docs/examples/account/update-m-f-a-authenticator.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +User result = await account.updateMFAAuthenticator( + type: AuthenticatorType.totp, + otp: '', +); diff --git a/docs/examples/account/update-m-f-a-challenge.md b/docs/examples/account/update-m-f-a-challenge.md new file mode 100644 index 00000000..6cf3bb47 --- /dev/null +++ b/docs/examples/account/update-m-f-a-challenge.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +Session result = await account.updateMFAChallenge( + challengeId: '', + otp: '', +); diff --git a/docs/examples/account/update-m-f-a-recovery-codes.md b/docs/examples/account/update-m-f-a-recovery-codes.md new file mode 100644 index 00000000..10fc77d2 --- /dev/null +++ b/docs/examples/account/update-m-f-a-recovery-codes.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +MfaRecoveryCodes result = await account.updateMFARecoveryCodes(); diff --git a/docs/examples/messaging/create-a-p-n-s-provider.md b/docs/examples/messaging/create-a-p-n-s-provider.md new file mode 100644 index 00000000..a4faf2da --- /dev/null +++ b/docs/examples/messaging/create-a-p-n-s-provider.md @@ -0,0 +1,19 @@ +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 + +Messaging messaging = Messaging(client); + +Provider result = await messaging.createAPNSProvider( + providerId: '', + name: '', + authKey: '', // (optional) + authKeyId: '', // (optional) + teamId: '', // (optional) + bundleId: '', // (optional) + sandbox: false, // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/messaging/create-f-c-m-provider.md b/docs/examples/messaging/create-f-c-m-provider.md new file mode 100644 index 00000000..ce4f810d --- /dev/null +++ b/docs/examples/messaging/create-f-c-m-provider.md @@ -0,0 +1,15 @@ +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 + +Messaging messaging = Messaging(client); + +Provider result = await messaging.createFCMProvider( + providerId: '', + name: '', + serviceAccountJSON: {}, // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/messaging/create-s-m-s.md b/docs/examples/messaging/create-s-m-s.md new file mode 100644 index 00000000..ca90bc60 --- /dev/null +++ b/docs/examples/messaging/create-s-m-s.md @@ -0,0 +1,18 @@ +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 + +Messaging messaging = Messaging(client); + +Message result = await messaging.createSMS( + messageId: '', + content: '', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + draft: false, // (optional) + scheduledAt: '', // (optional) +); diff --git a/docs/examples/messaging/create-s-m-t-p-provider.md b/docs/examples/messaging/create-s-m-t-p-provider.md new file mode 100644 index 00000000..644d30fa --- /dev/null +++ b/docs/examples/messaging/create-s-m-t-p-provider.md @@ -0,0 +1,25 @@ +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 + +Messaging messaging = Messaging(client); + +Provider result = await messaging.createSMTPProvider( + providerId: '', + name: '', + host: '', + port: 1, // (optional) + username: '', // (optional) + password: '', // (optional) + encryption: SmtpEncryption.none, // (optional) + autoTLS: false, // (optional) + mailer: '', // (optional) + fromName: '', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '', // (optional) + replyToEmail: 'email@example.com', // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/messaging/update-a-p-n-s-provider.md b/docs/examples/messaging/update-a-p-n-s-provider.md new file mode 100644 index 00000000..7f3bc834 --- /dev/null +++ b/docs/examples/messaging/update-a-p-n-s-provider.md @@ -0,0 +1,19 @@ +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 + +Messaging messaging = Messaging(client); + +Provider result = await messaging.updateAPNSProvider( + providerId: '', + name: '', // (optional) + enabled: false, // (optional) + authKey: '', // (optional) + authKeyId: '', // (optional) + teamId: '', // (optional) + bundleId: '', // (optional) + sandbox: false, // (optional) +); diff --git a/docs/examples/messaging/update-f-c-m-provider.md b/docs/examples/messaging/update-f-c-m-provider.md new file mode 100644 index 00000000..65afba1f --- /dev/null +++ b/docs/examples/messaging/update-f-c-m-provider.md @@ -0,0 +1,15 @@ +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 + +Messaging messaging = Messaging(client); + +Provider result = await messaging.updateFCMProvider( + providerId: '', + name: '', // (optional) + enabled: false, // (optional) + serviceAccountJSON: {}, // (optional) +); diff --git a/docs/examples/messaging/update-s-m-s.md b/docs/examples/messaging/update-s-m-s.md new file mode 100644 index 00000000..26e6649b --- /dev/null +++ b/docs/examples/messaging/update-s-m-s.md @@ -0,0 +1,18 @@ +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 + +Messaging messaging = Messaging(client); + +Message result = await messaging.updateSMS( + messageId: '', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + content: '', // (optional) + draft: false, // (optional) + scheduledAt: '', // (optional) +); diff --git a/docs/examples/messaging/update-s-m-t-p-provider.md b/docs/examples/messaging/update-s-m-t-p-provider.md new file mode 100644 index 00000000..911fa144 --- /dev/null +++ b/docs/examples/messaging/update-s-m-t-p-provider.md @@ -0,0 +1,25 @@ +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 + +Messaging messaging = Messaging(client); + +Provider result = await messaging.updateSMTPProvider( + providerId: '', + name: '', // (optional) + host: '', // (optional) + port: 1, // (optional) + username: '', // (optional) + password: '', // (optional) + encryption: SmtpEncryption.none, // (optional) + autoTLS: false, // (optional) + mailer: '', // (optional) + fromName: '', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '', // (optional) + replyToEmail: '', // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md index 7faac9e0..aa7b7c59 100644 --- a/docs/examples/tablesdb/create-boolean-column.md +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnBoolean result = await tablesDb.createBooleanColumn( +ColumnBoolean result = await tablesDB.createBooleanColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md index 9519db81..10284ddf 100644 --- a/docs/examples/tablesdb/create-datetime-column.md +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnDatetime result = await tablesDb.createDatetimeColumn( +ColumnDatetime result = await tablesDB.createDatetimeColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md index 6ce8ed37..ec36530e 100644 --- a/docs/examples/tablesdb/create-email-column.md +++ b/docs/examples/tablesdb/create-email-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnEmail result = await tablesDb.createEmailColumn( +ColumnEmail result = await tablesDB.createEmailColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md index 9584d81f..594376d7 100644 --- a/docs/examples/tablesdb/create-enum-column.md +++ b/docs/examples/tablesdb/create-enum-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnEnum result = await tablesDb.createEnumColumn( +ColumnEnum result = await tablesDB.createEnumColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md index 6092f584..0b970737 100644 --- a/docs/examples/tablesdb/create-float-column.md +++ b/docs/examples/tablesdb/create-float-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnFloat result = await tablesDb.createFloatColumn( +ColumnFloat result = await tablesDB.createFloatColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md index 01466398..64fea757 100644 --- a/docs/examples/tablesdb/create-index.md +++ b/docs/examples/tablesdb/create-index.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnIndex result = await tablesDb.createIndex( +ColumnIndex result = await tablesDB.createIndex( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md index 5f4eb0b8..d90dca56 100644 --- a/docs/examples/tablesdb/create-integer-column.md +++ b/docs/examples/tablesdb/create-integer-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnInteger result = await tablesDb.createIntegerColumn( +ColumnInteger result = await tablesDB.createIntegerColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md index 44e9ce38..322776e6 100644 --- a/docs/examples/tablesdb/create-ip-column.md +++ b/docs/examples/tablesdb/create-ip-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnIp result = await tablesDb.createIpColumn( +ColumnIp result = await tablesDB.createIpColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md index 1b61250d..3b2ea3d1 100644 --- a/docs/examples/tablesdb/create-relationship-column.md +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnRelationship result = await tablesDb.createRelationshipColumn( +ColumnRelationship result = await tablesDB.createRelationshipColumn( databaseId: '', tableId: '', relatedTableId: '', diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 5724e3ed..15e4f8ea 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setSession(''); // The user session to authenticate with -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -Row result = await tablesDb.createRow( +Row result = await tablesDB.createRow( databaseId: '', tableId: '', rowId: '', diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md index 4f4e1c45..c22fdba5 100644 --- a/docs/examples/tablesdb/create-rows.md +++ b/docs/examples/tablesdb/create-rows.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -RowList result = await tablesDb.createRows( +RowList result = await tablesDB.createRows( databaseId: '', tableId: '', rows: [], diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md index a5d53a0e..6fd0e93a 100644 --- a/docs/examples/tablesdb/create-string-column.md +++ b/docs/examples/tablesdb/create-string-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnString result = await tablesDb.createStringColumn( +ColumnString result = await tablesDB.createStringColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md index bb8206dc..c055e93f 100644 --- a/docs/examples/tablesdb/create-table.md +++ b/docs/examples/tablesdb/create-table.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -Table result = await tablesDb.createTable( +Table result = await tablesDB.createTable( databaseId: '', tableId: '', name: '', diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md index ac181814..05c8da80 100644 --- a/docs/examples/tablesdb/create-url-column.md +++ b/docs/examples/tablesdb/create-url-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnUrl result = await tablesDb.createUrlColumn( +ColumnUrl result = await tablesDB.createUrlColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index 830b5898..6991b910 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -Database result = await tablesDb.create( +Database result = await tablesDB.create( databaseId: '', name: '', enabled: false, // (optional) diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md index 1f3a5e91..8c376563 100644 --- a/docs/examples/tablesdb/decrement-row-column.md +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setSession(''); // The user session to authenticate with -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -Row result = await tablesDb.decrementRowColumn( +Row result = await tablesDB.decrementRowColumn( databaseId: '', tableId: '', rowId: '', diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md index f86e7f10..ebee29e4 100644 --- a/docs/examples/tablesdb/delete-column.md +++ b/docs/examples/tablesdb/delete-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -await tablesDb.deleteColumn( +await tablesDB.deleteColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md index 3727bd41..2b73e25f 100644 --- a/docs/examples/tablesdb/delete-index.md +++ b/docs/examples/tablesdb/delete-index.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -await tablesDb.deleteIndex( +await tablesDB.deleteIndex( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/delete-row.md b/docs/examples/tablesdb/delete-row.md index 8ebdf733..f3966c09 100644 --- a/docs/examples/tablesdb/delete-row.md +++ b/docs/examples/tablesdb/delete-row.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setSession(''); // The user session to authenticate with -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -await tablesDb.deleteRow( +await tablesDB.deleteRow( databaseId: '', tableId: '', rowId: '', diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md index 932e6475..eb2aebb3 100644 --- a/docs/examples/tablesdb/delete-rows.md +++ b/docs/examples/tablesdb/delete-rows.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -await tablesDb.deleteRows( +await tablesDB.deleteRows( databaseId: '', tableId: '', queries: [], // (optional) diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md index c9504d3e..d425cec1 100644 --- a/docs/examples/tablesdb/delete-table.md +++ b/docs/examples/tablesdb/delete-table.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -await tablesDb.deleteTable( +await tablesDB.deleteTable( databaseId: '', tableId: '', ); diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md index c8ea7818..565f4ef6 100644 --- a/docs/examples/tablesdb/delete.md +++ b/docs/examples/tablesdb/delete.md @@ -5,8 +5,8 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -await tablesDb.delete( +await tablesDB.delete( databaseId: '', ); diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md index 898945fa..437d72e6 100644 --- a/docs/examples/tablesdb/get-column.md +++ b/docs/examples/tablesdb/get-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); - result = await tablesDb.getColumn( + result = await tablesDB.getColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md index eb8703d2..ef5f9a0e 100644 --- a/docs/examples/tablesdb/get-index.md +++ b/docs/examples/tablesdb/get-index.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnIndex result = await tablesDb.getIndex( +ColumnIndex result = await tablesDB.getIndex( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md index abd412b1..0af17b61 100644 --- a/docs/examples/tablesdb/get-row.md +++ b/docs/examples/tablesdb/get-row.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setSession(''); // The user session to authenticate with -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -Row result = await tablesDb.getRow( +Row result = await tablesDB.getRow( databaseId: '', tableId: '', rowId: '', diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md index becce951..c230f6a1 100644 --- a/docs/examples/tablesdb/get-table.md +++ b/docs/examples/tablesdb/get-table.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -Table result = await tablesDb.getTable( +Table result = await tablesDB.getTable( databaseId: '', tableId: '', ); diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md index 44628b3c..d147fb1c 100644 --- a/docs/examples/tablesdb/get.md +++ b/docs/examples/tablesdb/get.md @@ -5,8 +5,8 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -Database result = await tablesDb.get( +Database result = await tablesDB.get( databaseId: '', ); diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md index 35cc48d3..bbe262e5 100644 --- a/docs/examples/tablesdb/increment-row-column.md +++ b/docs/examples/tablesdb/increment-row-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setSession(''); // The user session to authenticate with -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -Row result = await tablesDb.incrementRowColumn( +Row result = await tablesDB.incrementRowColumn( databaseId: '', tableId: '', rowId: '', diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md index 608ff1e6..2665c0db 100644 --- a/docs/examples/tablesdb/list-columns.md +++ b/docs/examples/tablesdb/list-columns.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnList result = await tablesDb.listColumns( +ColumnList result = await tablesDB.listColumns( databaseId: '', tableId: '', queries: [], // (optional) diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md index c78eaddf..5028923d 100644 --- a/docs/examples/tablesdb/list-indexes.md +++ b/docs/examples/tablesdb/list-indexes.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnIndexList result = await tablesDb.listIndexes( +ColumnIndexList result = await tablesDB.listIndexes( databaseId: '', tableId: '', queries: [], // (optional) diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index 07b2733a..83bbe38f 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setSession(''); // The user session to authenticate with -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -RowList result = await tablesDb.listRows( +RowList result = await tablesDB.listRows( databaseId: '', tableId: '', queries: [], // (optional) diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md index 5d18cd5b..ede3f5cd 100644 --- a/docs/examples/tablesdb/list-tables.md +++ b/docs/examples/tablesdb/list-tables.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -TableList result = await tablesDb.listTables( +TableList result = await tablesDB.listTables( databaseId: '', queries: [], // (optional) search: '', // (optional) diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md index 38b73b43..e13187de 100644 --- a/docs/examples/tablesdb/list.md +++ b/docs/examples/tablesdb/list.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -DatabaseList result = await tablesDb.list( +DatabaseList result = await tablesDB.list( queries: [], // (optional) search: '', // (optional) ); diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md index 7ca6e5e3..1e6c604a 100644 --- a/docs/examples/tablesdb/update-boolean-column.md +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnBoolean result = await tablesDb.updateBooleanColumn( +ColumnBoolean result = await tablesDB.updateBooleanColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md index 0ea38fe9..982d8d55 100644 --- a/docs/examples/tablesdb/update-datetime-column.md +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnDatetime result = await tablesDb.updateDatetimeColumn( +ColumnDatetime result = await tablesDB.updateDatetimeColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md index 0fdc6521..e2f07519 100644 --- a/docs/examples/tablesdb/update-email-column.md +++ b/docs/examples/tablesdb/update-email-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnEmail result = await tablesDb.updateEmailColumn( +ColumnEmail result = await tablesDB.updateEmailColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md index 5f4403fe..b0ddd485 100644 --- a/docs/examples/tablesdb/update-enum-column.md +++ b/docs/examples/tablesdb/update-enum-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnEnum result = await tablesDb.updateEnumColumn( +ColumnEnum result = await tablesDB.updateEnumColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md index bfb1d7c3..7239b488 100644 --- a/docs/examples/tablesdb/update-float-column.md +++ b/docs/examples/tablesdb/update-float-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnFloat result = await tablesDb.updateFloatColumn( +ColumnFloat result = await tablesDB.updateFloatColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md index c1ae2887..bb98ad27 100644 --- a/docs/examples/tablesdb/update-integer-column.md +++ b/docs/examples/tablesdb/update-integer-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnInteger result = await tablesDb.updateIntegerColumn( +ColumnInteger result = await tablesDB.updateIntegerColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md index c1d9123f..21c5f1bc 100644 --- a/docs/examples/tablesdb/update-ip-column.md +++ b/docs/examples/tablesdb/update-ip-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnIp result = await tablesDb.updateIpColumn( +ColumnIp result = await tablesDB.updateIpColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md index 5f0fafb4..95e09d38 100644 --- a/docs/examples/tablesdb/update-relationship-column.md +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnRelationship result = await tablesDb.updateRelationshipColumn( +ColumnRelationship result = await tablesDB.updateRelationshipColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index 31535b4e..d66c24f5 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setSession(''); // The user session to authenticate with -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -Row result = await tablesDb.updateRow( +Row result = await tablesDB.updateRow( databaseId: '', tableId: '', rowId: '', diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md index b8d47a35..a0973b47 100644 --- a/docs/examples/tablesdb/update-rows.md +++ b/docs/examples/tablesdb/update-rows.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -RowList result = await tablesDb.updateRows( +RowList result = await tablesDB.updateRows( databaseId: '', tableId: '', data: {}, // (optional) diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md index 7ef30e4b..bd390dfd 100644 --- a/docs/examples/tablesdb/update-string-column.md +++ b/docs/examples/tablesdb/update-string-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnString result = await tablesDb.updateStringColumn( +ColumnString result = await tablesDB.updateStringColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md index 0ff11cdf..fd6646a0 100644 --- a/docs/examples/tablesdb/update-table.md +++ b/docs/examples/tablesdb/update-table.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -Table result = await tablesDb.updateTable( +Table result = await tablesDB.updateTable( databaseId: '', tableId: '', name: '', diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md index 7075ba15..fcfdfcd1 100644 --- a/docs/examples/tablesdb/update-url-column.md +++ b/docs/examples/tablesdb/update-url-column.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -ColumnUrl result = await tablesDb.updateUrlColumn( +ColumnUrl result = await tablesDB.updateUrlColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md index 72b50f0b..81d33799 100644 --- a/docs/examples/tablesdb/update.md +++ b/docs/examples/tablesdb/update.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -Database result = await tablesDb.update( +Database result = await tablesDB.update( databaseId: '', name: '', enabled: false, // (optional) diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index 95720df0..fbe4d292 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setSession(''); // The user session to authenticate with -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -Row result = await tablesDb.upsertRow( +Row result = await tablesDB.upsertRow( databaseId: '', tableId: '', rowId: '', diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md index e6e9cb10..031aa50b 100644 --- a/docs/examples/tablesdb/upsert-rows.md +++ b/docs/examples/tablesdb/upsert-rows.md @@ -5,9 +5,9 @@ Client client = Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -TablesDb tablesDb = TablesDb(client); +TablesDB tablesDB = TablesDB(client); -RowList result = await tablesDb.upsertRows( +RowList result = await tablesDB.upsertRows( databaseId: '', tableId: '', rows: [], diff --git a/docs/examples/users/create-m-f-a-recovery-codes.md b/docs/examples/users/create-m-f-a-recovery-codes.md new file mode 100644 index 00000000..12a7e32f --- /dev/null +++ b/docs/examples/users/create-m-f-a-recovery-codes.md @@ -0,0 +1,12 @@ +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 + +Users users = Users(client); + +MfaRecoveryCodes result = await users.createMFARecoveryCodes( + userId: '', +); diff --git a/docs/examples/users/delete-m-f-a-authenticator.md b/docs/examples/users/delete-m-f-a-authenticator.md new file mode 100644 index 00000000..b5dcc6af --- /dev/null +++ b/docs/examples/users/delete-m-f-a-authenticator.md @@ -0,0 +1,13 @@ +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 + +Users users = Users(client); + +await users.deleteMFAAuthenticator( + userId: '', + type: AuthenticatorType.totp, +); diff --git a/docs/examples/users/get-m-f-a-recovery-codes.md b/docs/examples/users/get-m-f-a-recovery-codes.md new file mode 100644 index 00000000..e16158bf --- /dev/null +++ b/docs/examples/users/get-m-f-a-recovery-codes.md @@ -0,0 +1,12 @@ +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 + +Users users = Users(client); + +MfaRecoveryCodes result = await users.getMFARecoveryCodes( + userId: '', +); diff --git a/docs/examples/users/list-m-f-a-factors.md b/docs/examples/users/list-m-f-a-factors.md new file mode 100644 index 00000000..290109d2 --- /dev/null +++ b/docs/examples/users/list-m-f-a-factors.md @@ -0,0 +1,12 @@ +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 + +Users users = Users(client); + +MfaFactors result = await users.listMFAFactors( + userId: '', +); diff --git a/docs/examples/users/update-m-f-a-recovery-codes.md b/docs/examples/users/update-m-f-a-recovery-codes.md new file mode 100644 index 00000000..a2340ff8 --- /dev/null +++ b/docs/examples/users/update-m-f-a-recovery-codes.md @@ -0,0 +1,12 @@ +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 + +Users users = Users(client); + +MfaRecoveryCodes result = await users.updateMFARecoveryCodes( + userId: '', +); diff --git a/docs/examples/users/update-m-f-a.md b/docs/examples/users/update-m-f-a.md new file mode 100644 index 00000000..7d3b71d9 --- /dev/null +++ b/docs/examples/users/update-m-f-a.md @@ -0,0 +1,13 @@ +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 + +Users users = Users(client); + +User result = await users.updateMFA( + userId: '', + mfa: false, +); 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 9d35ec51..372b0dcf 100644 --- a/lib/dart_appwrite.dart +++ b/lib/dart_appwrite.dart @@ -37,7 +37,7 @@ part 'services/locale.dart'; part 'services/messaging.dart'; part 'services/sites.dart'; part 'services/storage.dart'; -part 'services/tables-db.dart'; +part 'services/tables-d-b.dart'; part 'services/teams.dart'; part 'services/tokens.dart'; part 'services/users.dart'; diff --git a/lib/query.dart b/lib/query.dart index c9a2fc91..281aa756 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if (attribute != null) { + if(attribute != null) { map['attribute'] = attribute; } - - if (values != null) { + + if(values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} +} \ 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 b1358d47..eabd0d7d 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,26 +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 @@ -29,32 +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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -63,442 +60,661 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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() async { - final String apiPath = '/account/jwts'; + Future createJWT() async { + final String apiPath = '/account/jwts'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; + + final Map apiParams = { + 'queries': queries, - final Map apiParams = {'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.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 apiParams = { + + 'mfa': mfa, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - 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 `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 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); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - 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 `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 apiParams = { + + 'otp': otp, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + 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.User.fromMap(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, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `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 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; - } + 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); + + 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; + + } /// 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/challenge'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `CreateMFAChallenge` instead.') + Future createMfaChallenge({required enums.AuthenticationFactor factor}) async { + final String apiPath = '/account/mfa/challenge'; + + final Map apiParams = { + + 'factor': factor.value, - final Map apiParams = {'factor': factor.value}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/challenge'; + + 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); 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. - Future updateMfaChallenge({ - required String challengeId, - required String otp, - }) async { - final String apiPath = '/account/mfa/challenge'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `UpdateMFAChallenge` instead.') + Future updateMfaChallenge({required String challengeId, required String otp}) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { + 'challengeId': challengeId, - 'otp': otp, +'otp': otp, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/challenge'; + + final Map apiParams = { + + 'challengeId': challengeId, +'otp': otp, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - Future listMfaFactors() async { - final String apiPath = '/account/mfa/factors'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `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'; + + final Map apiParams = { + + + }; + + final Map 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. - Future getMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `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'; + + final Map apiParams = { + + + }; + + final Map 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. - Future createMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `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 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'; + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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. - Future updateMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `UpdateMFARecoveryCodes` instead.') + Future updateMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', - 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'; + + 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.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 apiParams = { + + 'name': name, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'oldPassword': oldPassword, +'oldPassword': oldPassword, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 apiParams = { + + 'prefs': prefs, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 @@ -508,98 +724,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, - final Map apiParams = {'email': email, 'url': url}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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; - 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 @@ -608,212 +825,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 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 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.') - Future updateMagicURLSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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.') - Future updatePhoneSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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; - 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 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 /// provided user ID has not be registered, a new user will be created. Use the @@ -821,34 +1039,31 @@ 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, - 'phrase': phrase, +'email': email, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -859,79 +1074,66 @@ 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, - 'url': url, - 'phrase': phrase, +'email': email, +'url': url, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { 'success': success, - 'failure': failure, - 'scopes': scopes, +'failure': failure, +'scopes': scopes, + 'project': client.config['project'], }; 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), - ); + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -939,16 +1141,15 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri( - scheme: endpoint.scheme, + Uri url = Uri(scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&'), + 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 @@ -956,29 +1157,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}; + final Map apiParams = { + + 'userId': userId, +'phone': phone, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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** @@ -989,52 +1191,56 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'url': url}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 updateVerification({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/verification'; + Future updateVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 @@ -1044,44 +1250,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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; + + final Map apiParams = { + + + }; - final Map apiParams = {}; + final Map apiHeaders = { + 'content-type': 'application/json', - 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/verification/phone'; + Future updatePhoneVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index 8033f1cd..a91d6d3f 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,255 +1,189 @@ 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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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, - 'width': width, - 'height': height, +'width': width, +'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 = { 'name': name, - 'width': width, - 'height': height, - 'background': background, +'width': width, +'height': height, +'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, - 'size': size, - 'margin': margin, - 'download': download, +'size': size, +'margin': margin, +'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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/databases.dart b/lib/services/databases.dart index ca557ea5..f962d8b3 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1682 +1,1215 @@ 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, - }) 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}) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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.createDatabase` 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.createDatabase` instead.') + Future create({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases'; final Map apiParams = { + 'databaseId': databaseId, - 'name': name, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/databases/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.') + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'collectionId': collectionId, - 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - List? permissions, - bool? documentSecurity, - bool? enabled, - }) 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + @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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + @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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return 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/{key}/relationship' - .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/{key}/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'onDelete': onDelete?.value, - 'newKey': newKey, +'newKey': newKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'documentId': documentId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - required Map data, - List? permissions, - }) 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, required Map data, List? permissions}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - 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; - } + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'attributes': attributes, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 index by 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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); - - 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; - } -} + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/functions.dart b/lib/services/functions.dart index e86f1afe..05a7d5f7 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,316 +1,256 @@ 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, - }) async { - final String apiPath = '/functions'; + Future list({List? queries, String? search}) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? specification, - }) 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? specification}) async { + final String apiPath = '/functions'; final Map apiParams = { + 'functionId': functionId, - 'name': name, - 'runtime': runtime.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'name': name, +'runtime': runtime.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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? specification, - }) 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? specification}) async { + final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'name': name, - 'runtime': runtime?.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'runtime': runtime?.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll( - '{functionId}', - functionId, - ); + Future listDeployments({required String functionId, List? queries, String? search}) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 = { + 'entrypoint': entrypoint, - 'commands': commands, - 'code': code, - 'activate': activate, +'commands': commands, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -325,446 +265,361 @@ 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, - 'buildId': buildId, +'buildId': buildId, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String functionId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/functions/{functionId}/deployments/template'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll( - '{functionId}', - functionId, - ); + Future createVcsDeployment({required String functionId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll( - '{functionId}', - functionId, - ); + Future listExecutions({required String functionId, List? queries}) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 = { + 'body': body, - 'async': xasync, - 'path': path, - 'method': method?.value, - 'headers': headers, - 'scheduledAt': scheduledAt, +'async': xasync, +'path': path, +'method': method?.value, +'headers': headers, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index 18eb54f1..e2418b52 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,49 +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 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; - 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 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/health.dart b/lib/services/health.dart index 5250c91d..0cf64ac6 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,414 +1,438 @@ 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.HealthStatus.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 = {'domain': domain}; + final Map apiParams = { + 'domain': domain, - 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.HealthCertificate.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.HealthStatus.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.HealthStatus.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = { + 'threshold': threshold, - final Map apiParams = {'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 = { 'name': name, - 'threshold': threshold, +'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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, - ); - - final Map apiParams = {'threshold': threshold}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future getFailedJobs({required enums.Name name, int? threshold}) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll('{name}', name.value); + + final Map apiParams = { + 'threshold': threshold, + + + }; + + final Map 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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 @@ -417,20 +441,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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 4d3cc3e0..430a00c3 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,164 +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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index afe3ee86..93c843cc 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1478 +1,1393 @@ 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, - }) async { - final String apiPath = '/messaging/messages'; + Future listMessages({List? queries, String? search}) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'cc': cc, - 'bcc': bcc, - 'attachments': attachments, - 'draft': draft, - 'html': html, - 'scheduledAt': scheduledAt, +'subject': subject, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'cc': cc, +'bcc': bcc, +'attachments': attachments, +'draft': draft, +'html': html, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'title': title, - 'body': body, - 'topics': topics, - 'users': users, - 'targets': targets, - '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.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'title': title, +'body': body, +'topics': topics, +'users': users, +'targets': targets, +'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.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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); + + return models.Message.fromMap(res.data); + + } + + /// Create a new SMS message. + @Deprecated('This API has been deprecated since 1.8.0. Please use `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, +'topics': topics, +'users': users, +'targets': targets, +'draft': draft, +'scheduledAt': scheduledAt, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'draft': draft, +'scheduledAt': scheduledAt, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 `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, - 'draft': draft, - 'scheduledAt': scheduledAt, +'users': users, +'targets': targets, +'content': content, +'draft': draft, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.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 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 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; - } + return res.data; + + } /// Get the message activity logs listed by its unique ID. - Future listMessageLogs({ - required String messageId, - List? queries, - }) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listMessageLogs({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/providers'; + Future listProviders({List? queries, String? search}) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 `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, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 `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 = { + 'name': name, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, - 'enabled': enabled, +'enabled': enabled, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.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 = { + 'name': name, - 'enabled': enabled, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, +'enabled': enabled, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 `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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 `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 = { + 'name': name, - 'serviceAccountJSON': serviceAccountJSON, - 'enabled': enabled, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.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 = { + 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'enabled': enabled, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'enabled': enabled, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, - 'enabled': enabled, +'name': name, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, +'enabled': enabled, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'enabled': enabled, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 `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, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.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, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 `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 = { + 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 = { + 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'from': from, - 'customerId': customerId, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'customerId': customerId, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'customerId': customerId, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'customerId': customerId, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'username': username, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'username': username, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'username': username, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'username': username, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'accountSid': accountSid, - 'authToken': authToken, - 'enabled': enabled, +'name': name, +'from': from, +'accountSid': accountSid, +'authToken': authToken, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'accountSid': accountSid, - 'authToken': authToken, - 'from': from, +'enabled': enabled, +'accountSid': accountSid, +'authToken': authToken, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'enabled': enabled, +'name': name, +'from': from, +'apiKey': apiKey, +'apiSecret': apiSecret, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'from': from, +'enabled': enabled, +'apiKey': apiKey, +'apiSecret': apiSecret, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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, - }) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( - '{providerId}', - providerId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listProviderLogs({required String providerId, List? queries}) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs' - .replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs({required String subscriberId, List? queries}) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + '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.LogList.fromMap(res.data); - } + + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({ - List? queries, - String? search, - }) async { - final String apiPath = '/messaging/topics'; + Future listTopics({List? queries, String? search}) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'subscribe': subscribe, +'name': name, +'subscribe': subscribe, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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; - return res.data; - } + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs({ - required String topicId, - List? queries, - }) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( - '{topicId}', - topicId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTopicLogs({required String topicId, List? queries}) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( - '{topicId}', - topicId, - ); + Future listSubscribers({required String topicId, List? queries, String? search}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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 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); - - 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; - } -} + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/sites.dart b/lib/services/sites.dart index d89f2192..5481986e 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,296 +1,247 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? outputDirectory, - enums.Adapter? adapter, - String? installationId, - String? fallbackFile, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites'; final Map apiParams = { + 'siteId': siteId, - 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime.value, - 'adapter': adapter?.value, - 'installationId': installationId, - 'fallbackFile': fallbackFile, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime.value, +'adapter': adapter?.value, +'installationId': installationId, +'fallbackFile': fallbackFile, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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? outputDirectory, - enums.BuildRuntime? buildRuntime, - enums.Adapter? adapter, - String? fallbackFile, - String? installationId, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime?.value, - 'adapter': adapter?.value, - 'fallbackFile': fallbackFile, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime?.value, +'adapter': adapter?.value, +'fallbackFile': fallbackFile, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future listDeployments({required String siteId, List? queries, String? search}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({ - required String siteId, - required InputFile code, - required bool activate, - String? installCommand, - String? buildCommand, - String? outputDirectory, - Function(UploadProgress)? onProgress, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'code': code, - 'activate': activate, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -305,400 +256,331 @@ 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String siteId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll( - '{siteId}', - siteId, - ); + Future createVcsDeployment({required String siteId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll( - '{siteId}', - siteId, - ); + Future listLogs({required String siteId, List? queries}) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ee630883..ccdce915 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,226 +1,184 @@ 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, - }) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({List? queries, String? search}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { + 'bucketId': bucketId, - 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'name': name, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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, - }) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( - '{bucketId}', - bucketId, - ); + Future listFiles({required String bucketId, List? queries, String? search}) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'permissions': permissions, +'file': file, +'permissions': permissions, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -236,187 +194,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 = { + 'name': name, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 = { 'width': width, - 'height': height, - 'gravity': gravity?.value, - 'quality': quality, - 'borderWidth': borderWidth, - 'borderColor': borderColor, - 'borderRadius': borderRadius, - 'opacity': opacity, - 'rotation': rotation, - 'background': background, - 'output': output?.value, - 'token': token, - +'height': height, +'gravity': gravity?.value, +'quality': quality, +'borderWidth': borderWidth, +'borderColor': borderColor, +'borderRadius': borderRadius, +'opacity': opacity, +'rotation': rotation, +'background': background, +'output': output?.value, +'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 = { '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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 7cf31d00..6a007ccd 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1520 +1,1162 @@ part of '../dart_appwrite.dart'; -class TablesDb extends Service { - TablesDb(super.client); +class TablesDB extends Service { + 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, - }) async { - final String apiPath = '/tablesdb'; + Future list({List? queries, String? search}) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( - '{databaseId}', - databaseId, - ); + Future listTables({required String databaseId, List? queries, String? search}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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/server/databases#databasesCreateTable) + /// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createTable({ - required String databaseId, - required String tableId, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'tableId': tableId, - 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future updateTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - return res.data; - } + } /// List columns in the table. - Future listColumns({ - required String databaseId, - required String tableId, - List? queries, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listColumns({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + 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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listIndexes({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'columns': columns, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + 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 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); - - 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; - } + 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 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/databases#databasesCreateTable) + /// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRow({ - required String databaseId, - required String tableId, - required String rowId, - required Map data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'rowId': rowId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/databases#databasesCreateTable) + /// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future createRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/databases#databasesCreateTable) + /// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - /// - Future upsertRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future upsertRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future updateRows({required String databaseId, required String tableId, Map? data, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future deleteRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future getRow({required String databaseId, required String tableId, required String rowId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/databases#databasesCreateTable) + /// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future upsertRow({ - required String databaseId, - required String tableId, - required String rowId, - Map? data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - 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; - } + Future deleteRow({required String databaseId, required String tableId, required String rowId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future decrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? min}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future incrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? max}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/teams.dart b/lib/services/teams.dart index 5fd59641..c21a93af 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,147 +1,140 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'roles': roles, +'name': name, +'roles': roles, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiParams = {'name': name}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - 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, - }) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll( - '{teamId}', - teamId, - ); + Future listMemberships({required String teamId, List? queries, String? search}) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 @@ -149,210 +142,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 = { + 'email': email, - 'userId': userId, - 'phone': phone, - 'roles': roles, - 'url': url, - 'name': name, +'userId': userId, +'phone': phone, +'roles': roles, +'url': url, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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, - ); + /// + 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); 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 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; - 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); - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index 4e6915dc..cb04449b 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,113 +1,109 @@ 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, - }) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future list({required String bucketId, required String fileId, List? queries}) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); - - 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, - ); + 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); 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 apiParams = {'expire': expire}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/users.dart b/lib/services/users.dart index c98182b7..586f6770 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,359 +1,314 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'password': password, - 'name': name, +'email': email, +'phone': phone, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = '/users/identities'; + Future listIdentities({List? queries, String? search}) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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; - 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordCpu': passwordCpu, +'passwordMemory': passwordMemory, +'passwordParallel': passwordParallel, +'passwordLength': passwordLength, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordSaltSeparator': passwordSaltSeparator, +'passwordSignerKey': passwordSignerKey, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'passwordVersion': passwordVersion?.value, - 'name': name, +'email': email, +'password': password, +'passwordVersion': passwordVersion?.value, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -361,748 +316,782 @@ 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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, - ); - - 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, - ); + 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); 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 = { + 'sessionId': sessionId, - 'duration': duration, +'duration': duration, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// Get the user activity logs list by its unique ID. - Future listLogs({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/logs'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listLogs({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll( - '{userId}', - userId, - ); + Future listMemberships({required String userId, List? queries, String? search}) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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. - 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 `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); + + 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); + + final Map apiParams = { + + 'mfa': mfa, - final Map apiParams = {'mfa': mfa}; + }; + + final Map apiHeaders = { + 'content-type': 'application/json', - 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. - 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 `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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; - final Map apiParams = {}; + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - final Map apiHeaders = {'content-type': 'application/json'}; + return res.data; - 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 `ListMFAFactors` instead.') + Future listMfaFactors({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/factors'.replaceAll('{userId}', userId); + + final Map apiParams = { + + + }; + + final Map 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. - 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 `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); + + final Map apiParams = { + + + }; + + final Map 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 `UpdateMFARecoveryCodes` instead.') + Future updateMfaRecoveryCodes({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 `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 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.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 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } + + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll( - '{userId}', - userId, - ); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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 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 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; - 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 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; - } + 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// List the messaging targets that are associated with a user. - Future listTargets({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/targets'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - 'providerId': providerId, - 'name': name, +'providerType': providerType.value, +'identifier': identifier, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'identifier': identifier, - 'providerId': providerId, - 'name': name, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - 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, - ); - - final Map apiParams = {'length': length, 'expire': expire}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future createToken({required String userId, int? length, int? expire}) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll('{userId}', userId); + + final Map apiParams = { + + 'length': length, +'expire': expire, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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); - } -} + + } +} \ No newline at end of file diff --git a/lib/src/client.dart b/lib/src/client.dart index d82d623a..0d9be210 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,8 +81,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 08d93b85..cd82d264 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,25 +2,21 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index c961873f..ea2cd62a 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,11 +9,14 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -31,66 +34,59 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format': '1.8.0', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -139,11 +135,7 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -170,19 +162,12 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 2bd7d639..f9e695bf 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,11 +10,17 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => - ClientIO(endPoint: endPoint, selfSigned: selfSigned); +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => + ClientIO( + endPoint: endPoint, + selfSigned: selfSigned, + ); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -37,68 +43,60 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent': - 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format': '1.8.0', + 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -153,16 +151,11 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, - file.path!, - filename: file.filename, - ); + paramName, file.path!, + filename: file.filename); } else { - 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, @@ -201,19 +194,12 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -258,7 +244,10 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse(res, responseType: responseType); + return prepareResponse( + res, + responseType: responseType, + ); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 06c9ebe3..658b79b6 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest).fields.addAll({ - "$key[$i]": v.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({"$key[$i]": v.toString()}); }); } else { - (request as http.MultipartRequest).fields.addAll({ - key: value.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({key: value.toString()}); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value) { + params = params.map((key, value){ if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,13 +51,12 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port, - ); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -67,9 +66,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); @@ -116,25 +113,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.dart b/lib/src/enums.dart index 0f250ea3..595afdc2 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes, + bytes } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 3341912f..2f198d4e 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 1bae5c8a..cd45b6a1 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 42954430..7d2d7016 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,16 +1,18 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 e20f48c6..af5ebaad 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,24 +1,26 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index b101d35f..8d86530d 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({required this.value}); + const IndexType({ + 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/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/name.dart b/lib/src/enums/name.dart index 74823feb..613bf5f1 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,22 +1,24 @@ 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'), - 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'), + 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 383e45b1..076c1c50 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,50 +1,52 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d4fef930..d34440ec 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index f01fcb01..0bf8e2ad 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({required this.value}); + const VCSDeploymentType({ + 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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index 4145f701..f174d569 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 4e901476..c9f67200 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 35c7b767..2fabb416 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index 7d27adba..fdcee07a 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index fec6f65a..120723df 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 0e80700f..504b5f8f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 bae6618f..5f3e1654 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 0ca54691..20dd7189 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1df01f19..a5b27b4f 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 21f8e9a3..96ce554b 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 298c181a..a4953a0e 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c6eecadd..03ba94c7 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1ef48332..8a5aa89d 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8c8fcb73..d17f414a 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index c5fa6adc..4098a5a1 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "attributes": attributes}; - } + Map toMap() { + return { + "total": total, + "attributes": attributes, + }; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 903c6290..050cbe14 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7374fa78..2202d255 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index f0bc295e..0c3ddf9e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index b8fb5e48..3bb374be 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 9d5b771b..b02adbf6 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Buckets List class BucketList implements Model { - /// Total number of buckets rows 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))), + ); + } - Map toMap() { - return {"total": total, "buckets": buckets.map((p) => p.toMap()).toList()}; - } + 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 72de429d..c55110cf 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index b5ff3518..240e2ce0 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Collections List class CollectionList implements Model { - /// Total number of collections rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 60fcfa48..0ffc8fea 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c21a2260..367686d0 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 15d80695..7deb5e26 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 558b7d43..7bb56922 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 3b2f1335..c0547e11 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 9d637d92..acf0f6df 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 7bea7426..576937e7 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,24 +2,28 @@ part of '../../models.dart'; /// Column Indexes List class ColumnIndexList implements Model { - /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 2ba463cd..3823f425 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6672d7ce..4ac1fa12 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 8eb0171f..475c1c40 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "columns": columns}; - } + Map toMap() { + return { + "total": total, + "columns": columns, + }; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index 6221c01e..e55d1534 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7b560989..6fd6a3b0 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 66c0ce7b..94271aa6 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 7318b7ad..1a9c5038 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 651b5ae4..5e954a05 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Continents List class ContinentList implements Model { - /// Total number of continents rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 c52b50f2..565b1d66 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,19 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index ea839b51..073fa251 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Countries List class CountryList implements Model { - /// Total number of countries rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 27eef0c1..deafffe3 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 2ff28c61..1c99fdf9 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Currencies List class CurrencyList implements Model { - /// Total number of currencies rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 8d79e052..cab95b02 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 01e092f2..5eb5c0ce 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Databases List class DatabaseList implements Model { - /// Total number of databases rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 448c62c7..ecf7e791 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 1ca87150..78ba8ab2 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Deployments List class DeploymentList implements Model { - /// Total number of deployments rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index cf85e457..be424a9c 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 b897a877..d45ea081 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,30 +2,31 @@ part of '../../models.dart'; /// Documents List class DocumentList implements Model { - /// Total number of documents rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 8618bcd6..0cfdbb4e 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,122 +2,118 @@ 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 upate date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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.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(), - trigger: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "trigger": trigger, - "status": status, - "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 upate date in ISO 8601 format. + final String $updatedAt; + + /// Execution roles. + final List $permissions; + + /// Function ID. + final String functionId; + + /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + final String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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.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(), + trigger: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "trigger": trigger, + "status": status, + "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 583d9fab..d44139ee 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Executions List class ExecutionList implements Model { - /// Total number of executions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 a6a9fa46..de8439ec 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index e7ca1bd5..94ea9a14 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Files List class FileList implements Model { - /// Total number of files rows 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))), + ); + } - Map toMap() { - return {"total": total, "files": files.map((p) => p.toMap()).toList()}; - } + 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 693c9b07..ea6b601a 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,48 +2,46 @@ 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)), - ), - ); - } - - 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))), + ); + } + + 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 0b908240..7614616a 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5661bec4..afe8f6b3 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Frameworks List class FrameworkList implements Model { - /// Total number of frameworks rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 56c2eded..64401c3f 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index 24b199b1..d5974f55 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,25 +2,28 @@ part of '../../models.dart'; /// Functions List class FunctionList implements Model { - /// Total number of functions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 463cf696..ecf0a178 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "value": value}; - } + Map toMap() { + return { + "name": name, + "value": value, + }; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index fa402e97..54c31e70 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return {"version": version, "status": status}; - } + Map toMap() { + return { + "version": version, + "status": status, + }; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index d412eba9..0a5b6ce9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5f06906b..95da1235 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,16 +2,22 @@ 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'], + ); + } - Map toMap() { - return {"size": size}; - } + Map toMap() { + return { + "size": size, + }; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 59b7092c..0d6e7216 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,26 +2,34 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return {"name": name, "ping": ping, "status": status}; - } + Map toMap() { + return { + "name": name, + "ping": ping, + "status": status, + }; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index dec2d54f..102dfe77 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,30 +2,34 @@ 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'], + ); + } - Map toMap() { - return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; - } + Map toMap() { + return { + "remoteTime": remoteTime, + "localTime": localTime, + "diff": diff, + }; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index 807bdfd0..c43c4d57 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 51ddb64a..b8358fc1 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Identities List class IdentityList implements Model { - /// Total number of identities rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 9d6d7aec..b6717c4e 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 65207b94..fef735fc 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Indexes List class IndexList implements Model { - /// Total number of indexes rows 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 490a1824..1b4ff7de 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"jwt": jwt}; - } + Map toMap() { + return { + "jwt": jwt, + }; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 9c45adb1..43eaad08 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,26 +2,34 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code, "nativeName": nativeName}; - } + 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 76a3f548..ea731471 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Languages List class LanguageList implements Model { - /// Total number of languages rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 084475bf..b5e9ad1a 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 cd5a1155..10499ef5 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"code": code, "name": name}; - } + 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 5fa5c0ce..c1243e06 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Locale codes list class LocaleCodeList implements Model { - /// Total number of localeCodes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 7fb3f364..cb567bd7 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 4a771585..9d4d7701 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Logs List class LogList implements Model { - /// Total number of logs rows 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))), + ); + } - Map toMap() { - return {"total": total, "logs": logs.map((p) => p.toMap()).toList()}; - } + 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 8ee142ad..26610e46 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index 993f7206..f08f5738 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Memberships List class MembershipList implements Model { - /// Total number of memberships rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 9b93b00d..c4e9e858 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index c577ccc1..acaacc34 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Message list class MessageList implements Model { - /// Total number of messages rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 96bf3c65..46c166fb 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 c930a23e..d49989d8 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 63411988..6c8b4e36 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,18 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"recoveryCodes": recoveryCodes}; - } + Map toMap() { + return { + "recoveryCodes": recoveryCodes, + }; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index fa57cb8b..01cf0857 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"secret": secret, "uri": uri}; - } + Map toMap() { + return { + "secret": secret, + "uri": uri, + }; + } } 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/phone.dart b/lib/src/models/phone.dart index 40f7bcd2..c8bbb95b 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 497aa36c..2d869308 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Phones List class PhoneList implements Model { - /// Total number of phones rows 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))), + ); + } - Map toMap() { - return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "phones": phones.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index 7bc3abc9..edb6083e 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,17 +2,23 @@ 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); - } + factory Preferences.fromMap(Map map) { + return Preferences( + data: map, + ); + } - Map toMap() { - return {"data": data}; - } + 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/provider.dart b/lib/src/models/provider.dart index 1a762f85..4295c486 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 6d579bd0..9710aea9 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Provider list class ProviderList implements Model { - /// Total number of providers rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index dad35dcc..ed520cc4 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 fcbcbc3a..fcdabb97 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,24 +2,28 @@ part of '../../models.dart'; /// Resource Tokens List class ResourceTokenList implements Model { - /// Total number of tokens rows 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))), + ); + } - Map toMap() { - return {"total": total, "tokens": tokens.map((p) => p.toMap()).toList()}; - } + 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 3700e577..62e69e5b 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 ae3f851d..a8374e2b 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,25 +2,31 @@ part of '../../models.dart'; /// Rows List class RowList implements Model { - /// Total number of rows 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))), + ); + } - Map toMap() { - return {"total": total, "rows": rows.map((p) => p.toMap()).toList()}; - } + 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 7c9677d8..35f82cfa 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 b93dbb8f..c234990c 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Runtimes List class RuntimeList implements Model { - /// Total number of runtimes rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 d2fe4f64..3a1d955f 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 563b04a4..0257cb86 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Sessions List class SessionList implements Model { - /// Total number of sessions rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 1449f8bd..5cda6acc 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index eb1a5457..cc9e4355 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Sites List class SiteList implements Model { - /// Total number of sites rows 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))), + ); + } - Map toMap() { - return {"total": total, "sites": sites.map((p) => p.toMap()).toList()}; - } + 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 e8fb8c75..e49d399c 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,35 +2,40 @@ 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(), + ); + } - Map toMap() { - return {"memory": memory, "cpus": cpus, "enabled": enabled, "slug": slug}; - } + 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 9a7d0154..0d2b6a73 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Specifications List class SpecificationList implements Model { - /// Total number of specifications rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 0c926297..36e18a7e 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 d5c6c01d..6c8c21e2 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Subscriber list class SubscriberList implements Model { - /// Total number of subscribers rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 7ce86b9d..1c5b88fb 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,78 +2,76 @@ 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; - 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, - }); + 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, + }); - 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)), - ), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 7398c48f..2b4b4b41 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Tables List class TableList implements Model { - /// Total number of tables rows 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))), + ); + } - Map toMap() { - return {"total": total, "tables": tables.map((p) => p.toMap()).toList()}; - } + 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 4be8b545..f2b3b6b4 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 29667c94..6ef2725d 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Target list class TargetList implements Model { - /// Total number of targets rows 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))), + ); + } - Map toMap() { - return {"total": total, "targets": targets.map((p) => p.toMap()).toList()}; - } + 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 43df33a8..e9058b5b 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 b70f12c1..a61cc9f7 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Teams List class TeamList implements Model { - /// Total number of teams rows 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))), + ); + } - Map toMap() { - return {"total": total, "teams": teams.map((p) => p.toMap()).toList()}; - } + 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 35115467..4f6b8454 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 430d44ac..461d5694 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 69a17ebc..1582a3c7 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Topic list class TopicList implements Model { - /// Total number of topics rows 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))), + ); + } - Map toMap() { - return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "topics": topics.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index 50bfb3ce..effc397c 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 56cc1b5b..edf7a95d 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Users List class UserList implements Model { - /// Total number of users rows 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))), + ); + } - Map toMap() { - return {"total": total, "users": users.map((p) => p.toMap()).toList()}; - } + 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 2a8e276a..58882a9f 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 cd90d85f..ee1f6f7a 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,27 +2,28 @@ part of '../../models.dart'; /// Variables List class VariableList implements Model { - /// Total number of variables rows 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))), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } diff --git a/test/services/account_test.dart b/test/services/account_test.dart index b3bea7c6..5f8488fe 100644 --- a/test/services/account_test.dart +++ b/test/services/account_test.dart @@ -261,6 +261,24 @@ void main() { }); + test('test method createMFAAuthenticator()', () async { + final Map data = { + 'secret': '1', + 'uri': '1',}; + + + 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', @@ -294,6 +312,39 @@ void main() { }); + 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 = ''; @@ -307,6 +358,19 @@ void main() { ); }); + 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', @@ -327,6 +391,26 @@ void main() { }); + 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', @@ -373,6 +457,52 @@ void main() { }); + 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, @@ -392,6 +522,25 @@ void main() { }); + 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': [],}; @@ -408,6 +557,22 @@ void main() { }); + 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': [],}; @@ -424,6 +589,22 @@ void main() { }); + 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': [],}; @@ -440,6 +621,22 @@ void main() { }); + 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', diff --git a/test/services/messaging_test.dart b/test/services/messaging_test.dart index 47a21df1..459dc2d4 100644 --- a/test/services/messaging_test.dart +++ b/test/services/messaging_test.dart @@ -200,6 +200,33 @@ void main() { }); + 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': 'Message status can be one of the following: draft, processing, scheduled, sent, or failed.',}; + + + 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', @@ -226,6 +253,32 @@ void main() { }); + 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': 'Message status can be one of the following: draft, processing, scheduled, sent, or failed.',}; + + + 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', @@ -343,6 +396,31 @@ void main() { }); + 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', @@ -367,6 +445,30 @@ void main() { }); + 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', @@ -392,6 +494,31 @@ void main() { }); + 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', @@ -416,6 +543,30 @@ void main() { }); + 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', @@ -589,6 +740,32 @@ void main() { }); + 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', @@ -613,6 +790,30 @@ void main() { }); + 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', diff --git a/test/services/tables_db_test.dart b/test/services/tables_db_test.dart index a6f8350f..6122fd6a 100644 --- a/test/services/tables_db_test.dart +++ b/test/services/tables_db_test.dart @@ -41,13 +41,13 @@ class MockClient extends Mock implements Client { } void main() { - group('TablesDb test', () { + group('TablesDB test', () { late MockClient client; - late TablesDb tablesDb; + late TablesDB tablesDB; setUp(() { client = MockClient(); - tablesDb = TablesDb(client); + tablesDB = TablesDB(client); }); test('test method list()', () async { @@ -61,7 +61,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.list( + final response = await tablesDB.list( ); expect(response, isA()); @@ -82,7 +82,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.create( + final response = await tablesDB.create( databaseId: '', name: '', ); @@ -105,7 +105,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.get( + final response = await tablesDB.get( databaseId: '', ); expect(response, isA()); @@ -127,7 +127,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.update( + final response = await tablesDB.update( databaseId: '', name: '', ); @@ -143,7 +143,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.delete( + final response = await tablesDB.delete( databaseId: '', ); }); @@ -159,7 +159,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.listTables( + final response = await tablesDB.listTables( databaseId: '', ); expect(response, isA()); @@ -185,7 +185,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.createTable( + final response = await tablesDB.createTable( databaseId: '', tableId: '', name: '', @@ -213,7 +213,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.getTable( + final response = await tablesDB.getTable( databaseId: '', tableId: '', ); @@ -240,7 +240,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.updateTable( + final response = await tablesDB.updateTable( databaseId: '', tableId: '', name: '', @@ -257,7 +257,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.deleteTable( + final response = await tablesDB.deleteTable( databaseId: '', tableId: '', ); @@ -274,7 +274,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.listColumns( + final response = await tablesDB.listColumns( databaseId: '', tableId: '', ); @@ -298,7 +298,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.createBooleanColumn( + final response = await tablesDB.createBooleanColumn( databaseId: '', tableId: '', key: '', @@ -324,7 +324,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.updateBooleanColumn( + final response = await tablesDB.updateBooleanColumn( databaseId: '', tableId: '', key: '', @@ -352,7 +352,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.createDatetimeColumn( + final response = await tablesDB.createDatetimeColumn( databaseId: '', tableId: '', key: '', @@ -379,7 +379,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.updateDatetimeColumn( + final response = await tablesDB.updateDatetimeColumn( databaseId: '', tableId: '', key: '', @@ -407,7 +407,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.createEmailColumn( + final response = await tablesDB.createEmailColumn( databaseId: '', tableId: '', key: '', @@ -434,7 +434,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.updateEmailColumn( + final response = await tablesDB.updateEmailColumn( databaseId: '', tableId: '', key: '', @@ -463,7 +463,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.createEnumColumn( + final response = await tablesDB.createEnumColumn( databaseId: '', tableId: '', key: '', @@ -492,7 +492,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.updateEnumColumn( + final response = await tablesDB.updateEnumColumn( databaseId: '', tableId: '', key: '', @@ -520,7 +520,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.createFloatColumn( + final response = await tablesDB.createFloatColumn( databaseId: '', tableId: '', key: '', @@ -546,7 +546,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.updateFloatColumn( + final response = await tablesDB.updateFloatColumn( databaseId: '', tableId: '', key: '', @@ -573,7 +573,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.createIntegerColumn( + final response = await tablesDB.createIntegerColumn( databaseId: '', tableId: '', key: '', @@ -599,7 +599,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.updateIntegerColumn( + final response = await tablesDB.updateIntegerColumn( databaseId: '', tableId: '', key: '', @@ -627,7 +627,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.createIpColumn( + final response = await tablesDB.createIpColumn( databaseId: '', tableId: '', key: '', @@ -654,7 +654,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.updateIpColumn( + final response = await tablesDB.updateIpColumn( databaseId: '', tableId: '', key: '', @@ -687,7 +687,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.createRelationshipColumn( + final response = await tablesDB.createRelationshipColumn( databaseId: '', tableId: '', relatedTableId: '', @@ -714,7 +714,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.createStringColumn( + final response = await tablesDB.createStringColumn( databaseId: '', tableId: '', key: '', @@ -742,7 +742,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.updateStringColumn( + final response = await tablesDB.updateStringColumn( databaseId: '', tableId: '', key: '', @@ -770,7 +770,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.createUrlColumn( + final response = await tablesDB.createUrlColumn( databaseId: '', tableId: '', key: '', @@ -797,7 +797,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.updateUrlColumn( + final response = await tablesDB.updateUrlColumn( databaseId: '', tableId: '', key: '', @@ -816,7 +816,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.getColumn( + final response = await tablesDB.getColumn( databaseId: '', tableId: '', key: '', @@ -831,7 +831,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.deleteColumn( + final response = await tablesDB.deleteColumn( databaseId: '', tableId: '', key: '', @@ -860,7 +860,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.updateRelationshipColumn( + final response = await tablesDB.updateRelationshipColumn( databaseId: '', tableId: '', key: '', @@ -880,7 +880,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.listIndexes( + final response = await tablesDB.listIndexes( databaseId: '', tableId: '', ); @@ -906,7 +906,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.createIndex( + final response = await tablesDB.createIndex( databaseId: '', tableId: '', key: '', @@ -935,7 +935,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.getIndex( + final response = await tablesDB.getIndex( databaseId: '', tableId: '', key: '', @@ -952,7 +952,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.deleteIndex( + final response = await tablesDB.deleteIndex( databaseId: '', tableId: '', key: '', @@ -970,7 +970,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.listRows( + final response = await tablesDB.listRows( databaseId: '', tableId: '', ); @@ -994,7 +994,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.createRow( + final response = await tablesDB.createRow( databaseId: '', tableId: '', rowId: '', @@ -1015,7 +1015,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.createRows( + final response = await tablesDB.createRows( databaseId: '', tableId: '', rows: [], @@ -1035,7 +1035,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.upsertRows( + final response = await tablesDB.upsertRows( databaseId: '', tableId: '', rows: [], @@ -1055,7 +1055,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.updateRows( + final response = await tablesDB.updateRows( databaseId: '', tableId: '', ); @@ -1074,7 +1074,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.deleteRows( + final response = await tablesDB.deleteRows( databaseId: '', tableId: '', ); @@ -1098,7 +1098,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.getRow( + final response = await tablesDB.getRow( databaseId: '', tableId: '', rowId: '', @@ -1123,7 +1123,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.upsertRow( + final response = await tablesDB.upsertRow( databaseId: '', tableId: '', rowId: '', @@ -1148,7 +1148,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.updateRow( + final response = await tablesDB.updateRow( databaseId: '', tableId: '', rowId: '', @@ -1165,7 +1165,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.deleteRow( + final response = await tablesDB.deleteRow( databaseId: '', tableId: '', rowId: '', @@ -1188,7 +1188,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.decrementRowColumn( + final response = await tablesDB.decrementRowColumn( databaseId: '', tableId: '', rowId: '', @@ -1214,7 +1214,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDb.incrementRowColumn( + final response = await tablesDB.incrementRowColumn( databaseId: '', tableId: '', rowId: '', diff --git a/test/services/users_test.dart b/test/services/users_test.dart index 52adda4e..e0207a53 100644 --- a/test/services/users_test.dart +++ b/test/services/users_test.dart @@ -572,6 +572,39 @@ void main() { }); + 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 = ''; @@ -586,6 +619,20 @@ void main() { ); }); + 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, @@ -606,6 +653,26 @@ void main() { }); + 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': [],}; @@ -623,6 +690,23 @@ void main() { }); + 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': [],}; @@ -640,6 +724,23 @@ void main() { }); + 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': [],}; @@ -657,6 +758,23 @@ void main() { }); + 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', From 81bbb784ae4bfcc7f437452e69db3a4355cca94a Mon Sep 17 00:00:00 2001 From: abnegate Date: Thu, 21 Aug 2025 10:20:21 +0000 Subject: [PATCH 14/22] Commit from GitHub Actions (Format and push) --- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1469 ++++++------ lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 ++++++++++------- lib/services/functions.dart | 869 ++++--- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 +++-- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 2260 +++++++++++-------- lib/services/sites.dart | 822 ++++--- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 +++++++++------ lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1582 +++++++------ lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 232 +- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 +-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 +-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 +-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +-- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 164 files changed, 13089 insertions(+), 11456 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/query.dart b/lib/query.dart index 281aa756..c9a2fc91 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if(attribute != null) { + if (attribute != null) { map['attribute'] = attribute; } - - if(values != null) { + + if (values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} \ 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 eabd0d7d..ecb2ee55 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,27 +1,26 @@ 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 +29,32 @@ 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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,661 +63,674 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = { - 'queries': queries, - - - }; + final Map apiParams = {'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.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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/account/identities/{identityId}'.replaceAll( + '{identityId}', + identityId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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() async { - final String apiPath = '/account/jwts'; - - final Map apiParams = { - - - }; + Future createJWT() async { + final String apiPath = '/account/jwts'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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.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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.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 apiParams = {'mfa': mfa}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 `CreateMFAAuthenticator` instead.') - Future createMfaAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - - final Map apiParams = { - - - }; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `CreateMFAAuthenticator` instead.', + ) + Future createMfaAuthenticator({ + required enums.AuthenticatorType type, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future createMFAAuthenticator({ + required enums.AuthenticatorType type, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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 `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, - - }; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `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 apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - 'otp': otp, + 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 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 `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 apiHeaders = { - 'content-type': 'application/json', + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `DeleteMFAAuthenticator` instead.', + ) + Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteMFAAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 `CreateMFAChallenge` instead.') - Future createMfaChallenge({required enums.AuthenticationFactor factor}) async { - final String apiPath = '/account/mfa/challenge'; - - 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); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `CreateMFAChallenge` instead.', + ) + Future createMfaChallenge({ + required enums.AuthenticationFactor factor, + }) async { + final String apiPath = '/account/mfa/challenge'; + + 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, + ); 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/challenge'; + Future createMFAChallenge({ + required enums.AuthenticationFactor factor, + }) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = { - - 'factor': factor.value, + final Map apiParams = {'factor': factor.value}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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 `UpdateMFAChallenge` instead.') - Future updateMfaChallenge({required String challengeId, required String otp}) async { - final String apiPath = '/account/mfa/challenge'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `UpdateMFAChallenge` instead.', + ) + Future updateMfaChallenge({ + required String challengeId, + required String otp, + }) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/challenge'; + Future updateMFAChallenge({ + required String challengeId, + required String otp, + }) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 `ListMFAFactors` instead.') - Future listMfaFactors() async { - final String apiPath = '/account/mfa/factors'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `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 `GetMFARecoveryCodes` instead.') - Future getMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `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 `CreateMFARecoveryCodes` instead.') - Future createMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `CreateMFARecoveryCodes` instead.', + ) + Future createMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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 apiHeaders = { - 'content-type': 'application/json', + 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 `UpdateMFARecoveryCodes` instead.') - Future updateMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `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 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 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'; - - final Map apiParams = { - - 'name': name, + Future updateName({required String name}) async { + final String apiPath = '/account/name'; - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'oldPassword': oldPassword, - + 'oldPassword': oldPassword, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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'; - - final Map apiParams = { - - 'prefs': prefs, - - }; + Future updatePrefs({required Map prefs}) async { + final String apiPath = '/account/prefs'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -724,99 +740,98 @@ 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'; - - final Map apiParams = { - - 'email': email, -'url': url, - - }; + Future createRecovery({ + required String email, + required String url, + }) async { + final String apiPath = '/account/recovery'; - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {'email': email, '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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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 @@ -825,213 +840,212 @@ 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'; - - final Map apiParams = { - - - }; + Future createAnonymousSession() async { + final String apiPath = '/account/sessions/anonymous'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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.') - Future updateMagicURLSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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.') - Future updatePhoneSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {'userId': userId, '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); - - final Map apiParams = { - - - }; + Future updateSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 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 /// provided user ID has not be registered, a new user will be created. Use the @@ -1039,31 +1053,34 @@ 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, -'phrase': phrase, - + 'email': email, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 @@ -1074,66 +1091,79 @@ 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, -'url': url, -'phrase': phrase, - + 'email': email, + 'url': url, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { 'success': success, -'failure': failure, -'scopes': scopes, + 'failure': failure, + 'scopes': scopes, - 'project': client.config['project'], }; 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)); + query.add( + Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item), + ); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -1141,15 +1171,16 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri(scheme: endpoint.scheme, + Uri url = Uri( + scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&') + 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 @@ -1157,30 +1188,29 @@ 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, - - }; + final Map apiParams = {'userId': userId, 'phone': phone}; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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** @@ -1191,56 +1221,52 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; - - final Map apiParams = { - - 'url': url, + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - }; + final Map apiParams = {'url': url}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 updateVerification({required String userId, required String secret}) async { - final String apiPath = '/account/verification'; + Future updateVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification'; - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; + final Map apiParams = {'userId': userId, 'secret': secret}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -1250,47 +1276,44 @@ 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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/verification/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, + Future updatePhoneVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification/phone'; - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {'userId': userId, '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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index a91d6d3f..8033f1cd 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,189 +1,255 @@ 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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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, -'width': width, -'height': height, + 'width': width, + '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 = { 'name': name, -'width': width, -'height': height, -'background': background, + 'width': width, + 'height': height, + '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, -'size': size, -'margin': margin, -'download': download, + 'size': size, + 'margin': margin, + '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/databases.dart b/lib/services/databases.dart index f962d8b3..223f1318 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1215 +1,1682 @@ 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}) 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, + }) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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.createDatabase` 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.createDatabase` instead.', + ) + Future create({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases'; final Map apiParams = { - 'databaseId': databaseId, -'name': name, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, bool? enabled}) async { - final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.', + ) + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'collectionId': collectionId, -'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) 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, + required String name, + List? permissions, + bool? documentSecurity, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + @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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + @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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return 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/{key}/relationship'.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/{key}/relationship' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'onDelete': onDelete?.value, -'newKey': newKey, - + 'newKey': newKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - } + } /// 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'documentId': documentId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + final Map apiParams = {'queries': queries}; + + final Map 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, required Map data, List? permissions}) 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, + required Map data, + List? permissions, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - 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; - - } + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'attributes': attributes, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 index by 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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); - - 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; - - } -} \ No newline at end of file + @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 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/functions.dart b/lib/services/functions.dart index 05a7d5f7..e86f1afe 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,256 +1,316 @@ 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}) async { - final String apiPath = '/functions'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? specification}) 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? specification, + }) async { + final String apiPath = '/functions'; final Map apiParams = { - 'functionId': functionId, -'name': name, -'runtime': runtime.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'name': name, + 'runtime': runtime.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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? specification}) 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? specification, + }) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'name': name, -'runtime': runtime?.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'runtime': runtime?.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String functionId}) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateFunctionDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployment'.replaceAll( + '{functionId}', + functionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); + Future listDeployments({ + required String functionId, + List? queries, + String? search, + }) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 = { - 'entrypoint': entrypoint, -'commands': commands, -'code': code, -'activate': activate, - + 'commands': commands, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -265,361 +325,446 @@ 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, -'buildId': buildId, - + 'buildId': buildId, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String functionId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/functions/{functionId}/deployments/template' + .replaceAll('{functionId}', functionId); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll('{functionId}', functionId); + Future createVcsDeployment({ + required String functionId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployments/{deploymentId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 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}) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - - final Map apiParams = { - 'queries': queries, + Future listExecutions({ + required String functionId, + List? queries, + }) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll( + '{functionId}', + functionId, + ); - - }; + final Map apiParams = {'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.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 = { - 'body': body, -'async': xasync, -'path': path, -'method': method?.value, -'headers': headers, -'scheduledAt': scheduledAt, - + 'async': xasync, + 'path': path, + 'method': method?.value, + 'headers': headers, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteExecution({ + required String functionId, + required String executionId, + }) async { + final String apiPath = '/functions/{functionId}/executions/{executionId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{executionId}', executionId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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, + }) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index e2418b52..18eb54f1 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,51 +1,49 @@ 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 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); - - return res.data; + 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 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); - - return res.data; + final res = await client.call( + HttpMethod.post, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/health.dart b/lib/services/health.dart index 0cf64ac6..5250c91d 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,438 +1,414 @@ 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.HealthStatus.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 = { - 'domain': domain, + final Map apiParams = {'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); - - } + } /// 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.HealthStatus.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.HealthStatus.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 = { - 'threshold': threshold, - - - }; + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueCertificates({int? threshold}) async { + final String apiPath = '/health/queue/certificates'; - - }; + final Map apiParams = {'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 = { 'name': name, -'threshold': threshold, - - + '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 = { - 'threshold': threshold, + final Map apiParams = {'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); - - final Map apiParams = { - 'threshold': threshold, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future getFailedJobs({ + required enums.Name name, + int? threshold, + }) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll( + '{name}', + name.value, + ); + + final Map apiParams = {'threshold': threshold}; + + final Map 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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueFunctions({int? threshold}) async { + final String apiPath = '/health/queue/functions'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueStatsResources({int? threshold}) async { + final String apiPath = '/health/queue/stats-resources'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 @@ -441,21 +417,20 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 430a00c3..4d3cc3e0 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,172 +1,164 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 93c843cc..fa8a7caf 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1393 +1,1805 @@ 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}) async { - final String apiPath = '/messaging/messages'; + Future listMessages({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'topics': topics, -'users': users, -'targets': targets, -'cc': cc, -'bcc': bcc, -'attachments': attachments, -'draft': draft, -'html': html, -'scheduledAt': scheduledAt, - + 'subject': subject, + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'cc': cc, + 'bcc': bcc, + 'attachments': attachments, + 'draft': draft, + 'html': html, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'title': title, -'body': body, -'topics': topics, -'users': users, -'targets': targets, -'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.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'title': title, + 'body': body, + 'topics': topics, + 'users': users, + 'targets': targets, + '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.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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); return models.Message.fromMap(res.data); - - } + } /// Create a new SMS message. - @Deprecated('This API has been deprecated since 1.8.0. Please use `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 `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, -'topics': topics, -'users': users, -'targets': targets, -'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'draft': draft, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'topics': topics, -'users': users, -'targets': targets, -'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'draft': draft, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 `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 `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 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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}) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listMessageLogs({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/providers'; + Future listProviders({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 `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 `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, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 `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 `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 = { - 'name': name, -'enabled': enabled, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 `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 `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 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 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 `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 `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 = { - 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'enabled': enabled, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'enabled': enabled, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, -'enabled': enabled, - + 'name': name, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, - + 'enabled': enabled, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'enabled': enabled, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 `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 `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, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 `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 `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 = { - 'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 = { - 'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, -'from': from, -'customerId': customerId, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'customerId': customerId, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'customerId': customerId, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'customerId': customerId, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'from': from, -'username': username, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'username': username, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'username': username, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'username': username, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'from': from, -'accountSid': accountSid, -'authToken': authToken, -'enabled': enabled, - + 'name': name, + 'from': from, + 'accountSid': accountSid, + 'authToken': authToken, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'accountSid': accountSid, -'authToken': authToken, -'from': from, - + 'enabled': enabled, + 'accountSid': accountSid, + 'authToken': authToken, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'from': from, -'apiKey': apiKey, -'apiSecret': apiSecret, -'enabled': enabled, - + 'name': name, + 'from': from, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'apiSecret': apiSecret, -'from': from, - + 'enabled': enabled, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteProvider({required String providerId}) async { + final String apiPath = '/messaging/providers/{providerId}'.replaceAll( + '{providerId}', + providerId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listProviderLogs({ + required String providerId, + List? queries, + }) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( + '{providerId}', + providerId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs({ + required String subscriberId, + List? queries, + }) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs' + .replaceAll('{subscriberId}', subscriberId); - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.LogList.fromMap(res.data); - - } + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({List? queries, String? search}) async { - final String apiPath = '/messaging/topics'; + Future listTopics({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'subscribe': subscribe, - + 'name': name, + 'subscribe': subscribe, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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}) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTopicLogs({ + required String topicId, + List? queries, + }) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( + '{topicId}', + topicId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); + Future listSubscribers({ + required String topicId, + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( + '{topicId}', + topicId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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 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); - - 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; - - } -} \ No newline at end of file + 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 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/sites.dart b/lib/services/sites.dart index 5481986e..d89f2192 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,247 +1,296 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.Adapter? adapter, + String? installationId, + String? fallbackFile, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites'; final Map apiParams = { - 'siteId': siteId, -'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime.value, -'adapter': adapter?.value, -'installationId': installationId, -'fallbackFile': fallbackFile, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime.value, + 'adapter': adapter?.value, + 'installationId': installationId, + 'fallbackFile': fallbackFile, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.BuildRuntime? buildRuntime, + enums.Adapter? adapter, + String? fallbackFile, + String? installationId, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime?.value, -'adapter': adapter?.value, -'fallbackFile': fallbackFile, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime?.value, + 'adapter': adapter?.value, + 'fallbackFile': fallbackFile, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + Future delete({required String siteId}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateSiteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployment'.replaceAll( + '{siteId}', + siteId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future listDeployments({ + required String siteId, + List? queries, + String? search, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future createDeployment({ + required String siteId, + required InputFile code, + required bool activate, + String? installCommand, + String? buildCommand, + String? outputDirectory, + Function(UploadProgress)? onProgress, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'code': code, -'activate': activate, - + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -256,331 +305,400 @@ 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, + 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 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String siteId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll('{siteId}', siteId); + Future createVcsDeployment({ + required String siteId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - 'queries': queries, + Future listLogs({ + required String siteId, + List? queries, + }) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll( + '{siteId}', + siteId, + ); - - }; + final Map apiParams = {'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.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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ccdce915..ee630883 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,184 +1,226 @@ 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}) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({ + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { - 'bucketId': bucketId, -'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'name': name, + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) 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, + }) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { - 'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteBucket({required String bucketId}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); + Future listFiles({ + required String bucketId, + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'permissions': permissions, - + 'file': file, + 'permissions': permissions, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -194,137 +236,187 @@ 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 = { - 'name': name, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 = { 'width': width, -'height': height, -'gravity': gravity?.value, -'quality': quality, -'borderWidth': borderWidth, -'borderColor': borderColor, -'borderRadius': borderRadius, -'opacity': opacity, -'rotation': rotation, -'background': background, -'output': output?.value, -'token': token, - - + 'height': height, + 'gravity': gravity?.value, + 'quality': quality, + 'borderWidth': borderWidth, + 'borderColor': borderColor, + 'borderRadius': borderRadius, + 'opacity': opacity, + 'rotation': rotation, + 'background': background, + 'output': output?.value, + '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 = { '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 6a007ccd..f9d86004 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1162 +1,1520 @@ 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}) async { - final String apiPath = '/tablesdb'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, required String name, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + Future listTables({ + required String databaseId, + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'tableId': tableId, -'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future updateTable({ + required String databaseId, + required String tableId, + required String name, + List? permissions, + bool? rowSecurity, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteTable({ + required String databaseId, + required String tableId, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listColumns({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - /// - 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); + /// + 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - /// - 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); + /// + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + 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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + 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 apiHeaders = {'content-type': 'application/json'}; + + 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listIndexes({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'columns': columns, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + 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 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); - - 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; - - } + 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 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRow({required String databaseId, required String tableId, required String rowId, required Map data, List? permissions}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'rowId': rowId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + Future createRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - /// - Future upsertRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future upsertRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future updateRows({ + required String databaseId, + required String tableId, + Map? data, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + Future deleteRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future getRow({ + required String databaseId, + required String tableId, + required String rowId, + List? queries, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future upsertRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - 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; - - } + Future deleteRow({ + required String databaseId, + required String tableId, + required String rowId, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future decrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? min, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future incrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? max, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.patch, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); return models.Row.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/teams.dart b/lib/services/teams.dart index c21a93af..5fd59641 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,140 +1,147 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'roles': roles, - + 'name': name, + 'roles': roles, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - 'name': name, + 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 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); + Future listMemberships({ + required String teamId, + List? queries, + String? search, + }) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll( + '{teamId}', + teamId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 @@ -142,182 +149,210 @@ 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 = { - 'email': email, -'userId': userId, -'phone': phone, -'roles': roles, -'url': url, -'name': name, - + 'userId': userId, + 'phone': phone, + 'roles': roles, + 'url': url, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - 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); + /// + 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, + ); 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index cb04449b..4e6915dc 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,109 +1,113 @@ 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}) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future list({ + required String bucketId, + required String fileId, + List? queries, + }) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); + + final Map apiParams = {'queries': queries}; + + final Map 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); - - 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); + 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, + ); 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); - - final Map apiParams = { - - 'expire': expire, + 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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String tokenId}) async { + final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/users.dart b/lib/services/users.dart index 586f6770..cc2c2462 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,314 +1,359 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'password': password, -'name': name, - + 'email': email, + 'phone': phone, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/users/identities'; + Future listIdentities({ + List? queries, + String? search, + }) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordCpu': passwordCpu, + 'passwordMemory': passwordMemory, + 'passwordParallel': passwordParallel, + 'passwordLength': passwordLength, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordSaltSeparator': passwordSaltSeparator, + 'passwordSignerKey': passwordSignerKey, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'passwordVersion': passwordVersion?.value, -'name': name, - + 'email': email, + 'password': password, + 'passwordVersion': passwordVersion?.value, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -316,782 +361,909 @@ 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); 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 = { - 'sessionId': sessionId, -'duration': duration, - + 'duration': duration, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// Get the user activity logs list by its unique ID. - Future listLogs({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listLogs({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/logs'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); + Future listMemberships({ + required String userId, + List? queries, + String? search, + }) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll( + '{userId}', + userId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 `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); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `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, + ); 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 apiParams = {'mfa': mfa}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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 `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 apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `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 apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 `ListMFAFactors` instead.') - Future listMfaFactors({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/factors'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `ListMFAFactors` instead.', + ) + Future listMfaFactors({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/factors'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {}; + + final Map 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 `GetMFARecoveryCodes` instead.') - Future getMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `GetMFARecoveryCodes` instead.', + ) + Future getMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {}; + + final Map 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 `UpdateMFARecoveryCodes` instead.') - Future updateMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `UpdateMFARecoveryCodes` instead.', + ) + Future updateMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + Future updateMFARecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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 `CreateMFARecoveryCodes` instead.') - Future createMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `CreateMFARecoveryCodes` instead.', + ) + Future createMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); + + 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.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 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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 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 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; - - } + 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); - - final Map apiParams = { - - - }; + Future deleteSession({ + required String userId, + required String sessionId, + }) async { + final String apiPath = '/users/{userId}/sessions/{sessionId}' + .replaceAll('{userId}', userId) + .replaceAll('{sessionId}', sessionId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// List the messaging targets that are associated with a user. - Future listTargets({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/targets'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, -'providerId': providerId, -'name': name, - + 'providerType': providerType.value, + 'identifier': identifier, + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'identifier': identifier, -'providerId': providerId, -'name': name, - + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteTarget({ + required String userId, + required String targetId, + }) async { + final String apiPath = '/users/{userId}/targets/{targetId}' + .replaceAll('{userId}', userId) + .replaceAll('{targetId}', targetId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'length': length, -'expire': expire, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future createToken({ + required String userId, + int? length, + int? expire, + }) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'length': length, 'expire': expire}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/src/client.dart b/lib/src/client.dart index 0d9be210..d82d623a 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,7 +81,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 cd82d264..08d93b85 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,21 +2,25 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index ea2cd62a..c961873f 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,14 +9,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => +ClientBase createClient({required String endPoint, required bool selfSigned}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -34,59 +31,66 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format' : '1.8.0', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -135,7 +139,11 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -162,12 +170,19 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index f9e695bf..2bd7d639 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,17 +10,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => - ClientIO( - endPoint: endPoint, - selfSigned: selfSigned, - ); +ClientBase createClient({required String endPoint, required bool selfSigned}) => + ClientIO(endPoint: endPoint, selfSigned: selfSigned); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -43,60 +37,68 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format' : '1.8.0', + 'user-agent': + 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -151,11 +153,16 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, file.path!, - filename: file.filename); + paramName, + file.path!, + filename: file.filename, + ); } else { - 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, @@ -194,12 +201,19 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -244,10 +258,7 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse( - res, - responseType: responseType, - ); + return prepareResponse(res, responseType: responseType); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 658b79b6..06c9ebe3 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest) - .fields - .addAll({"$key[$i]": v.toString()}); + (request as http.MultipartRequest).fields.addAll({ + "$key[$i]": v.toString(), + }); }); } else { - (request as http.MultipartRequest) - .fields - .addAll({key: value.toString()}); + (request as http.MultipartRequest).fields.addAll({ + key: value.toString(), + }); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value){ + params = params.map((key, value) { if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,12 +51,13 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port, + ); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -66,7 +67,9 @@ 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); @@ -113,18 +116,25 @@ 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.dart b/lib/src/enums.dart index 595afdc2..0f250ea3 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes + bytes, } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 2f198d4e..3341912f 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 cd45b6a1..1bae5c8a 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 7d2d7016..42954430 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,18 +1,16 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 af5ebaad..e20f48c6 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,26 +1,24 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index 8d86530d..b101d35f 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({ - required this.value - }); + const IndexType({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/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/name.dart b/lib/src/enums/name.dart index 613bf5f1..74823feb 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,24 +1,22 @@ 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'), - 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'), + 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 076c1c50..383e45b1 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,52 +1,50 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d34440ec..d4fef930 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index 0bf8e2ad..f01fcb01 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({ - required this.value - }); + const VCSDeploymentType({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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index f174d569..4145f701 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 c9f67200..4e901476 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 2fabb416..35c7b767 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index fdcee07a..7d27adba 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index 120723df..fec6f65a 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 504b5f8f..0e80700f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 5f3e1654..bae6618f 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 20dd7189..0ca54691 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a5b27b4f..1df01f19 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 96ce554b..21f8e9a3 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a4953a0e..298c181a 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 03ba94c7..c6eecadd 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8a5aa89d..1ef48332 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 d17f414a..8c8fcb73 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index 4098a5a1..c5fa6adc 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "attributes": attributes, - }; - } + Map toMap() { + return {"total": total, "attributes": attributes}; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 050cbe14..903c6290 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 2202d255..7374fa78 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index 0c3ddf9e..f0bc295e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index 3bb374be..b8fb5e48 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index b02adbf6..66e58c20 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "buckets": buckets.map((p) => p.toMap()).toList(), - }; - } + 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 c55110cf..72de429d 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 240e2ce0..5322aaab 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 0ffc8fea..60fcfa48 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 367686d0..c21a2260 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7deb5e26..15d80695 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7bb56922..558b7d43 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c0547e11..3b2f1335 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 acf0f6df..9d637d92 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 576937e7..a7983a62 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,28 +2,24 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 3823f425..2ba463cd 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 4ac1fa12..6672d7ce 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 475c1c40..8eb0171f 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "columns": columns, - }; - } + Map toMap() { + return {"total": total, "columns": columns}; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index e55d1534..6221c01e 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6fd6a3b0..7b560989 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 94271aa6..66c0ce7b 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 1a9c5038..7318b7ad 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 5e954a05..ec2c0755 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 565b1d66..c52b50f2 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,28 +2,19 @@ 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()); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 073fa251..65e13be3 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 deafffe3..27eef0c1 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 1c99fdf9..7a957f1a 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 cab95b02..8d79e052 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 5eb5c0ce..5afa7932 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 ecf7e791..448c62c7 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 78ba8ab2..df81710a 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index be424a9c..cf85e457 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 d45ea081..4065e17b 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,31 +2,30 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 0cfdbb4e..8618bcd6 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,118 +2,122 @@ 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 upate date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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.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(), - trigger: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "trigger": trigger, - "status": status, - "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 upate date in ISO 8601 format. + final String $updatedAt; + + /// Execution roles. + final List $permissions; + + /// Function ID. + final String functionId; + + /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + final String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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.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(), + trigger: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "trigger": trigger, + "status": status, + "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 d44139ee..4ed73943 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 de8439ec..a6a9fa46 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 94ea9a14..63f49abc 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "files": files.map((p) => p.toMap()).toList(), - }; - } + 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 ea6b601a..693c9b07 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,46 +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))), - ); - } - - 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)), + ), + ); + } + + 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 7614616a..0b908240 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 afe8f6b3..eb8145d4 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 64401c3f..56c2eded 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index d5974f55..34d7225c 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,28 +2,25 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 ecf0a178..463cf696 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "value": value, - }; - } + Map toMap() { + return {"name": name, "value": value}; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index 54c31e70..fa402e97 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "version": version, - "status": status, - }; - } + Map toMap() { + return {"version": version, "status": status}; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index 0a5b6ce9..d412eba9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 95da1235..5f06906b 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,22 +2,16 @@ 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']); + } - Map toMap() { - return { - "size": size, - }; - } + Map toMap() { + return {"size": size}; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 0d6e7216..59b7092c 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,34 +2,26 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "name": name, - "ping": ping, - "status": status, - }; - } + Map toMap() { + return {"name": name, "ping": ping, "status": status}; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index 102dfe77..dec2d54f 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,34 +2,30 @@ 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'], + ); + } - Map toMap() { - return { - "remoteTime": remoteTime, - "localTime": localTime, - "diff": diff, - }; - } + Map toMap() { + return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index c43c4d57..807bdfd0 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 b8358fc1..b4c63f7d 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 b6717c4e..9d6d7aec 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 fef735fc..6d285a6a 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 1b4ff7de..490a1824 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "jwt": jwt, - }; - } + Map toMap() { + return {"jwt": jwt}; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 43eaad08..9c45adb1 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,34 +2,26 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - "nativeName": nativeName, - }; - } + 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 ea731471..2e65839e 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 b5e9ad1a..084475bf 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 10499ef5..cd5a1155 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "name": name, - }; - } + 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 c1243e06..be6ddb1f 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 cb567bd7..7fb3f364 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 9d4d7701..22273a8c 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "logs": logs.map((p) => p.toMap()).toList(), - }; - } + 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 26610e46..8ee142ad 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index f08f5738..a4d39dca 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 c4e9e858..9b93b00d 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index acaacc34..15ddf642 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 46c166fb..96bf3c65 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 d49989d8..c930a23e 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 6c8b4e36..63411988 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,22 +2,18 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "recoveryCodes": recoveryCodes, - }; - } + Map toMap() { + return {"recoveryCodes": recoveryCodes}; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index 01cf0857..fa57cb8b 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "secret": secret, - "uri": uri, - }; - } + Map toMap() { + return {"secret": secret, "uri": uri}; + } } 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/phone.dart b/lib/src/models/phone.dart index c8bbb95b..40f7bcd2 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 2d869308..879edbc4 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "phones": phones.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index edb6083e..7bc3abc9 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,23 +2,17 @@ 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, - ); - } + factory Preferences.fromMap(Map map) { + return Preferences(data: map); + } - Map toMap() { - return { - "data": data, - }; - } + 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/provider.dart b/lib/src/models/provider.dart index 4295c486..1a762f85 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 9710aea9..9347fefb 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index ed520cc4..dad35dcc 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 fcdabb97..2283653f 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,28 +2,24 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "tokens": tokens.map((p) => p.toMap()).toList(), - }; - } + 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 62e69e5b..3700e577 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 a8374e2b..01f046c6 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,31 +2,25 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "rows": rows.map((p) => p.toMap()).toList(), - }; - } + 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 35f82cfa..7c9677d8 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 c234990c..64bc2e08 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 3a1d955f..d2fe4f64 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 0257cb86..e9c478af 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 5cda6acc..1449f8bd 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index cc9e4355..e74b0d81 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "sites": sites.map((p) => p.toMap()).toList(), - }; - } + 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 e49d399c..e8fb8c75 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,40 +2,35 @@ 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(), + ); + } - Map toMap() { - return { - "memory": memory, - "cpus": cpus, - "enabled": enabled, - "slug": slug, - }; - } + 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 0d2b6a73..de4957d2 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 36e18a7e..0c926297 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 6c8c21e2..6a135b92 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 1c5b88fb..7ce86b9d 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,76 +2,78 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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)), + ), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 2b4b4b41..ebe15c71 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "tables": tables.map((p) => p.toMap()).toList(), - }; - } + 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 f2b3b6b4..4be8b545 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 6ef2725d..84233d1d 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "targets": targets.map((p) => p.toMap()).toList(), - }; - } + 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 e9058b5b..43df33a8 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 a61cc9f7..a3994c06 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "teams": teams.map((p) => p.toMap()).toList(), - }; - } + 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 4f6b8454..35115467 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 461d5694..430d44ac 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 1582a3c7..eefc62b6 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "topics": topics.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index effc397c..50bfb3ce 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index edf7a95d..2419d818 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "users": users.map((p) => p.toMap()).toList(), - }; - } + 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 58882a9f..2a8e276a 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 ee1f6f7a..ffa58eef 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } From 47451fafc9349b0754764cb034ad4874062c93ea Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Sat, 23 Aug 2025 20:13:03 +1200 Subject: [PATCH 15/22] Add 1.8.x support --- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1477 ++++++------ lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 +++++++---------- lib/services/functions.dart | 869 +++---- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 ++--- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 2260 ++++++++----------- lib/services/sites.dart | 822 +++---- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 ++++++--------- lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1582 ++++++------- lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 238 +- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 +-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 +-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 +-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +-- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- test/services/functions_test.dart | 2 + test/services/sites_test.dart | 1 + test/src/models/execution_test.dart | 2 + 167 files changed, 11473 insertions(+), 13091 deletions(-) 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/query.dart b/lib/query.dart index c9a2fc91..281aa756 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if (attribute != null) { + if(attribute != null) { map['attribute'] = attribute; } - - if (values != null) { + + if(values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} +} \ 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 ecb2ee55..fd7537d4 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,26 +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 @@ -29,32 +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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -63,674 +60,661 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 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; - } + 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() async { - final String apiPath = '/account/jwts'; + Future createJWT() async { + final String apiPath = '/account/jwts'; + + final Map apiParams = { + + + }; - final Map apiParams = {}; + final Map apiHeaders = { + 'content-type': 'application/json', - 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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 apiParams = { + + 'mfa': mfa, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 `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 `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 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 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 `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 `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 apiParams = { + + 'otp': otp, + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiParams = { + + 'otp': otp, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 `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 `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 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; - 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 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; - } + 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 `CreateMFAChallenge` instead.', - ) - Future createMfaChallenge({ - required enums.AuthenticationFactor factor, - }) async { - final String apiPath = '/account/mfa/challenge'; - - 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, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `CreateMFAChallenge` instead.') + Future createMfaChallenge({required enums.AuthenticationFactor factor}) async { + final String apiPath = '/account/mfa/challenge'; + + 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); 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/challenge'; + Future createMFAChallenge({required enums.AuthenticationFactor factor}) async { + final String apiPath = '/account/mfa/challenge'; + + final Map apiParams = { + + 'factor': factor.value, - final Map apiParams = {'factor': factor.value}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 `UpdateMFAChallenge` instead.', - ) - Future updateMfaChallenge({ - required String challengeId, - required String otp, - }) async { - final String apiPath = '/account/mfa/challenge'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `UpdateMFAChallenge` instead.') + Future updateMfaChallenge({required String challengeId, required String otp}) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { + 'challengeId': challengeId, - 'otp': otp, +'otp': otp, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/challenge'; + Future updateMFAChallenge({required String challengeId, required String otp}) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { + 'challengeId': challengeId, - 'otp': otp, +'otp': otp, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 `ListMFAFactors` instead.', - ) - Future listMfaFactors() async { - final String apiPath = '/account/mfa/factors'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `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 `GetMFARecoveryCodes` instead.', - ) - Future getMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `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 `CreateMFARecoveryCodes` instead.', - ) - Future createMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `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 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 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 `UpdateMFARecoveryCodes` instead.', - ) - Future updateMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `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 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 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 apiParams = { + + 'name': name, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'oldPassword': oldPassword, +'oldPassword': oldPassword, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 apiParams = {'prefs': prefs}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -740,98 +724,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}; + final Map apiParams = { + + 'email': email, +'url': url, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 @@ -840,247 +825,249 @@ 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 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 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.') - Future updateMagicURLSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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.') - Future updatePhoneSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, + + }; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiHeaders = { + 'content-type': 'application/json', - 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 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 apiHeaders = { + 'content-type': 'application/json', - 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; - 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 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 - /// provided user ID has not be registered, a new user will be created. Use the - /// returned user ID and secret and submit a request to the [POST + /// email address has never been used, a **new account is created** using the + /// provided `userId`. Otherwise, if the email address is already attached to + /// an account, the **user ID is ignored**. Then, the user will receive an + /// email with the one-time password. Use the returned user ID and secret and + /// submit a request to the [POST /// /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, - 'phrase': phrase, +'email': email, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -1091,79 +1078,66 @@ 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, - 'url': url, - 'phrase': phrase, +'email': email, +'url': url, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { 'success': success, - 'failure': failure, - 'scopes': scopes, +'failure': failure, +'scopes': scopes, + 'project': client.config['project'], }; 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), - ); + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -1171,16 +1145,15 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri( - scheme: endpoint.scheme, + Uri url = Uri(scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&'), + 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 @@ -1188,29 +1161,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}; + final Map apiParams = { + + 'userId': userId, +'phone': phone, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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** @@ -1221,52 +1195,56 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'url': url}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 updateVerification({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/verification'; + Future updateVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 @@ -1276,44 +1254,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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/verification/phone'; + Future updatePhoneVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification/phone'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiParams = {'userId': userId, 'secret': secret}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index 8033f1cd..a91d6d3f 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,255 +1,189 @@ 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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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, - 'width': width, - 'height': height, +'width': width, +'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 = { 'name': name, - 'width': width, - 'height': height, - 'background': background, +'width': width, +'height': height, +'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, - 'size': size, - 'margin': margin, - 'download': download, +'size': size, +'margin': margin, +'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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 223f1318..f962d8b3 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1682 +1,1215 @@ 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, - }) 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}) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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.createDatabase` 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.createDatabase` instead.') + Future create({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases'; final Map apiParams = { + 'databaseId': databaseId, - 'name': name, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/databases/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.') + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'collectionId': collectionId, - 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - List? permissions, - bool? documentSecurity, - bool? enabled, - }) 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + @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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + @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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return 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/{key}/relationship' - .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/{key}/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'onDelete': onDelete?.value, - 'newKey': newKey, +'newKey': newKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'documentId': documentId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - required Map data, - List? permissions, - }) 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, required Map data, List? permissions}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - 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; - } + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'attributes': attributes, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 index by 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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); - - 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; - } -} + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/functions.dart b/lib/services/functions.dart index e86f1afe..05a7d5f7 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,316 +1,256 @@ 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, - }) async { - final String apiPath = '/functions'; + Future list({List? queries, String? search}) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? specification, - }) 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? specification}) async { + final String apiPath = '/functions'; final Map apiParams = { + 'functionId': functionId, - 'name': name, - 'runtime': runtime.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'name': name, +'runtime': runtime.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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? specification, - }) 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? specification}) async { + final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'name': name, - 'runtime': runtime?.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'runtime': runtime?.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll( - '{functionId}', - functionId, - ); + Future listDeployments({required String functionId, List? queries, String? search}) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 = { + 'entrypoint': entrypoint, - 'commands': commands, - 'code': code, - 'activate': activate, +'commands': commands, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -325,446 +265,361 @@ 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, - 'buildId': buildId, +'buildId': buildId, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String functionId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/functions/{functionId}/deployments/template'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll( - '{functionId}', - functionId, - ); + Future createVcsDeployment({required String functionId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll( - '{functionId}', - functionId, - ); + Future listExecutions({required String functionId, List? queries}) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 = { + 'body': body, - 'async': xasync, - 'path': path, - 'method': method?.value, - 'headers': headers, - 'scheduledAt': scheduledAt, +'async': xasync, +'path': path, +'method': method?.value, +'headers': headers, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index 18eb54f1..e2418b52 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,49 +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 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; - 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 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/health.dart b/lib/services/health.dart index 5250c91d..0cf64ac6 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,414 +1,438 @@ 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.HealthStatus.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 = {'domain': domain}; + final Map apiParams = { + 'domain': domain, - 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.HealthCertificate.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.HealthStatus.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.HealthStatus.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = { + 'threshold': threshold, - final Map apiParams = {'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 = { 'name': name, - 'threshold': threshold, +'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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, - ); - - final Map apiParams = {'threshold': threshold}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future getFailedJobs({required enums.Name name, int? threshold}) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll('{name}', name.value); + + final Map apiParams = { + 'threshold': threshold, + + + }; + + final Map 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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 @@ -417,20 +441,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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 4d3cc3e0..430a00c3 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,164 +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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index fa8a7caf..93c843cc 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1805 +1,1393 @@ 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, - }) async { - final String apiPath = '/messaging/messages'; + Future listMessages({List? queries, String? search}) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'cc': cc, - 'bcc': bcc, - 'attachments': attachments, - 'draft': draft, - 'html': html, - 'scheduledAt': scheduledAt, +'subject': subject, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'cc': cc, +'bcc': bcc, +'attachments': attachments, +'draft': draft, +'html': html, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'title': title, - 'body': body, - 'topics': topics, - 'users': users, - 'targets': targets, - '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.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'title': title, +'body': body, +'topics': topics, +'users': users, +'targets': targets, +'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.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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); return models.Message.fromMap(res.data); - } + + } /// Create a new SMS message. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `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 `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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'draft': draft, - 'scheduledAt': scheduledAt, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'draft': draft, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'draft': draft, - 'scheduledAt': scheduledAt, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'draft': draft, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 `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 `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 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 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 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; - return res.data; - } + } /// Get the message activity logs listed by its unique ID. - Future listMessageLogs({ - required String messageId, - List? queries, - }) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listMessageLogs({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/providers'; + Future listProviders({List? queries, String? search}) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 `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 `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, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, - 'enabled': enabled, +'name': name, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, - 'enabled': enabled, +'name': name, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 `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 `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 = { + 'name': name, - 'enabled': enabled, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, +'enabled': enabled, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, +'enabled': enabled, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 `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 `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 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 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 `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 `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 = { + 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'enabled': enabled, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'enabled': enabled, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, - 'enabled': enabled, +'name': name, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, +'enabled': enabled, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'enabled': enabled, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 `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 `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, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 `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 `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 = { + 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 = { + 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'from': from, - 'customerId': customerId, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'customerId': customerId, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'customerId': customerId, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'customerId': customerId, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'username': username, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'username': username, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'username': username, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'username': username, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'accountSid': accountSid, - 'authToken': authToken, - 'enabled': enabled, +'name': name, +'from': from, +'accountSid': accountSid, +'authToken': authToken, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'accountSid': accountSid, - 'authToken': authToken, - 'from': from, +'enabled': enabled, +'accountSid': accountSid, +'authToken': authToken, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'enabled': enabled, +'name': name, +'from': from, +'apiKey': apiKey, +'apiSecret': apiSecret, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'from': from, +'enabled': enabled, +'apiKey': apiKey, +'apiSecret': apiSecret, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } + } /// Get the provider activity logs listed by its unique ID. - Future listProviderLogs({ - required String providerId, - List? queries, - }) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( - '{providerId}', - providerId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listProviderLogs({required String providerId, List? queries}) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs' - .replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs({required String subscriberId, List? queries}) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + '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.LogList.fromMap(res.data); - } + + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({ - List? queries, - String? search, - }) async { - final String apiPath = '/messaging/topics'; + Future listTopics({List? queries, String? search}) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'subscribe': subscribe, +'name': name, +'subscribe': subscribe, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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; - return res.data; - } + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs({ - required String topicId, - List? queries, - }) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( - '{topicId}', - topicId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTopicLogs({required String topicId, List? queries}) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( - '{topicId}', - topicId, - ); + Future listSubscribers({required String topicId, List? queries, String? search}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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 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); - - 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; - } -} + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/sites.dart b/lib/services/sites.dart index d89f2192..5481986e 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,296 +1,247 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? outputDirectory, - enums.Adapter? adapter, - String? installationId, - String? fallbackFile, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites'; final Map apiParams = { + 'siteId': siteId, - 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime.value, - 'adapter': adapter?.value, - 'installationId': installationId, - 'fallbackFile': fallbackFile, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime.value, +'adapter': adapter?.value, +'installationId': installationId, +'fallbackFile': fallbackFile, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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? outputDirectory, - enums.BuildRuntime? buildRuntime, - enums.Adapter? adapter, - String? fallbackFile, - String? installationId, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime?.value, - 'adapter': adapter?.value, - 'fallbackFile': fallbackFile, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime?.value, +'adapter': adapter?.value, +'fallbackFile': fallbackFile, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future listDeployments({required String siteId, List? queries, String? search}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({ - required String siteId, - required InputFile code, - required bool activate, - String? installCommand, - String? buildCommand, - String? outputDirectory, - Function(UploadProgress)? onProgress, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'code': code, - 'activate': activate, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -305,400 +256,331 @@ 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String siteId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll( - '{siteId}', - siteId, - ); + Future createVcsDeployment({required String siteId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll( - '{siteId}', - siteId, - ); + Future listLogs({required String siteId, List? queries}) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ee630883..ccdce915 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,226 +1,184 @@ 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, - }) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({List? queries, String? search}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { + 'bucketId': bucketId, - 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'name': name, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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, - }) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( - '{bucketId}', - bucketId, - ); + Future listFiles({required String bucketId, List? queries, String? search}) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'permissions': permissions, +'file': file, +'permissions': permissions, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -236,187 +194,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 = { + 'name': name, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 = { 'width': width, - 'height': height, - 'gravity': gravity?.value, - 'quality': quality, - 'borderWidth': borderWidth, - 'borderColor': borderColor, - 'borderRadius': borderRadius, - 'opacity': opacity, - 'rotation': rotation, - 'background': background, - 'output': output?.value, - 'token': token, - +'height': height, +'gravity': gravity?.value, +'quality': quality, +'borderWidth': borderWidth, +'borderColor': borderColor, +'borderRadius': borderRadius, +'opacity': opacity, +'rotation': rotation, +'background': background, +'output': output?.value, +'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 = { '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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index f9d86004..6a007ccd 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1520 +1,1162 @@ 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, - }) async { - final String apiPath = '/tablesdb'; + Future list({List? queries, String? search}) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( - '{databaseId}', - databaseId, - ); + Future listTables({required String databaseId, List? queries, String? search}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createTable({ - required String databaseId, - required String tableId, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'tableId': tableId, - 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future updateTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - return res.data; - } + } /// List columns in the table. - Future listColumns({ - required String databaseId, - required String tableId, - List? queries, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listColumns({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + 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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listIndexes({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'columns': columns, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + 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 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); - - 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; - } + 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 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRow({ - required String databaseId, - required String tableId, - required String rowId, - required Map data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'rowId': rowId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future createRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - /// - Future upsertRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future upsertRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future updateRows({required String databaseId, required String tableId, Map? data, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future deleteRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future getRow({required String databaseId, required String tableId, required String rowId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future upsertRow({ - required String databaseId, - required String tableId, - required String rowId, - Map? data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - 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; - } + Future deleteRow({required String databaseId, required String tableId, required String rowId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future decrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? min}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future incrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? max}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/teams.dart b/lib/services/teams.dart index 5fd59641..c21a93af 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,147 +1,140 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'roles': roles, +'name': name, +'roles': roles, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiParams = {'name': name}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - 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, - }) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll( - '{teamId}', - teamId, - ); + Future listMemberships({required String teamId, List? queries, String? search}) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 @@ -149,210 +142,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 = { + 'email': email, - 'userId': userId, - 'phone': phone, - 'roles': roles, - 'url': url, - 'name': name, +'userId': userId, +'phone': phone, +'roles': roles, +'url': url, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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, - ); + /// + 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); 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 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; - 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); - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index 4e6915dc..cb04449b 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,113 +1,109 @@ 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, - }) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future list({required String bucketId, required String fileId, List? queries}) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); - - 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, - ); + 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); 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 apiParams = {'expire': expire}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/users.dart b/lib/services/users.dart index cc2c2462..586f6770 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,359 +1,314 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'password': password, - 'name': name, +'email': email, +'phone': phone, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = '/users/identities'; + Future listIdentities({List? queries, String? search}) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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; - 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordCpu': passwordCpu, +'passwordMemory': passwordMemory, +'passwordParallel': passwordParallel, +'passwordLength': passwordLength, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordSaltSeparator': passwordSaltSeparator, +'passwordSignerKey': passwordSignerKey, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'passwordVersion': passwordVersion?.value, - 'name': name, +'email': email, +'password': password, +'passwordVersion': passwordVersion?.value, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -361,909 +316,782 @@ 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 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; - 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, - ); - - 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, - ); + 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); 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 = { + 'sessionId': sessionId, - 'duration': duration, +'duration': duration, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// Get the user activity logs list by its unique ID. - Future listLogs({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/logs'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listLogs({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll( - '{userId}', - userId, - ); + Future listMemberships({required String userId, List? queries, String? search}) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 `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, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `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); 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 apiParams = { + + 'mfa': mfa, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 `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 apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + @Deprecated('This API has been deprecated since 1.8.0. Please use `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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - 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 `ListMFAFactors` instead.', - ) - Future listMfaFactors({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/factors'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `ListMFAFactors` instead.') + Future listMfaFactors({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/factors'.replaceAll('{userId}', userId); + + final Map apiParams = { + + + }; + + final Map 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 `GetMFARecoveryCodes` instead.', - ) - Future getMfaRecoveryCodes({ - required String userId, - }) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `GetMFARecoveryCodes` instead.') + Future getMfaRecoveryCodes({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + + final Map apiParams = { + + + }; + + final Map 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 `UpdateMFARecoveryCodes` instead.', - ) - Future updateMfaRecoveryCodes({ - required String userId, - }) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `UpdateMFARecoveryCodes` instead.') + Future updateMfaRecoveryCodes({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 `CreateMFARecoveryCodes` instead.', - ) - Future createMfaRecoveryCodes({ - required String userId, - }) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `CreateMFARecoveryCodes` instead.') + Future createMfaRecoveryCodes({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + + 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.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 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } + + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll( - '{userId}', - userId, - ); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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 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 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; - } + 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 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; - 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// List the messaging targets that are associated with a user. - Future listTargets({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/targets'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - 'providerId': providerId, - 'name': name, +'providerType': providerType.value, +'identifier': identifier, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'identifier': identifier, - 'providerId': providerId, - 'name': name, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - 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, - ); - - final Map apiParams = {'length': length, 'expire': expire}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future createToken({required String userId, int? length, int? expire}) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll('{userId}', userId); + + final Map apiParams = { + + 'length': length, +'expire': expire, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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); - } -} + + } +} \ No newline at end of file diff --git a/lib/src/client.dart b/lib/src/client.dart index d82d623a..0d9be210 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,8 +81,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 08d93b85..cd82d264 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,25 +2,21 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index c961873f..ea2cd62a 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,11 +9,14 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -31,66 +34,59 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format': '1.8.0', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -139,11 +135,7 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -170,19 +162,12 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 2bd7d639..f9e695bf 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,11 +10,17 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => - ClientIO(endPoint: endPoint, selfSigned: selfSigned); +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => + ClientIO( + endPoint: endPoint, + selfSigned: selfSigned, + ); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -37,68 +43,60 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent': - 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format': '1.8.0', + 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -153,16 +151,11 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, - file.path!, - filename: file.filename, - ); + paramName, file.path!, + filename: file.filename); } else { - 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, @@ -201,19 +194,12 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -258,7 +244,10 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse(res, responseType: responseType); + return prepareResponse( + res, + responseType: responseType, + ); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 06c9ebe3..658b79b6 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest).fields.addAll({ - "$key[$i]": v.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({"$key[$i]": v.toString()}); }); } else { - (request as http.MultipartRequest).fields.addAll({ - key: value.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({key: value.toString()}); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value) { + params = params.map((key, value){ if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,13 +51,12 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port, - ); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -67,9 +66,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); @@ -116,25 +113,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.dart b/lib/src/enums.dart index 0f250ea3..595afdc2 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes, + bytes } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 3341912f..2f198d4e 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 1bae5c8a..cd45b6a1 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 42954430..7d2d7016 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,16 +1,18 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 e20f48c6..af5ebaad 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,24 +1,26 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index b101d35f..8d86530d 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({required this.value}); + const IndexType({ + 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/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/name.dart b/lib/src/enums/name.dart index 74823feb..613bf5f1 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,22 +1,24 @@ 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'), - 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'), + 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 383e45b1..076c1c50 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,50 +1,52 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d4fef930..d34440ec 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index f01fcb01..0bf8e2ad 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({required this.value}); + const VCSDeploymentType({ + 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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index 4145f701..f174d569 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 4e901476..c9f67200 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 35c7b767..2fabb416 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index 7d27adba..fdcee07a 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index fec6f65a..120723df 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 0e80700f..504b5f8f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 bae6618f..5f3e1654 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 0ca54691..20dd7189 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1df01f19..a5b27b4f 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 21f8e9a3..96ce554b 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 298c181a..a4953a0e 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c6eecadd..03ba94c7 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1ef48332..8a5aa89d 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8c8fcb73..d17f414a 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index c5fa6adc..4098a5a1 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "attributes": attributes}; - } + Map toMap() { + return { + "total": total, + "attributes": attributes, + }; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 903c6290..050cbe14 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7374fa78..2202d255 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index f0bc295e..0c3ddf9e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index b8fb5e48..3bb374be 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 66e58c20..b02adbf6 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "buckets": buckets.map((p) => p.toMap()).toList()}; - } + 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 72de429d..c55110cf 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 5322aaab..240e2ce0 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 60fcfa48..0ffc8fea 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c21a2260..367686d0 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 15d80695..7deb5e26 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 558b7d43..7bb56922 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 3b2f1335..c0547e11 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 9d637d92..acf0f6df 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 a7983a62..576937e7 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,24 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 2ba463cd..3823f425 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6672d7ce..4ac1fa12 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 8eb0171f..475c1c40 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "columns": columns}; - } + Map toMap() { + return { + "total": total, + "columns": columns, + }; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index 6221c01e..e55d1534 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7b560989..6fd6a3b0 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 66c0ce7b..94271aa6 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 7318b7ad..1a9c5038 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index ec2c0755..5e954a05 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 c52b50f2..565b1d66 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,19 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 65e13be3..073fa251 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 27eef0c1..deafffe3 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 7a957f1a..1c99fdf9 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 8d79e052..cab95b02 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 5afa7932..5eb5c0ce 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 448c62c7..ecf7e791 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index df81710a..78ba8ab2 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index cf85e457..be424a9c 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 4065e17b..d45ea081 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,30 +2,31 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 8618bcd6..17d9f42c 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,122 +2,124 @@ 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 upate date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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.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(), - trigger: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "trigger": trigger, - "status": status, - "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 upate 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 String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "deploymentId": deploymentId, + "trigger": trigger, + "status": status, + "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 4ed73943..d44139ee 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 a6a9fa46..de8439ec 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 63f49abc..94ea9a14 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "files": files.map((p) => p.toMap()).toList()}; - } + 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 693c9b07..ea6b601a 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,48 +2,46 @@ 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)), - ), - ); - } - - 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))), + ); + } + + 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 0b908240..7614616a 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 eb8145d4..afe8f6b3 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 56c2eded..64401c3f 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index 34d7225c..d5974f55 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,25 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 463cf696..ecf0a178 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "value": value}; - } + Map toMap() { + return { + "name": name, + "value": value, + }; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index fa402e97..54c31e70 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return {"version": version, "status": status}; - } + Map toMap() { + return { + "version": version, + "status": status, + }; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index d412eba9..0a5b6ce9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5f06906b..95da1235 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,16 +2,22 @@ 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'], + ); + } - Map toMap() { - return {"size": size}; - } + Map toMap() { + return { + "size": size, + }; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 59b7092c..0d6e7216 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,26 +2,34 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return {"name": name, "ping": ping, "status": status}; - } + Map toMap() { + return { + "name": name, + "ping": ping, + "status": status, + }; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index dec2d54f..102dfe77 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,30 +2,34 @@ 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'], + ); + } - Map toMap() { - return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; - } + Map toMap() { + return { + "remoteTime": remoteTime, + "localTime": localTime, + "diff": diff, + }; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index 807bdfd0..c43c4d57 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 b4c63f7d..b8358fc1 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 9d6d7aec..b6717c4e 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 6d285a6a..fef735fc 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 490a1824..1b4ff7de 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"jwt": jwt}; - } + Map toMap() { + return { + "jwt": jwt, + }; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 9c45adb1..43eaad08 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,26 +2,34 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code, "nativeName": nativeName}; - } + 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 2e65839e..ea731471 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 084475bf..b5e9ad1a 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 cd5a1155..10499ef5 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"code": code, "name": name}; - } + 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 be6ddb1f..c1243e06 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 7fb3f364..cb567bd7 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 22273a8c..9d4d7701 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "logs": logs.map((p) => p.toMap()).toList()}; - } + 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 8ee142ad..26610e46 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index a4d39dca..f08f5738 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 9b93b00d..c4e9e858 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index 15ddf642..acaacc34 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 96bf3c65..46c166fb 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 c930a23e..d49989d8 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 63411988..6c8b4e36 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,18 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"recoveryCodes": recoveryCodes}; - } + Map toMap() { + return { + "recoveryCodes": recoveryCodes, + }; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index fa57cb8b..01cf0857 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"secret": secret, "uri": uri}; - } + Map toMap() { + return { + "secret": secret, + "uri": uri, + }; + } } 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/phone.dart b/lib/src/models/phone.dart index 40f7bcd2..c8bbb95b 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 879edbc4..2d869308 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "phones": phones.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index 7bc3abc9..edb6083e 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,17 +2,23 @@ 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); - } + factory Preferences.fromMap(Map map) { + return Preferences( + data: map, + ); + } - Map toMap() { - return {"data": data}; - } + 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/provider.dart b/lib/src/models/provider.dart index 1a762f85..4295c486 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 9347fefb..9710aea9 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index dad35dcc..ed520cc4 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 2283653f..fcdabb97 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,24 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "tokens": tokens.map((p) => p.toMap()).toList()}; - } + 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 3700e577..62e69e5b 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 01f046c6..a8374e2b 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,25 +2,31 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "rows": rows.map((p) => p.toMap()).toList()}; - } + 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 7c9677d8..35f82cfa 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 64bc2e08..c234990c 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 d2fe4f64..3a1d955f 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 e9c478af..0257cb86 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 1449f8bd..5cda6acc 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index e74b0d81..cc9e4355 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "sites": sites.map((p) => p.toMap()).toList()}; - } + 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 e8fb8c75..e49d399c 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,35 +2,40 @@ 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(), + ); + } - Map toMap() { - return {"memory": memory, "cpus": cpus, "enabled": enabled, "slug": slug}; - } + 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 de4957d2..0d2b6a73 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 0c926297..36e18a7e 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 6a135b92..6c8c21e2 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 7ce86b9d..1c5b88fb 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,78 +2,76 @@ 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; - 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, - }); + 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, + }); - 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)), - ), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index ebe15c71..2b4b4b41 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "tables": tables.map((p) => p.toMap()).toList()}; - } + 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 4be8b545..f2b3b6b4 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 84233d1d..6ef2725d 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "targets": targets.map((p) => p.toMap()).toList()}; - } + 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 43df33a8..e9058b5b 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 a3994c06..a61cc9f7 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "teams": teams.map((p) => p.toMap()).toList()}; - } + 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 35115467..4f6b8454 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 430d44ac..461d5694 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 eefc62b6..1582a3c7 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "topics": topics.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index 50bfb3ce..effc397c 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 2419d818..edf7a95d 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "users": users.map((p) => p.toMap()).toList()}; - } + 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 2a8e276a..58882a9f 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 ffa58eef..ee1f6f7a 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } diff --git a/test/services/functions_test.dart b/test/services/functions_test.dart index eaacca8c..c7eac047 100644 --- a/test/services/functions_test.dart +++ b/test/services/functions_test.dart @@ -639,6 +639,7 @@ void main() { '\$updatedAt': '2020-10-15T06:38:00.000+00:00', '\$permissions': [], 'functionId': '5e5ea6g16897e', + 'deploymentId': '5e5ea5c16897e', 'trigger': 'http', 'status': 'processing', 'requestMethod': 'GET', @@ -671,6 +672,7 @@ void main() { '\$updatedAt': '2020-10-15T06:38:00.000+00:00', '\$permissions': [], 'functionId': '5e5ea6g16897e', + 'deploymentId': '5e5ea5c16897e', 'trigger': 'http', 'status': 'processing', 'requestMethod': 'GET', diff --git a/test/services/sites_test.dart b/test/services/sites_test.dart index f4a9b957..e10012eb 100644 --- a/test/services/sites_test.dart +++ b/test/services/sites_test.dart @@ -645,6 +645,7 @@ void main() { '\$updatedAt': '2020-10-15T06:38:00.000+00:00', '\$permissions': [], 'functionId': '5e5ea6g16897e', + 'deploymentId': '5e5ea5c16897e', 'trigger': 'http', 'status': 'processing', 'requestMethod': 'GET', diff --git a/test/src/models/execution_test.dart b/test/src/models/execution_test.dart index 2936d861..01ff6290 100644 --- a/test/src/models/execution_test.dart +++ b/test/src/models/execution_test.dart @@ -10,6 +10,7 @@ void main() { $updatedAt: '2020-10-15T06:38:00.000+00:00', $permissions: [], functionId: '5e5ea6g16897e', + deploymentId: '5e5ea5c16897e', trigger: 'http', status: 'processing', requestMethod: 'GET', @@ -31,6 +32,7 @@ void main() { 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, 'http'); expect(result.status, 'processing'); expect(result.requestMethod, 'GET'); From 6737919fdd92680b43ffb877f6cd734342e31e32 Mon Sep 17 00:00:00 2001 From: abnegate Date: Sat, 23 Aug 2025 08:13:31 +0000 Subject: [PATCH 16/22] Commit from GitHub Actions (Format and push) --- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1471 ++++++------ lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 ++++++++++------- lib/services/functions.dart | 869 ++++--- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 +++-- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 2260 +++++++++++-------- lib/services/sites.dart | 822 ++++--- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 +++++++++------ lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1582 +++++++------ lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 244 +- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 +-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 +-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 +-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +-- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 164 files changed, 13096 insertions(+), 11463 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/query.dart b/lib/query.dart index 281aa756..c9a2fc91 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if(attribute != null) { + if (attribute != null) { map['attribute'] = attribute; } - - if(values != null) { + + if (values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} \ 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 fd7537d4..601d7616 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,27 +1,26 @@ 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 +29,32 @@ 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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,661 +63,674 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = { - 'queries': queries, - - - }; + final Map apiParams = {'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.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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/account/identities/{identityId}'.replaceAll( + '{identityId}', + identityId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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() async { - final String apiPath = '/account/jwts'; - - final Map apiParams = { - - - }; + Future createJWT() async { + final String apiPath = '/account/jwts'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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.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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.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 apiParams = {'mfa': mfa}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 `CreateMFAAuthenticator` instead.') - Future createMfaAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - - final Map apiParams = { - - - }; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `CreateMFAAuthenticator` instead.', + ) + Future createMfaAuthenticator({ + required enums.AuthenticatorType type, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future createMFAAuthenticator({ + required enums.AuthenticatorType type, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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 `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, - - }; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `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 apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - 'otp': otp, + 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 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 `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 apiHeaders = { - 'content-type': 'application/json', + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `DeleteMFAAuthenticator` instead.', + ) + Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteMFAAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 `CreateMFAChallenge` instead.') - Future createMfaChallenge({required enums.AuthenticationFactor factor}) async { - final String apiPath = '/account/mfa/challenge'; - - 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); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `CreateMFAChallenge` instead.', + ) + Future createMfaChallenge({ + required enums.AuthenticationFactor factor, + }) async { + final String apiPath = '/account/mfa/challenge'; + + 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, + ); 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/challenge'; + Future createMFAChallenge({ + required enums.AuthenticationFactor factor, + }) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = { - - 'factor': factor.value, + final Map apiParams = {'factor': factor.value}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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 `UpdateMFAChallenge` instead.') - Future updateMfaChallenge({required String challengeId, required String otp}) async { - final String apiPath = '/account/mfa/challenge'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `UpdateMFAChallenge` instead.', + ) + Future updateMfaChallenge({ + required String challengeId, + required String otp, + }) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/challenge'; + Future updateMFAChallenge({ + required String challengeId, + required String otp, + }) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 `ListMFAFactors` instead.') - Future listMfaFactors() async { - final String apiPath = '/account/mfa/factors'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `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 `GetMFARecoveryCodes` instead.') - Future getMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `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 `CreateMFARecoveryCodes` instead.') - Future createMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `CreateMFARecoveryCodes` instead.', + ) + Future createMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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 apiHeaders = { - 'content-type': 'application/json', + 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 `UpdateMFARecoveryCodes` instead.') - Future updateMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `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 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 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'; - - final Map apiParams = { - - 'name': name, + Future updateName({required String name}) async { + final String apiPath = '/account/name'; - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'oldPassword': oldPassword, - + 'oldPassword': oldPassword, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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'; - - final Map apiParams = { - - 'prefs': prefs, - - }; + Future updatePrefs({required Map prefs}) async { + final String apiPath = '/account/prefs'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -724,99 +740,98 @@ 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'; - - final Map apiParams = { - - 'email': email, -'url': url, - - }; + Future createRecovery({ + required String email, + required String url, + }) async { + final String apiPath = '/account/recovery'; - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {'email': email, '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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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 @@ -825,213 +840,212 @@ 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'; - - final Map apiParams = { - - - }; + Future createAnonymousSession() async { + final String apiPath = '/account/sessions/anonymous'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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.') - Future updateMagicURLSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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.') - Future updatePhoneSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {'userId': userId, '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); - - final Map apiParams = { - - - }; + Future updateSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 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 @@ -1042,32 +1056,35 @@ 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, -'phrase': phrase, - + 'email': email, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 @@ -1078,66 +1095,79 @@ 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, -'url': url, -'phrase': phrase, - + 'email': email, + 'url': url, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { 'success': success, -'failure': failure, -'scopes': scopes, + 'failure': failure, + 'scopes': scopes, - 'project': client.config['project'], }; 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)); + query.add( + Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item), + ); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -1145,15 +1175,16 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri(scheme: endpoint.scheme, + Uri url = Uri( + scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&') + 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 @@ -1161,30 +1192,29 @@ 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, - - }; + final Map apiParams = {'userId': userId, 'phone': phone}; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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** @@ -1195,56 +1225,52 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; - - final Map apiParams = { - - 'url': url, + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - }; + final Map apiParams = {'url': url}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 updateVerification({required String userId, required String secret}) async { - final String apiPath = '/account/verification'; + Future updateVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification'; - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; + final Map apiParams = {'userId': userId, 'secret': secret}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -1254,47 +1280,44 @@ 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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/verification/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, + Future updatePhoneVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification/phone'; - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {'userId': userId, '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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index a91d6d3f..8033f1cd 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,189 +1,255 @@ 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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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, -'width': width, -'height': height, + 'width': width, + '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 = { 'name': name, -'width': width, -'height': height, -'background': background, + 'width': width, + 'height': height, + '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, -'size': size, -'margin': margin, -'download': download, + 'size': size, + 'margin': margin, + '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/databases.dart b/lib/services/databases.dart index f962d8b3..223f1318 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1215 +1,1682 @@ 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}) 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, + }) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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.createDatabase` 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.createDatabase` instead.', + ) + Future create({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases'; final Map apiParams = { - 'databaseId': databaseId, -'name': name, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, bool? enabled}) async { - final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.', + ) + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'collectionId': collectionId, -'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) 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, + required String name, + List? permissions, + bool? documentSecurity, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + @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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + @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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return 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/{key}/relationship'.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/{key}/relationship' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'onDelete': onDelete?.value, -'newKey': newKey, - + 'newKey': newKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - } + } /// 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'documentId': documentId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + final Map apiParams = {'queries': queries}; + + final Map 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, required Map data, List? permissions}) 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, + required Map data, + List? permissions, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - 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; - - } + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'attributes': attributes, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 index by 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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); - - 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; - - } -} \ No newline at end of file + @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 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/functions.dart b/lib/services/functions.dart index 05a7d5f7..e86f1afe 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,256 +1,316 @@ 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}) async { - final String apiPath = '/functions'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? specification}) 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? specification, + }) async { + final String apiPath = '/functions'; final Map apiParams = { - 'functionId': functionId, -'name': name, -'runtime': runtime.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'name': name, + 'runtime': runtime.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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? specification}) 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? specification, + }) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'name': name, -'runtime': runtime?.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'runtime': runtime?.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String functionId}) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateFunctionDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployment'.replaceAll( + '{functionId}', + functionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); + Future listDeployments({ + required String functionId, + List? queries, + String? search, + }) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 = { - 'entrypoint': entrypoint, -'commands': commands, -'code': code, -'activate': activate, - + 'commands': commands, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -265,361 +325,446 @@ 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, -'buildId': buildId, - + 'buildId': buildId, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String functionId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/functions/{functionId}/deployments/template' + .replaceAll('{functionId}', functionId); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll('{functionId}', functionId); + Future createVcsDeployment({ + required String functionId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployments/{deploymentId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 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}) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - - final Map apiParams = { - 'queries': queries, + Future listExecutions({ + required String functionId, + List? queries, + }) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll( + '{functionId}', + functionId, + ); - - }; + final Map apiParams = {'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.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 = { - 'body': body, -'async': xasync, -'path': path, -'method': method?.value, -'headers': headers, -'scheduledAt': scheduledAt, - + 'async': xasync, + 'path': path, + 'method': method?.value, + 'headers': headers, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteExecution({ + required String functionId, + required String executionId, + }) async { + final String apiPath = '/functions/{functionId}/executions/{executionId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{executionId}', executionId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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, + }) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index e2418b52..18eb54f1 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,51 +1,49 @@ 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 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); - - return res.data; + 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 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); - - return res.data; + final res = await client.call( + HttpMethod.post, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/health.dart b/lib/services/health.dart index 0cf64ac6..5250c91d 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,438 +1,414 @@ 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.HealthStatus.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 = { - 'domain': domain, + final Map apiParams = {'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); - - } + } /// 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.HealthStatus.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.HealthStatus.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 = { - 'threshold': threshold, - - - }; + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueCertificates({int? threshold}) async { + final String apiPath = '/health/queue/certificates'; - - }; + final Map apiParams = {'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 = { 'name': name, -'threshold': threshold, - - + '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 = { - 'threshold': threshold, + final Map apiParams = {'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); - - final Map apiParams = { - 'threshold': threshold, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future getFailedJobs({ + required enums.Name name, + int? threshold, + }) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll( + '{name}', + name.value, + ); + + final Map apiParams = {'threshold': threshold}; + + final Map 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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueFunctions({int? threshold}) async { + final String apiPath = '/health/queue/functions'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueStatsResources({int? threshold}) async { + final String apiPath = '/health/queue/stats-resources'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 @@ -441,21 +417,20 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 430a00c3..4d3cc3e0 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,172 +1,164 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 93c843cc..fa8a7caf 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1393 +1,1805 @@ 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}) async { - final String apiPath = '/messaging/messages'; + Future listMessages({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'topics': topics, -'users': users, -'targets': targets, -'cc': cc, -'bcc': bcc, -'attachments': attachments, -'draft': draft, -'html': html, -'scheduledAt': scheduledAt, - + 'subject': subject, + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'cc': cc, + 'bcc': bcc, + 'attachments': attachments, + 'draft': draft, + 'html': html, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'title': title, -'body': body, -'topics': topics, -'users': users, -'targets': targets, -'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.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'title': title, + 'body': body, + 'topics': topics, + 'users': users, + 'targets': targets, + '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.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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); return models.Message.fromMap(res.data); - - } + } /// Create a new SMS message. - @Deprecated('This API has been deprecated since 1.8.0. Please use `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 `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, -'topics': topics, -'users': users, -'targets': targets, -'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'draft': draft, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'topics': topics, -'users': users, -'targets': targets, -'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'draft': draft, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 `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 `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 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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}) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listMessageLogs({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/providers'; + Future listProviders({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 `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 `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, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 `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 `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 = { - 'name': name, -'enabled': enabled, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 `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 `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 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 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 `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 `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 = { - 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'enabled': enabled, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'enabled': enabled, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, -'enabled': enabled, - + 'name': name, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, - + 'enabled': enabled, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'enabled': enabled, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 `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 `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, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 `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 `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 = { - 'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 = { - 'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, -'from': from, -'customerId': customerId, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'customerId': customerId, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'customerId': customerId, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'customerId': customerId, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'from': from, -'username': username, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'username': username, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'username': username, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'username': username, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'from': from, -'accountSid': accountSid, -'authToken': authToken, -'enabled': enabled, - + 'name': name, + 'from': from, + 'accountSid': accountSid, + 'authToken': authToken, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'accountSid': accountSid, -'authToken': authToken, -'from': from, - + 'enabled': enabled, + 'accountSid': accountSid, + 'authToken': authToken, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'from': from, -'apiKey': apiKey, -'apiSecret': apiSecret, -'enabled': enabled, - + 'name': name, + 'from': from, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'apiSecret': apiSecret, -'from': from, - + 'enabled': enabled, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteProvider({required String providerId}) async { + final String apiPath = '/messaging/providers/{providerId}'.replaceAll( + '{providerId}', + providerId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listProviderLogs({ + required String providerId, + List? queries, + }) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( + '{providerId}', + providerId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs({ + required String subscriberId, + List? queries, + }) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs' + .replaceAll('{subscriberId}', subscriberId); - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.LogList.fromMap(res.data); - - } + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({List? queries, String? search}) async { - final String apiPath = '/messaging/topics'; + Future listTopics({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'subscribe': subscribe, - + 'name': name, + 'subscribe': subscribe, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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}) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTopicLogs({ + required String topicId, + List? queries, + }) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( + '{topicId}', + topicId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); + Future listSubscribers({ + required String topicId, + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( + '{topicId}', + topicId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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 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); - - 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; - - } -} \ No newline at end of file + 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 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/sites.dart b/lib/services/sites.dart index 5481986e..d89f2192 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,247 +1,296 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.Adapter? adapter, + String? installationId, + String? fallbackFile, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites'; final Map apiParams = { - 'siteId': siteId, -'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime.value, -'adapter': adapter?.value, -'installationId': installationId, -'fallbackFile': fallbackFile, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime.value, + 'adapter': adapter?.value, + 'installationId': installationId, + 'fallbackFile': fallbackFile, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.BuildRuntime? buildRuntime, + enums.Adapter? adapter, + String? fallbackFile, + String? installationId, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime?.value, -'adapter': adapter?.value, -'fallbackFile': fallbackFile, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime?.value, + 'adapter': adapter?.value, + 'fallbackFile': fallbackFile, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + Future delete({required String siteId}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateSiteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployment'.replaceAll( + '{siteId}', + siteId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future listDeployments({ + required String siteId, + List? queries, + String? search, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future createDeployment({ + required String siteId, + required InputFile code, + required bool activate, + String? installCommand, + String? buildCommand, + String? outputDirectory, + Function(UploadProgress)? onProgress, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'code': code, -'activate': activate, - + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -256,331 +305,400 @@ 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, + 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 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String siteId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll('{siteId}', siteId); + Future createVcsDeployment({ + required String siteId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - 'queries': queries, + Future listLogs({ + required String siteId, + List? queries, + }) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll( + '{siteId}', + siteId, + ); - - }; + final Map apiParams = {'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.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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ccdce915..ee630883 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,184 +1,226 @@ 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}) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({ + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { - 'bucketId': bucketId, -'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'name': name, + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) 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, + }) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { - 'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteBucket({required String bucketId}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); + Future listFiles({ + required String bucketId, + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'permissions': permissions, - + 'file': file, + 'permissions': permissions, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -194,137 +236,187 @@ 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 = { - 'name': name, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 = { 'width': width, -'height': height, -'gravity': gravity?.value, -'quality': quality, -'borderWidth': borderWidth, -'borderColor': borderColor, -'borderRadius': borderRadius, -'opacity': opacity, -'rotation': rotation, -'background': background, -'output': output?.value, -'token': token, - - + 'height': height, + 'gravity': gravity?.value, + 'quality': quality, + 'borderWidth': borderWidth, + 'borderColor': borderColor, + 'borderRadius': borderRadius, + 'opacity': opacity, + 'rotation': rotation, + 'background': background, + 'output': output?.value, + '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 = { '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 6a007ccd..f9d86004 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1162 +1,1520 @@ 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}) async { - final String apiPath = '/tablesdb'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, required String name, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + Future listTables({ + required String databaseId, + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'tableId': tableId, -'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future updateTable({ + required String databaseId, + required String tableId, + required String name, + List? permissions, + bool? rowSecurity, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteTable({ + required String databaseId, + required String tableId, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listColumns({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - /// - 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); + /// + 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - /// - 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); + /// + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + 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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + 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 apiHeaders = {'content-type': 'application/json'}; + + 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listIndexes({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'columns': columns, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + 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 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); - - 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; - - } + 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 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRow({required String databaseId, required String tableId, required String rowId, required Map data, List? permissions}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'rowId': rowId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + Future createRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - /// - Future upsertRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future upsertRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future updateRows({ + required String databaseId, + required String tableId, + Map? data, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + Future deleteRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future getRow({ + required String databaseId, + required String tableId, + required String rowId, + List? queries, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future upsertRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - 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; - - } + Future deleteRow({ + required String databaseId, + required String tableId, + required String rowId, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future decrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? min, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future incrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? max, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.patch, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); return models.Row.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/teams.dart b/lib/services/teams.dart index c21a93af..5fd59641 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,140 +1,147 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'roles': roles, - + 'name': name, + 'roles': roles, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - 'name': name, + 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 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); + Future listMemberships({ + required String teamId, + List? queries, + String? search, + }) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll( + '{teamId}', + teamId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 @@ -142,182 +149,210 @@ 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 = { - 'email': email, -'userId': userId, -'phone': phone, -'roles': roles, -'url': url, -'name': name, - + 'userId': userId, + 'phone': phone, + 'roles': roles, + 'url': url, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - 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); + /// + 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, + ); 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index cb04449b..4e6915dc 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,109 +1,113 @@ 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}) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future list({ + required String bucketId, + required String fileId, + List? queries, + }) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); + + final Map apiParams = {'queries': queries}; + + final Map 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); - - 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); + 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, + ); 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); - - final Map apiParams = { - - 'expire': expire, + 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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String tokenId}) async { + final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/users.dart b/lib/services/users.dart index 586f6770..cc2c2462 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,314 +1,359 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'password': password, -'name': name, - + 'email': email, + 'phone': phone, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/users/identities'; + Future listIdentities({ + List? queries, + String? search, + }) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordCpu': passwordCpu, + 'passwordMemory': passwordMemory, + 'passwordParallel': passwordParallel, + 'passwordLength': passwordLength, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordSaltSeparator': passwordSaltSeparator, + 'passwordSignerKey': passwordSignerKey, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'passwordVersion': passwordVersion?.value, -'name': name, - + 'email': email, + 'password': password, + 'passwordVersion': passwordVersion?.value, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -316,782 +361,909 @@ 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); 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 = { - 'sessionId': sessionId, -'duration': duration, - + 'duration': duration, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// Get the user activity logs list by its unique ID. - Future listLogs({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listLogs({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/logs'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); + Future listMemberships({ + required String userId, + List? queries, + String? search, + }) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll( + '{userId}', + userId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 `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); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `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, + ); 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 apiParams = {'mfa': mfa}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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 `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 apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `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 apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 `ListMFAFactors` instead.') - Future listMfaFactors({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/factors'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `ListMFAFactors` instead.', + ) + Future listMfaFactors({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/factors'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {}; + + final Map 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 `GetMFARecoveryCodes` instead.') - Future getMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `GetMFARecoveryCodes` instead.', + ) + Future getMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {}; + + final Map 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 `UpdateMFARecoveryCodes` instead.') - Future updateMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `UpdateMFARecoveryCodes` instead.', + ) + Future updateMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + Future updateMFARecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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 `CreateMFARecoveryCodes` instead.') - Future createMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `CreateMFARecoveryCodes` instead.', + ) + Future createMfaRecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); + + 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.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 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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 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 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; - - } + 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); - - final Map apiParams = { - - - }; + Future deleteSession({ + required String userId, + required String sessionId, + }) async { + final String apiPath = '/users/{userId}/sessions/{sessionId}' + .replaceAll('{userId}', userId) + .replaceAll('{sessionId}', sessionId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// List the messaging targets that are associated with a user. - Future listTargets({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/targets'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, -'providerId': providerId, -'name': name, - + 'providerType': providerType.value, + 'identifier': identifier, + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'identifier': identifier, -'providerId': providerId, -'name': name, - + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteTarget({ + required String userId, + required String targetId, + }) async { + final String apiPath = '/users/{userId}/targets/{targetId}' + .replaceAll('{userId}', userId) + .replaceAll('{targetId}', targetId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'length': length, -'expire': expire, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future createToken({ + required String userId, + int? length, + int? expire, + }) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'length': length, 'expire': expire}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/src/client.dart b/lib/src/client.dart index 0d9be210..d82d623a 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,7 +81,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 cd82d264..08d93b85 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,21 +2,25 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index ea2cd62a..c961873f 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,14 +9,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => +ClientBase createClient({required String endPoint, required bool selfSigned}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -34,59 +31,66 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format' : '1.8.0', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -135,7 +139,11 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -162,12 +170,19 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index f9e695bf..2bd7d639 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,17 +10,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => - ClientIO( - endPoint: endPoint, - selfSigned: selfSigned, - ); +ClientBase createClient({required String endPoint, required bool selfSigned}) => + ClientIO(endPoint: endPoint, selfSigned: selfSigned); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -43,60 +37,68 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format' : '1.8.0', + 'user-agent': + 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -151,11 +153,16 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, file.path!, - filename: file.filename); + paramName, + file.path!, + filename: file.filename, + ); } else { - 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, @@ -194,12 +201,19 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -244,10 +258,7 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse( - res, - responseType: responseType, - ); + return prepareResponse(res, responseType: responseType); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 658b79b6..06c9ebe3 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest) - .fields - .addAll({"$key[$i]": v.toString()}); + (request as http.MultipartRequest).fields.addAll({ + "$key[$i]": v.toString(), + }); }); } else { - (request as http.MultipartRequest) - .fields - .addAll({key: value.toString()}); + (request as http.MultipartRequest).fields.addAll({ + key: value.toString(), + }); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value){ + params = params.map((key, value) { if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,12 +51,13 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port, + ); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -66,7 +67,9 @@ 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); @@ -113,18 +116,25 @@ 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.dart b/lib/src/enums.dart index 595afdc2..0f250ea3 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes + bytes, } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 2f198d4e..3341912f 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 cd45b6a1..1bae5c8a 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 7d2d7016..42954430 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,18 +1,16 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 af5ebaad..e20f48c6 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,26 +1,24 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index 8d86530d..b101d35f 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({ - required this.value - }); + const IndexType({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/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/name.dart b/lib/src/enums/name.dart index 613bf5f1..74823feb 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,24 +1,22 @@ 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'), - 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'), + 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 076c1c50..383e45b1 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,52 +1,50 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d34440ec..d4fef930 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index 0bf8e2ad..f01fcb01 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({ - required this.value - }); + const VCSDeploymentType({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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index f174d569..4145f701 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 c9f67200..4e901476 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 2fabb416..35c7b767 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index fdcee07a..7d27adba 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index 120723df..fec6f65a 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 504b5f8f..0e80700f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 5f3e1654..bae6618f 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 20dd7189..0ca54691 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a5b27b4f..1df01f19 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 96ce554b..21f8e9a3 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a4953a0e..298c181a 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 03ba94c7..c6eecadd 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8a5aa89d..1ef48332 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 d17f414a..8c8fcb73 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index 4098a5a1..c5fa6adc 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "attributes": attributes, - }; - } + Map toMap() { + return {"total": total, "attributes": attributes}; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 050cbe14..903c6290 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 2202d255..7374fa78 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index 0c3ddf9e..f0bc295e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index 3bb374be..b8fb5e48 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index b02adbf6..66e58c20 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "buckets": buckets.map((p) => p.toMap()).toList(), - }; - } + 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 c55110cf..72de429d 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 240e2ce0..5322aaab 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 0ffc8fea..60fcfa48 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 367686d0..c21a2260 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7deb5e26..15d80695 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7bb56922..558b7d43 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c0547e11..3b2f1335 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 acf0f6df..9d637d92 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 576937e7..a7983a62 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,28 +2,24 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 3823f425..2ba463cd 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 4ac1fa12..6672d7ce 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 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; - 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 475c1c40..8eb0171f 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "columns": columns, - }; - } + Map toMap() { + return {"total": total, "columns": columns}; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index e55d1534..6221c01e 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6fd6a3b0..7b560989 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 94271aa6..66c0ce7b 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 1a9c5038..7318b7ad 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 5e954a05..ec2c0755 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 565b1d66..c52b50f2 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,28 +2,19 @@ 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()); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 073fa251..65e13be3 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 deafffe3..27eef0c1 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 1c99fdf9..7a957f1a 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 cab95b02..8d79e052 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 5eb5c0ce..5afa7932 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 ecf7e791..448c62c7 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 78ba8ab2..df81710a 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index be424a9c..cf85e457 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 d45ea081..4065e17b 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,31 +2,30 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 17d9f42c..c2c823cb 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,124 +2,128 @@ 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 upate 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 String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "deploymentId": deploymentId, - "trigger": trigger, - "status": status, - "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 upate 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 String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "deploymentId": deploymentId, + "trigger": trigger, + "status": status, + "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 d44139ee..4ed73943 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 de8439ec..a6a9fa46 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 94ea9a14..63f49abc 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "files": files.map((p) => p.toMap()).toList(), - }; - } + 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 ea6b601a..693c9b07 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,46 +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))), - ); - } - - 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)), + ), + ); + } + + 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 7614616a..0b908240 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 afe8f6b3..eb8145d4 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 64401c3f..56c2eded 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index d5974f55..34d7225c 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,28 +2,25 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 ecf0a178..463cf696 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "value": value, - }; - } + Map toMap() { + return {"name": name, "value": value}; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index 54c31e70..fa402e97 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "version": version, - "status": status, - }; - } + Map toMap() { + return {"version": version, "status": status}; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index 0a5b6ce9..d412eba9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 95da1235..5f06906b 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,22 +2,16 @@ 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']); + } - Map toMap() { - return { - "size": size, - }; - } + Map toMap() { + return {"size": size}; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 0d6e7216..59b7092c 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,34 +2,26 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "name": name, - "ping": ping, - "status": status, - }; - } + Map toMap() { + return {"name": name, "ping": ping, "status": status}; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index 102dfe77..dec2d54f 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,34 +2,30 @@ 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'], + ); + } - Map toMap() { - return { - "remoteTime": remoteTime, - "localTime": localTime, - "diff": diff, - }; - } + Map toMap() { + return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index c43c4d57..807bdfd0 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 b8358fc1..b4c63f7d 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 b6717c4e..9d6d7aec 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 fef735fc..6d285a6a 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 1b4ff7de..490a1824 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "jwt": jwt, - }; - } + Map toMap() { + return {"jwt": jwt}; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 43eaad08..9c45adb1 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,34 +2,26 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - "nativeName": nativeName, - }; - } + 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 ea731471..2e65839e 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 b5e9ad1a..084475bf 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 10499ef5..cd5a1155 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "name": name, - }; - } + 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 c1243e06..be6ddb1f 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 cb567bd7..7fb3f364 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 9d4d7701..22273a8c 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "logs": logs.map((p) => p.toMap()).toList(), - }; - } + 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 26610e46..8ee142ad 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index f08f5738..a4d39dca 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 c4e9e858..9b93b00d 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index acaacc34..15ddf642 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 46c166fb..96bf3c65 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 d49989d8..c930a23e 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 6c8b4e36..63411988 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,22 +2,18 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "recoveryCodes": recoveryCodes, - }; - } + Map toMap() { + return {"recoveryCodes": recoveryCodes}; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index 01cf0857..fa57cb8b 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "secret": secret, - "uri": uri, - }; - } + Map toMap() { + return {"secret": secret, "uri": uri}; + } } 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/phone.dart b/lib/src/models/phone.dart index c8bbb95b..40f7bcd2 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 2d869308..879edbc4 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "phones": phones.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index edb6083e..7bc3abc9 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,23 +2,17 @@ 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, - ); - } + factory Preferences.fromMap(Map map) { + return Preferences(data: map); + } - Map toMap() { - return { - "data": data, - }; - } + 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/provider.dart b/lib/src/models/provider.dart index 4295c486..1a762f85 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 9710aea9..9347fefb 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index ed520cc4..dad35dcc 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 fcdabb97..2283653f 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,28 +2,24 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "tokens": tokens.map((p) => p.toMap()).toList(), - }; - } + 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 62e69e5b..3700e577 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 a8374e2b..01f046c6 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,31 +2,25 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "rows": rows.map((p) => p.toMap()).toList(), - }; - } + 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 35f82cfa..7c9677d8 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 c234990c..64bc2e08 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 3a1d955f..d2fe4f64 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 0257cb86..e9c478af 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 5cda6acc..1449f8bd 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index cc9e4355..e74b0d81 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "sites": sites.map((p) => p.toMap()).toList(), - }; - } + 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 e49d399c..e8fb8c75 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,40 +2,35 @@ 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(), + ); + } - Map toMap() { - return { - "memory": memory, - "cpus": cpus, - "enabled": enabled, - "slug": slug, - }; - } + 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 0d2b6a73..de4957d2 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 36e18a7e..0c926297 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 6c8c21e2..6a135b92 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 1c5b88fb..7ce86b9d 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,76 +2,78 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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)), + ), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 2b4b4b41..ebe15c71 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "tables": tables.map((p) => p.toMap()).toList(), - }; - } + 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 f2b3b6b4..4be8b545 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 6ef2725d..84233d1d 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "targets": targets.map((p) => p.toMap()).toList(), - }; - } + 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 e9058b5b..43df33a8 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 a61cc9f7..a3994c06 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "teams": teams.map((p) => p.toMap()).toList(), - }; - } + 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 4f6b8454..35115467 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 461d5694..430d44ac 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 1582a3c7..eefc62b6 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "topics": topics.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index effc397c..50bfb3ce 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index edf7a95d..2419d818 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "users": users.map((p) => p.toMap()).toList(), - }; - } + 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 58882a9f..2a8e276a 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 ee1f6f7a..ffa58eef 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } From b4e5fdc2f55c09f351a44c772e7936de424a874d Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Sat, 23 Aug 2025 22:18:20 +1200 Subject: [PATCH 17/22] Add 1.8.x support --- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1471 ++++++------ lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 +++++++---------- lib/services/functions.dart | 869 +++---- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 ++--- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 2260 ++++++++----------- lib/services/sites.dart | 822 +++---- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 ++++++--------- lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1582 ++++++------- lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 244 +- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 +-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 +-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 +-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +-- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 164 files changed, 11463 insertions(+), 13096 deletions(-) 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/query.dart b/lib/query.dart index c9a2fc91..281aa756 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if (attribute != null) { + if(attribute != null) { map['attribute'] = attribute; } - - if (values != null) { + + if(values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} +} \ 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 601d7616..9225f30a 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,26 +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 @@ -29,32 +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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -63,674 +60,661 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 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; - } + 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() async { - final String apiPath = '/account/jwts'; + Future createJWT() async { + final String apiPath = '/account/jwts'; + + final Map apiParams = { + + + }; - final Map apiParams = {}; + final Map apiHeaders = { + 'content-type': 'application/json', - 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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 apiParams = { + + 'mfa': mfa, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 `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 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 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 `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 apiParams = { + + 'otp': otp, + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiParams = { + + 'otp': otp, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 `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 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; - 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 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; - } + 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 `CreateMFAChallenge` instead.', - ) - Future createMfaChallenge({ - required enums.AuthenticationFactor factor, - }) async { - final String apiPath = '/account/mfa/challenge'; - - 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, - ); + @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/challenge'; + + 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); 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/challenge'; + Future createMFAChallenge({required enums.AuthenticationFactor factor}) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = {'factor': factor.value}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 `UpdateMFAChallenge` instead.', - ) - Future updateMfaChallenge({ - required String challengeId, - required String otp, - }) async { - final String apiPath = '/account/mfa/challenge'; + @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/challenge'; final Map apiParams = { + 'challengeId': challengeId, - 'otp': otp, +'otp': otp, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/challenge'; + Future updateMFAChallenge({required String challengeId, required String otp}) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { + 'challengeId': challengeId, - 'otp': otp, +'otp': otp, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 `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 `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 `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 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 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 `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 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 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 apiParams = {'name': name}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'oldPassword': oldPassword, +'oldPassword': oldPassword, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 apiParams = {'prefs': prefs}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -740,98 +724,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}; + final Map apiParams = { + + 'email': email, +'url': url, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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; - 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 @@ -840,212 +825,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 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 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.') - Future updateMagicURLSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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.') - Future updatePhoneSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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; - 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 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 @@ -1056,35 +1042,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, - 'phrase': phrase, +'email': email, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -1095,79 +1078,66 @@ 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, - 'url': url, - 'phrase': phrase, +'email': email, +'url': url, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { 'success': success, - 'failure': failure, - 'scopes': scopes, +'failure': failure, +'scopes': scopes, + 'project': client.config['project'], }; 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), - ); + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -1175,16 +1145,15 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri( - scheme: endpoint.scheme, + Uri url = Uri(scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&'), + 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 @@ -1192,29 +1161,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}; + final Map apiParams = { + + 'userId': userId, +'phone': phone, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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** @@ -1225,52 +1195,56 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'url': url}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 updateVerification({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/verification'; + Future updateVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 @@ -1280,44 +1254,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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/verification/phone'; + Future updatePhoneVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification/phone'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiParams = {'userId': userId, 'secret': secret}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index 8033f1cd..a91d6d3f 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,255 +1,189 @@ 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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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, - 'width': width, - 'height': height, +'width': width, +'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 = { 'name': name, - 'width': width, - 'height': height, - 'background': background, +'width': width, +'height': height, +'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, - 'size': size, - 'margin': margin, - 'download': download, +'size': size, +'margin': margin, +'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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 223f1318..f962d8b3 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1682 +1,1215 @@ 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, - }) 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}) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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.createDatabase` 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.createDatabase` instead.') + Future create({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases'; final Map apiParams = { + 'databaseId': databaseId, - 'name': name, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/databases/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.') + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'collectionId': collectionId, - 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - List? permissions, - bool? documentSecurity, - bool? enabled, - }) 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + @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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + @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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return 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/{key}/relationship' - .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/{key}/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'onDelete': onDelete?.value, - 'newKey': newKey, +'newKey': newKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'documentId': documentId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - required Map data, - List? permissions, - }) 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, required Map data, List? permissions}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - 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; - } + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'attributes': attributes, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 index by 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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); - - 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; - } -} + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/functions.dart b/lib/services/functions.dart index e86f1afe..05a7d5f7 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,316 +1,256 @@ 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, - }) async { - final String apiPath = '/functions'; + Future list({List? queries, String? search}) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? specification, - }) 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? specification}) async { + final String apiPath = '/functions'; final Map apiParams = { + 'functionId': functionId, - 'name': name, - 'runtime': runtime.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'name': name, +'runtime': runtime.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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? specification, - }) 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? specification}) async { + final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'name': name, - 'runtime': runtime?.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'runtime': runtime?.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll( - '{functionId}', - functionId, - ); + Future listDeployments({required String functionId, List? queries, String? search}) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 = { + 'entrypoint': entrypoint, - 'commands': commands, - 'code': code, - 'activate': activate, +'commands': commands, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -325,446 +265,361 @@ 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, - 'buildId': buildId, +'buildId': buildId, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String functionId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/functions/{functionId}/deployments/template'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll( - '{functionId}', - functionId, - ); + Future createVcsDeployment({required String functionId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll( - '{functionId}', - functionId, - ); + Future listExecutions({required String functionId, List? queries}) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 = { + 'body': body, - 'async': xasync, - 'path': path, - 'method': method?.value, - 'headers': headers, - 'scheduledAt': scheduledAt, +'async': xasync, +'path': path, +'method': method?.value, +'headers': headers, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index 18eb54f1..e2418b52 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,49 +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 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; - 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 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/health.dart b/lib/services/health.dart index 5250c91d..0cf64ac6 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,414 +1,438 @@ 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.HealthStatus.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 = {'domain': domain}; + final Map apiParams = { + 'domain': domain, - 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.HealthCertificate.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.HealthStatus.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.HealthStatus.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = { + 'threshold': threshold, - final Map apiParams = {'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 = { 'name': name, - 'threshold': threshold, +'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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, - ); - - final Map apiParams = {'threshold': threshold}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future getFailedJobs({required enums.Name name, int? threshold}) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll('{name}', name.value); + + final Map apiParams = { + 'threshold': threshold, + + + }; + + final Map 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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 @@ -417,20 +441,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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 4d3cc3e0..430a00c3 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,164 +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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index fa8a7caf..23551577 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1805 +1,1393 @@ 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, - }) async { - final String apiPath = '/messaging/messages'; + Future listMessages({List? queries, String? search}) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'cc': cc, - 'bcc': bcc, - 'attachments': attachments, - 'draft': draft, - 'html': html, - 'scheduledAt': scheduledAt, +'subject': subject, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'cc': cc, +'bcc': bcc, +'attachments': attachments, +'draft': draft, +'html': html, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'title': title, - 'body': body, - 'topics': topics, - 'users': users, - 'targets': targets, - '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.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'title': title, +'body': body, +'topics': topics, +'users': users, +'targets': targets, +'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.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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); return models.Message.fromMap(res.data); - } + + } /// Create a new SMS message. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'draft': draft, - 'scheduledAt': scheduledAt, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'draft': draft, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'draft': draft, - 'scheduledAt': scheduledAt, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'draft': draft, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 `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 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 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 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; - return res.data; - } + } /// Get the message activity logs listed by its unique ID. - Future listMessageLogs({ - required String messageId, - List? queries, - }) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listMessageLogs({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/providers'; + Future listProviders({List? queries, String? search}) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 `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, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, - 'enabled': enabled, +'name': name, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, - 'enabled': enabled, +'name': name, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 `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 = { + 'name': name, - 'enabled': enabled, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, +'enabled': enabled, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, +'enabled': enabled, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 `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 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 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 `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 = { + 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'enabled': enabled, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'enabled': enabled, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, - 'enabled': enabled, +'name': name, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, +'enabled': enabled, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'enabled': enabled, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 `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, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 `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 = { + 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 = { + 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'from': from, - 'customerId': customerId, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'customerId': customerId, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'customerId': customerId, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'customerId': customerId, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'username': username, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'username': username, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'username': username, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'username': username, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'accountSid': accountSid, - 'authToken': authToken, - 'enabled': enabled, +'name': name, +'from': from, +'accountSid': accountSid, +'authToken': authToken, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'accountSid': accountSid, - 'authToken': authToken, - 'from': from, +'enabled': enabled, +'accountSid': accountSid, +'authToken': authToken, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'enabled': enabled, +'name': name, +'from': from, +'apiKey': apiKey, +'apiSecret': apiSecret, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'from': from, +'enabled': enabled, +'apiKey': apiKey, +'apiSecret': apiSecret, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } + } /// Get the provider activity logs listed by its unique ID. - Future listProviderLogs({ - required String providerId, - List? queries, - }) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( - '{providerId}', - providerId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listProviderLogs({required String providerId, List? queries}) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs' - .replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs({required String subscriberId, List? queries}) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + '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.LogList.fromMap(res.data); - } + + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({ - List? queries, - String? search, - }) async { - final String apiPath = '/messaging/topics'; + Future listTopics({List? queries, String? search}) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'subscribe': subscribe, +'name': name, +'subscribe': subscribe, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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; - return res.data; - } + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs({ - required String topicId, - List? queries, - }) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( - '{topicId}', - topicId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTopicLogs({required String topicId, List? queries}) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( - '{topicId}', - topicId, - ); + Future listSubscribers({required String topicId, List? queries, String? search}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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 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); - - 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; - } -} + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/sites.dart b/lib/services/sites.dart index d89f2192..5481986e 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,296 +1,247 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? outputDirectory, - enums.Adapter? adapter, - String? installationId, - String? fallbackFile, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites'; final Map apiParams = { + 'siteId': siteId, - 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime.value, - 'adapter': adapter?.value, - 'installationId': installationId, - 'fallbackFile': fallbackFile, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime.value, +'adapter': adapter?.value, +'installationId': installationId, +'fallbackFile': fallbackFile, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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? outputDirectory, - enums.BuildRuntime? buildRuntime, - enums.Adapter? adapter, - String? fallbackFile, - String? installationId, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime?.value, - 'adapter': adapter?.value, - 'fallbackFile': fallbackFile, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime?.value, +'adapter': adapter?.value, +'fallbackFile': fallbackFile, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future listDeployments({required String siteId, List? queries, String? search}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({ - required String siteId, - required InputFile code, - required bool activate, - String? installCommand, - String? buildCommand, - String? outputDirectory, - Function(UploadProgress)? onProgress, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'code': code, - 'activate': activate, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -305,400 +256,331 @@ 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String siteId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll( - '{siteId}', - siteId, - ); + Future createVcsDeployment({required String siteId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll( - '{siteId}', - siteId, - ); + Future listLogs({required String siteId, List? queries}) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ee630883..ccdce915 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,226 +1,184 @@ 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, - }) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({List? queries, String? search}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { + 'bucketId': bucketId, - 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'name': name, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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, - }) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( - '{bucketId}', - bucketId, - ); + Future listFiles({required String bucketId, List? queries, String? search}) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'permissions': permissions, +'file': file, +'permissions': permissions, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -236,187 +194,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 = { + 'name': name, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 = { 'width': width, - 'height': height, - 'gravity': gravity?.value, - 'quality': quality, - 'borderWidth': borderWidth, - 'borderColor': borderColor, - 'borderRadius': borderRadius, - 'opacity': opacity, - 'rotation': rotation, - 'background': background, - 'output': output?.value, - 'token': token, - +'height': height, +'gravity': gravity?.value, +'quality': quality, +'borderWidth': borderWidth, +'borderColor': borderColor, +'borderRadius': borderRadius, +'opacity': opacity, +'rotation': rotation, +'background': background, +'output': output?.value, +'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 = { '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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index f9d86004..6a007ccd 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1520 +1,1162 @@ 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, - }) async { - final String apiPath = '/tablesdb'; + Future list({List? queries, String? search}) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( - '{databaseId}', - databaseId, - ); + Future listTables({required String databaseId, List? queries, String? search}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createTable({ - required String databaseId, - required String tableId, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'tableId': tableId, - 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future updateTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - return res.data; - } + } /// List columns in the table. - Future listColumns({ - required String databaseId, - required String tableId, - List? queries, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listColumns({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + 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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listIndexes({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'columns': columns, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + 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 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); - - 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; - } + 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 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRow({ - required String databaseId, - required String tableId, - required String rowId, - required Map data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'rowId': rowId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future createRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - /// - Future upsertRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future upsertRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future updateRows({required String databaseId, required String tableId, Map? data, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future deleteRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future getRow({required String databaseId, required String tableId, required String rowId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future upsertRow({ - required String databaseId, - required String tableId, - required String rowId, - Map? data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - 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; - } + Future deleteRow({required String databaseId, required String tableId, required String rowId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future decrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? min}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future incrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? max}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/teams.dart b/lib/services/teams.dart index 5fd59641..c21a93af 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,147 +1,140 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'roles': roles, +'name': name, +'roles': roles, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiParams = {'name': name}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - 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, - }) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll( - '{teamId}', - teamId, - ); + Future listMemberships({required String teamId, List? queries, String? search}) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 @@ -149,210 +142,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 = { + 'email': email, - 'userId': userId, - 'phone': phone, - 'roles': roles, - 'url': url, - 'name': name, +'userId': userId, +'phone': phone, +'roles': roles, +'url': url, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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, - ); + /// + 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); 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 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; - 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); - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index 4e6915dc..cb04449b 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,113 +1,109 @@ 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, - }) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future list({required String bucketId, required String fileId, List? queries}) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); - - 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, - ); + 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); 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 apiParams = {'expire': expire}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/users.dart b/lib/services/users.dart index cc2c2462..77d11d61 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,359 +1,314 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'password': password, - 'name': name, +'email': email, +'phone': phone, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = '/users/identities'; + Future listIdentities({List? queries, String? search}) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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; - 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordCpu': passwordCpu, +'passwordMemory': passwordMemory, +'passwordParallel': passwordParallel, +'passwordLength': passwordLength, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordSaltSeparator': passwordSaltSeparator, +'passwordSignerKey': passwordSignerKey, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'passwordVersion': passwordVersion?.value, - 'name': name, +'email': email, +'password': password, +'passwordVersion': passwordVersion?.value, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -361,909 +316,782 @@ 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 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; - 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, - ); - - 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, - ); + 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); 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 = { + 'sessionId': sessionId, - 'duration': duration, +'duration': duration, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// Get the user activity logs list by its unique ID. - Future listLogs({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/logs'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listLogs({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll( - '{userId}', - userId, - ); + Future listMemberships({required String userId, List? queries, String? search}) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 `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, - ); + @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); 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 apiParams = { + + 'mfa': mfa, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 `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 apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - 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 `ListMFAFactors` instead.', - ) - Future listMfaFactors({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/factors'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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 `GetMFARecoveryCodes` instead.', - ) - Future getMfaRecoveryCodes({ - required String userId, - }) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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 `UpdateMFARecoveryCodes` instead.', - ) - Future updateMfaRecoveryCodes({ - required String userId, - }) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 `CreateMFARecoveryCodes` instead.', - ) - Future createMfaRecoveryCodes({ - required String userId, - }) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } + + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll( - '{userId}', - userId, - ); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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 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 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; - } + 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 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; - 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// List the messaging targets that are associated with a user. - Future listTargets({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/targets'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - 'providerId': providerId, - 'name': name, +'providerType': providerType.value, +'identifier': identifier, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'identifier': identifier, - 'providerId': providerId, - 'name': name, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - 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, - ); - - final Map apiParams = {'length': length, 'expire': expire}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future createToken({required String userId, int? length, int? expire}) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll('{userId}', userId); + + final Map apiParams = { + + 'length': length, +'expire': expire, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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); - } -} + + } +} \ No newline at end of file diff --git a/lib/src/client.dart b/lib/src/client.dart index d82d623a..0d9be210 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,8 +81,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 08d93b85..cd82d264 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,25 +2,21 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index c961873f..ea2cd62a 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,11 +9,14 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -31,66 +34,59 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format': '1.8.0', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -139,11 +135,7 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -170,19 +162,12 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 2bd7d639..f9e695bf 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,11 +10,17 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => - ClientIO(endPoint: endPoint, selfSigned: selfSigned); +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => + ClientIO( + endPoint: endPoint, + selfSigned: selfSigned, + ); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -37,68 +43,60 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent': - 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format': '1.8.0', + 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -153,16 +151,11 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, - file.path!, - filename: file.filename, - ); + paramName, file.path!, + filename: file.filename); } else { - 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, @@ -201,19 +194,12 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -258,7 +244,10 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse(res, responseType: responseType); + return prepareResponse( + res, + responseType: responseType, + ); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 06c9ebe3..658b79b6 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest).fields.addAll({ - "$key[$i]": v.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({"$key[$i]": v.toString()}); }); } else { - (request as http.MultipartRequest).fields.addAll({ - key: value.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({key: value.toString()}); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value) { + params = params.map((key, value){ if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,13 +51,12 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port, - ); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -67,9 +66,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); @@ -116,25 +113,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.dart b/lib/src/enums.dart index 0f250ea3..595afdc2 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes, + bytes } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 3341912f..2f198d4e 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 1bae5c8a..cd45b6a1 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 42954430..7d2d7016 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,16 +1,18 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 e20f48c6..af5ebaad 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,24 +1,26 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index b101d35f..8d86530d 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({required this.value}); + const IndexType({ + 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/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/name.dart b/lib/src/enums/name.dart index 74823feb..613bf5f1 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,22 +1,24 @@ 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'), - 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'), + 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 383e45b1..076c1c50 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,50 +1,52 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d4fef930..d34440ec 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index f01fcb01..0bf8e2ad 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({required this.value}); + const VCSDeploymentType({ + 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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index 4145f701..f174d569 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 4e901476..c9f67200 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 35c7b767..2fabb416 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index 7d27adba..fdcee07a 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index fec6f65a..120723df 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 0e80700f..504b5f8f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 bae6618f..5f3e1654 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 0ca54691..20dd7189 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1df01f19..a5b27b4f 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 21f8e9a3..96ce554b 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 298c181a..a4953a0e 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c6eecadd..03ba94c7 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1ef48332..8a5aa89d 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8c8fcb73..d17f414a 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index c5fa6adc..4098a5a1 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "attributes": attributes}; - } + Map toMap() { + return { + "total": total, + "attributes": attributes, + }; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 903c6290..050cbe14 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7374fa78..2202d255 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index f0bc295e..0c3ddf9e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index b8fb5e48..3bb374be 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 66e58c20..b02adbf6 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "buckets": buckets.map((p) => p.toMap()).toList()}; - } + 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 72de429d..c55110cf 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 5322aaab..240e2ce0 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 60fcfa48..b7ce71b8 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 attribute when not provided. Cannot be set when attribute 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c21a2260..df80cfbb 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 attribute 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 15d80695..a92a0a5b 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 attribute when not provided. Cannot be set when attribute 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 558b7d43..9605a6a9 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 attribute when not provided. Cannot be set when attribute 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 3b2f1335..200e2c78 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 attribute when not provided. Cannot be set when attribute 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 9d637d92..acf0f6df 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 a7983a62..576937e7 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,24 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 2ba463cd..5ba4e70b 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 attribute when not provided. Cannot be set when attribute 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6672d7ce..e0be4633 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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 attribute when not provided. Cannot be set when attribute 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 8eb0171f..475c1c40 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "columns": columns}; - } + Map toMap() { + return { + "total": total, + "columns": columns, + }; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index 6221c01e..e55d1534 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7b560989..6fd6a3b0 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 66c0ce7b..94271aa6 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 7318b7ad..1a9c5038 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index ec2c0755..5e954a05 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 c52b50f2..565b1d66 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,19 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 65e13be3..073fa251 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 27eef0c1..deafffe3 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 7a957f1a..1c99fdf9 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 8d79e052..cab95b02 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 5afa7932..5eb5c0ce 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 448c62c7..ecf7e791 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index df81710a..78ba8ab2 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index cf85e457..be424a9c 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 4065e17b..d45ea081 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,30 +2,31 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index c2c823cb..809106a9 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,128 +2,124 @@ 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 upate 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 String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "deploymentId": deploymentId, - "trigger": trigger, - "status": status, - "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 String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "deploymentId": deploymentId, + "trigger": trigger, + "status": status, + "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 4ed73943..d44139ee 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 a6a9fa46..de8439ec 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 63f49abc..94ea9a14 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "files": files.map((p) => p.toMap()).toList()}; - } + 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 693c9b07..ea6b601a 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,48 +2,46 @@ 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)), - ), - ); - } - - 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))), + ); + } + + 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 0b908240..7614616a 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 eb8145d4..afe8f6b3 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 56c2eded..64401c3f 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index 34d7225c..d5974f55 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,25 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 463cf696..ecf0a178 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "value": value}; - } + Map toMap() { + return { + "name": name, + "value": value, + }; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index fa402e97..54c31e70 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return {"version": version, "status": status}; - } + Map toMap() { + return { + "version": version, + "status": status, + }; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index d412eba9..0a5b6ce9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5f06906b..95da1235 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,16 +2,22 @@ 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'], + ); + } - Map toMap() { - return {"size": size}; - } + Map toMap() { + return { + "size": size, + }; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 59b7092c..0d6e7216 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,26 +2,34 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return {"name": name, "ping": ping, "status": status}; - } + Map toMap() { + return { + "name": name, + "ping": ping, + "status": status, + }; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index dec2d54f..102dfe77 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,30 +2,34 @@ 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'], + ); + } - Map toMap() { - return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; - } + Map toMap() { + return { + "remoteTime": remoteTime, + "localTime": localTime, + "diff": diff, + }; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index 807bdfd0..c43c4d57 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 b4c63f7d..b8358fc1 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 9d6d7aec..b6717c4e 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 6d285a6a..fef735fc 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 490a1824..1b4ff7de 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"jwt": jwt}; - } + Map toMap() { + return { + "jwt": jwt, + }; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 9c45adb1..43eaad08 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,26 +2,34 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code, "nativeName": nativeName}; - } + 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 2e65839e..ea731471 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 084475bf..b5e9ad1a 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 cd5a1155..10499ef5 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"code": code, "name": name}; - } + 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 be6ddb1f..c1243e06 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 7fb3f364..cb567bd7 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 22273a8c..9d4d7701 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "logs": logs.map((p) => p.toMap()).toList()}; - } + 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 8ee142ad..26610e46 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index a4d39dca..f08f5738 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 9b93b00d..c4e9e858 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index 15ddf642..acaacc34 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 96bf3c65..46c166fb 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 c930a23e..d49989d8 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 63411988..6c8b4e36 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,18 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"recoveryCodes": recoveryCodes}; - } + Map toMap() { + return { + "recoveryCodes": recoveryCodes, + }; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index fa57cb8b..01cf0857 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"secret": secret, "uri": uri}; - } + Map toMap() { + return { + "secret": secret, + "uri": uri, + }; + } } 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/phone.dart b/lib/src/models/phone.dart index 40f7bcd2..c8bbb95b 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 879edbc4..2d869308 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "phones": phones.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index 7bc3abc9..edb6083e 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,17 +2,23 @@ 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); - } + factory Preferences.fromMap(Map map) { + return Preferences( + data: map, + ); + } - Map toMap() { - return {"data": data}; - } + 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/provider.dart b/lib/src/models/provider.dart index 1a762f85..4295c486 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 9347fefb..9710aea9 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index dad35dcc..ed520cc4 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 2283653f..fcdabb97 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,24 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "tokens": tokens.map((p) => p.toMap()).toList()}; - } + 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 3700e577..62e69e5b 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 01f046c6..a8374e2b 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,25 +2,31 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "rows": rows.map((p) => p.toMap()).toList()}; - } + 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 7c9677d8..35f82cfa 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 64bc2e08..c234990c 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 d2fe4f64..3a1d955f 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 e9c478af..0257cb86 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 1449f8bd..5cda6acc 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index e74b0d81..cc9e4355 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "sites": sites.map((p) => p.toMap()).toList()}; - } + 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 e8fb8c75..e49d399c 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,35 +2,40 @@ 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(), + ); + } - Map toMap() { - return {"memory": memory, "cpus": cpus, "enabled": enabled, "slug": slug}; - } + 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 de4957d2..0d2b6a73 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 0c926297..36e18a7e 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 6a135b92..6c8c21e2 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 7ce86b9d..1c5b88fb 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,78 +2,76 @@ 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; - 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, - }); + 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, + }); - 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)), - ), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index ebe15c71..2b4b4b41 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "tables": tables.map((p) => p.toMap()).toList()}; - } + 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 4be8b545..f2b3b6b4 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 84233d1d..6ef2725d 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "targets": targets.map((p) => p.toMap()).toList()}; - } + 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 43df33a8..e9058b5b 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 a3994c06..a61cc9f7 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "teams": teams.map((p) => p.toMap()).toList()}; - } + 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 35115467..4f6b8454 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 430d44ac..461d5694 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 eefc62b6..1582a3c7 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "topics": topics.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index 50bfb3ce..effc397c 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 2419d818..edf7a95d 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "users": users.map((p) => p.toMap()).toList()}; - } + 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 2a8e276a..58882a9f 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 ffa58eef..ee1f6f7a 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } From 7d737ac70d264d2879c0306c6947398e439ec81f Mon Sep 17 00:00:00 2001 From: abnegate Date: Sat, 23 Aug 2025 10:18:44 +0000 Subject: [PATCH 18/22] Commit from GitHub Actions (Format and push) --- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1471 ++++++------ lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 ++++++++++------- lib/services/functions.dart | 869 ++++--- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 +++-- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 2260 +++++++++++-------- lib/services/sites.dart | 822 ++++--- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 +++++++++------ lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1582 +++++++------ lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 244 +- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 +-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 +-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 +-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +-- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 164 files changed, 13096 insertions(+), 11463 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/query.dart b/lib/query.dart index 281aa756..c9a2fc91 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if(attribute != null) { + if (attribute != null) { map['attribute'] = attribute; } - - if(values != null) { + + if (values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} \ 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 9225f30a..d0c820a1 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,27 +1,26 @@ 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 +29,32 @@ 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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,661 +63,674 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = { - 'queries': queries, - - - }; + final Map apiParams = {'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.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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/account/identities/{identityId}'.replaceAll( + '{identityId}', + identityId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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() async { - final String apiPath = '/account/jwts'; - - final Map apiParams = { - - - }; + Future createJWT() async { + final String apiPath = '/account/jwts'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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.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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.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 apiParams = {'mfa': mfa}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + @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 apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future createMFAAuthenticator({ + required enums.AuthenticatorType type, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - 'otp': otp, - - }; + @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 apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - 'otp': otp, + 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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + @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 res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteMFAAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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/challenge'; - - 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); + @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/challenge'; + + 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, + ); 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/challenge'; + Future createMFAChallenge({ + required enums.AuthenticationFactor factor, + }) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = { - - 'factor': factor.value, + final Map apiParams = {'factor': factor.value}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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/challenge'; + @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/challenge'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/challenge'; + Future updateMFAChallenge({ + required String challengeId, + required String otp, + }) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 apiHeaders = { - 'content-type': 'application/json', + 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 apiHeaders = { - 'content-type': 'application/json', + 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 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 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'; - - final Map apiParams = { - - 'name': name, + Future updateName({required String name}) async { + final String apiPath = '/account/name'; - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'oldPassword': oldPassword, - + 'oldPassword': oldPassword, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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'; - - final Map apiParams = { - - 'prefs': prefs, - - }; + Future updatePrefs({required Map prefs}) async { + final String apiPath = '/account/prefs'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -724,99 +740,98 @@ 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'; - - final Map apiParams = { - - 'email': email, -'url': url, - - }; + Future createRecovery({ + required String email, + required String url, + }) async { + final String apiPath = '/account/recovery'; - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {'email': email, '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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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 @@ -825,213 +840,212 @@ 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'; - - final Map apiParams = { - - - }; + Future createAnonymousSession() async { + final String apiPath = '/account/sessions/anonymous'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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.') - Future updateMagicURLSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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.') - Future updatePhoneSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {'userId': userId, '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); - - final Map apiParams = { - - - }; + Future updateSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 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 @@ -1042,32 +1056,35 @@ 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, -'phrase': phrase, - + 'email': email, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 @@ -1078,66 +1095,79 @@ 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, -'url': url, -'phrase': phrase, - + 'email': email, + 'url': url, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { 'success': success, -'failure': failure, -'scopes': scopes, + 'failure': failure, + 'scopes': scopes, - 'project': client.config['project'], }; 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)); + query.add( + Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item), + ); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -1145,15 +1175,16 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri(scheme: endpoint.scheme, + Uri url = Uri( + scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&') + 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 @@ -1161,30 +1192,29 @@ 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, - - }; + final Map apiParams = {'userId': userId, 'phone': phone}; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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** @@ -1195,56 +1225,52 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; - - final Map apiParams = { - - 'url': url, + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - }; + final Map apiParams = {'url': url}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 updateVerification({required String userId, required String secret}) async { - final String apiPath = '/account/verification'; + Future updateVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification'; - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; + final Map apiParams = {'userId': userId, 'secret': secret}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -1254,47 +1280,44 @@ 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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/verification/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, + Future updatePhoneVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification/phone'; - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {'userId': userId, '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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index a91d6d3f..8033f1cd 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,189 +1,255 @@ 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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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, -'width': width, -'height': height, + 'width': width, + '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 = { 'name': name, -'width': width, -'height': height, -'background': background, + 'width': width, + 'height': height, + '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, -'size': size, -'margin': margin, -'download': download, + 'size': size, + 'margin': margin, + '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/databases.dart b/lib/services/databases.dart index f962d8b3..223f1318 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1215 +1,1682 @@ 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}) 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, + }) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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.createDatabase` 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.createDatabase` instead.', + ) + Future create({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases'; final Map apiParams = { - 'databaseId': databaseId, -'name': name, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, bool? enabled}) async { - final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.', + ) + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'collectionId': collectionId, -'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) 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, + required String name, + List? permissions, + bool? documentSecurity, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + @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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + @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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return 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/{key}/relationship'.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/{key}/relationship' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'onDelete': onDelete?.value, -'newKey': newKey, - + 'newKey': newKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - } + } /// 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'documentId': documentId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + final Map apiParams = {'queries': queries}; + + final Map 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, required Map data, List? permissions}) 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, + required Map data, + List? permissions, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - 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; - - } + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'attributes': attributes, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 index by 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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); - - 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; - - } -} \ No newline at end of file + @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 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/functions.dart b/lib/services/functions.dart index 05a7d5f7..e86f1afe 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,256 +1,316 @@ 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}) async { - final String apiPath = '/functions'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? specification}) 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? specification, + }) async { + final String apiPath = '/functions'; final Map apiParams = { - 'functionId': functionId, -'name': name, -'runtime': runtime.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'name': name, + 'runtime': runtime.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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? specification}) 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? specification, + }) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'name': name, -'runtime': runtime?.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'runtime': runtime?.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String functionId}) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateFunctionDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployment'.replaceAll( + '{functionId}', + functionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); + Future listDeployments({ + required String functionId, + List? queries, + String? search, + }) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 = { - 'entrypoint': entrypoint, -'commands': commands, -'code': code, -'activate': activate, - + 'commands': commands, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -265,361 +325,446 @@ 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, -'buildId': buildId, - + 'buildId': buildId, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String functionId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/functions/{functionId}/deployments/template' + .replaceAll('{functionId}', functionId); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll('{functionId}', functionId); + Future createVcsDeployment({ + required String functionId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployments/{deploymentId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 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}) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - - final Map apiParams = { - 'queries': queries, + Future listExecutions({ + required String functionId, + List? queries, + }) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll( + '{functionId}', + functionId, + ); - - }; + final Map apiParams = {'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.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 = { - 'body': body, -'async': xasync, -'path': path, -'method': method?.value, -'headers': headers, -'scheduledAt': scheduledAt, - + 'async': xasync, + 'path': path, + 'method': method?.value, + 'headers': headers, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteExecution({ + required String functionId, + required String executionId, + }) async { + final String apiPath = '/functions/{functionId}/executions/{executionId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{executionId}', executionId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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, + }) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index e2418b52..18eb54f1 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,51 +1,49 @@ 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 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); - - return res.data; + 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 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); - - return res.data; + final res = await client.call( + HttpMethod.post, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/health.dart b/lib/services/health.dart index 0cf64ac6..5250c91d 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,438 +1,414 @@ 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.HealthStatus.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 = { - 'domain': domain, + final Map apiParams = {'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); - - } + } /// 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.HealthStatus.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.HealthStatus.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 = { - 'threshold': threshold, - - - }; + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueCertificates({int? threshold}) async { + final String apiPath = '/health/queue/certificates'; - - }; + final Map apiParams = {'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 = { 'name': name, -'threshold': threshold, - - + '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 = { - 'threshold': threshold, + final Map apiParams = {'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); - - final Map apiParams = { - 'threshold': threshold, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future getFailedJobs({ + required enums.Name name, + int? threshold, + }) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll( + '{name}', + name.value, + ); + + final Map apiParams = {'threshold': threshold}; + + final Map 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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueFunctions({int? threshold}) async { + final String apiPath = '/health/queue/functions'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueStatsResources({int? threshold}) async { + final String apiPath = '/health/queue/stats-resources'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 @@ -441,21 +417,20 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 430a00c3..4d3cc3e0 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,172 +1,164 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 23551577..bf5376e5 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1393 +1,1805 @@ 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}) async { - final String apiPath = '/messaging/messages'; + Future listMessages({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'topics': topics, -'users': users, -'targets': targets, -'cc': cc, -'bcc': bcc, -'attachments': attachments, -'draft': draft, -'html': html, -'scheduledAt': scheduledAt, - + 'subject': subject, + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'cc': cc, + 'bcc': bcc, + 'attachments': attachments, + 'draft': draft, + 'html': html, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'title': title, -'body': body, -'topics': topics, -'users': users, -'targets': targets, -'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.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'title': title, + 'body': body, + 'topics': topics, + 'users': users, + 'targets': targets, + '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.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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'topics': topics, -'users': users, -'targets': targets, -'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'draft': draft, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'topics': topics, -'users': users, -'targets': targets, -'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'draft': draft, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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}) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listMessageLogs({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/providers'; + Future listProviders({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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 = { - 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'enabled': enabled, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'enabled': enabled, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, -'enabled': enabled, - + 'name': name, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, - + 'enabled': enabled, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'enabled': enabled, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 = { - 'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 = { - 'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, -'from': from, -'customerId': customerId, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'customerId': customerId, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'customerId': customerId, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'customerId': customerId, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'from': from, -'username': username, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'username': username, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'username': username, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'username': username, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'from': from, -'accountSid': accountSid, -'authToken': authToken, -'enabled': enabled, - + 'name': name, + 'from': from, + 'accountSid': accountSid, + 'authToken': authToken, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'accountSid': accountSid, -'authToken': authToken, -'from': from, - + 'enabled': enabled, + 'accountSid': accountSid, + 'authToken': authToken, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'from': from, -'apiKey': apiKey, -'apiSecret': apiSecret, -'enabled': enabled, - + 'name': name, + 'from': from, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'apiSecret': apiSecret, -'from': from, - + 'enabled': enabled, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteProvider({required String providerId}) async { + final String apiPath = '/messaging/providers/{providerId}'.replaceAll( + '{providerId}', + providerId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listProviderLogs({ + required String providerId, + List? queries, + }) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( + '{providerId}', + providerId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs({ + required String subscriberId, + List? queries, + }) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs' + .replaceAll('{subscriberId}', subscriberId); - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.LogList.fromMap(res.data); - - } + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({List? queries, String? search}) async { - final String apiPath = '/messaging/topics'; + Future listTopics({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'subscribe': subscribe, - + 'name': name, + 'subscribe': subscribe, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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}) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTopicLogs({ + required String topicId, + List? queries, + }) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( + '{topicId}', + topicId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); + Future listSubscribers({ + required String topicId, + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( + '{topicId}', + topicId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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 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); - - 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; - - } -} \ No newline at end of file + 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 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/sites.dart b/lib/services/sites.dart index 5481986e..d89f2192 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,247 +1,296 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.Adapter? adapter, + String? installationId, + String? fallbackFile, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites'; final Map apiParams = { - 'siteId': siteId, -'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime.value, -'adapter': adapter?.value, -'installationId': installationId, -'fallbackFile': fallbackFile, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime.value, + 'adapter': adapter?.value, + 'installationId': installationId, + 'fallbackFile': fallbackFile, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.BuildRuntime? buildRuntime, + enums.Adapter? adapter, + String? fallbackFile, + String? installationId, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime?.value, -'adapter': adapter?.value, -'fallbackFile': fallbackFile, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime?.value, + 'adapter': adapter?.value, + 'fallbackFile': fallbackFile, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + Future delete({required String siteId}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateSiteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployment'.replaceAll( + '{siteId}', + siteId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future listDeployments({ + required String siteId, + List? queries, + String? search, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future createDeployment({ + required String siteId, + required InputFile code, + required bool activate, + String? installCommand, + String? buildCommand, + String? outputDirectory, + Function(UploadProgress)? onProgress, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'code': code, -'activate': activate, - + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -256,331 +305,400 @@ 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, + 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 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String siteId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll('{siteId}', siteId); + Future createVcsDeployment({ + required String siteId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - 'queries': queries, + Future listLogs({ + required String siteId, + List? queries, + }) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll( + '{siteId}', + siteId, + ); - - }; + final Map apiParams = {'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.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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ccdce915..ee630883 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,184 +1,226 @@ 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}) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({ + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { - 'bucketId': bucketId, -'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'name': name, + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) 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, + }) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { - 'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteBucket({required String bucketId}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); + Future listFiles({ + required String bucketId, + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'permissions': permissions, - + 'file': file, + 'permissions': permissions, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -194,137 +236,187 @@ 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 = { - 'name': name, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 = { 'width': width, -'height': height, -'gravity': gravity?.value, -'quality': quality, -'borderWidth': borderWidth, -'borderColor': borderColor, -'borderRadius': borderRadius, -'opacity': opacity, -'rotation': rotation, -'background': background, -'output': output?.value, -'token': token, - - + 'height': height, + 'gravity': gravity?.value, + 'quality': quality, + 'borderWidth': borderWidth, + 'borderColor': borderColor, + 'borderRadius': borderRadius, + 'opacity': opacity, + 'rotation': rotation, + 'background': background, + 'output': output?.value, + '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 = { '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 6a007ccd..f9d86004 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1162 +1,1520 @@ 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}) async { - final String apiPath = '/tablesdb'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, required String name, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + Future listTables({ + required String databaseId, + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'tableId': tableId, -'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future updateTable({ + required String databaseId, + required String tableId, + required String name, + List? permissions, + bool? rowSecurity, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteTable({ + required String databaseId, + required String tableId, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listColumns({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - /// - 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); + /// + 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - /// - 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); + /// + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + 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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + 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 apiHeaders = {'content-type': 'application/json'}; + + 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listIndexes({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'columns': columns, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + 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 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); - - 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; - - } + 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 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRow({required String databaseId, required String tableId, required String rowId, required Map data, List? permissions}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'rowId': rowId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + Future createRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - /// - Future upsertRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future upsertRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future updateRows({ + required String databaseId, + required String tableId, + Map? data, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + Future deleteRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future getRow({ + required String databaseId, + required String tableId, + required String rowId, + List? queries, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future upsertRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - 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; - - } + Future deleteRow({ + required String databaseId, + required String tableId, + required String rowId, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future decrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? min, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future incrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? max, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.patch, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); return models.Row.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/teams.dart b/lib/services/teams.dart index c21a93af..5fd59641 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,140 +1,147 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'roles': roles, - + 'name': name, + 'roles': roles, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - 'name': name, + 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 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); + Future listMemberships({ + required String teamId, + List? queries, + String? search, + }) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll( + '{teamId}', + teamId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 @@ -142,182 +149,210 @@ 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 = { - 'email': email, -'userId': userId, -'phone': phone, -'roles': roles, -'url': url, -'name': name, - + 'userId': userId, + 'phone': phone, + 'roles': roles, + 'url': url, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - 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); + /// + 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, + ); 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index cb04449b..4e6915dc 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,109 +1,113 @@ 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}) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future list({ + required String bucketId, + required String fileId, + List? queries, + }) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); + + final Map apiParams = {'queries': queries}; + + final Map 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); - - 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); + 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, + ); 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); - - final Map apiParams = { - - 'expire': expire, + 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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String tokenId}) async { + final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/users.dart b/lib/services/users.dart index 77d11d61..eda483bb 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,314 +1,359 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'password': password, -'name': name, - + 'email': email, + 'phone': phone, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/users/identities'; + Future listIdentities({ + List? queries, + String? search, + }) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordCpu': passwordCpu, + 'passwordMemory': passwordMemory, + 'passwordParallel': passwordParallel, + 'passwordLength': passwordLength, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordSaltSeparator': passwordSaltSeparator, + 'passwordSignerKey': passwordSignerKey, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'passwordVersion': passwordVersion?.value, -'name': name, - + 'email': email, + 'password': password, + 'passwordVersion': passwordVersion?.value, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -316,782 +361,909 @@ 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); 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 = { - 'sessionId': sessionId, -'duration': duration, - + 'duration': duration, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// Get the user activity logs list by its unique ID. - Future listLogs({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listLogs({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/logs'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); + Future listMemberships({ + required String userId, + List? queries, + String? search, + }) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll( + '{userId}', + userId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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); - - 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); + @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, + ); 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 apiParams = {'mfa': mfa}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @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 apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + Future updateMFARecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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 apiHeaders = {'content-type': 'application/json'}; + + 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 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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 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 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; - - } + 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); - - final Map apiParams = { - - - }; + Future deleteSession({ + required String userId, + required String sessionId, + }) async { + final String apiPath = '/users/{userId}/sessions/{sessionId}' + .replaceAll('{userId}', userId) + .replaceAll('{sessionId}', sessionId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// List the messaging targets that are associated with a user. - Future listTargets({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/targets'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, -'providerId': providerId, -'name': name, - + 'providerType': providerType.value, + 'identifier': identifier, + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'identifier': identifier, -'providerId': providerId, -'name': name, - + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteTarget({ + required String userId, + required String targetId, + }) async { + final String apiPath = '/users/{userId}/targets/{targetId}' + .replaceAll('{userId}', userId) + .replaceAll('{targetId}', targetId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'length': length, -'expire': expire, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future createToken({ + required String userId, + int? length, + int? expire, + }) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'length': length, 'expire': expire}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/src/client.dart b/lib/src/client.dart index 0d9be210..d82d623a 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,7 +81,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 cd82d264..08d93b85 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,21 +2,25 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index ea2cd62a..c961873f 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,14 +9,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => +ClientBase createClient({required String endPoint, required bool selfSigned}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -34,59 +31,66 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format' : '1.8.0', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -135,7 +139,11 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -162,12 +170,19 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index f9e695bf..2bd7d639 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,17 +10,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => - ClientIO( - endPoint: endPoint, - selfSigned: selfSigned, - ); +ClientBase createClient({required String endPoint, required bool selfSigned}) => + ClientIO(endPoint: endPoint, selfSigned: selfSigned); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -43,60 +37,68 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format' : '1.8.0', + 'user-agent': + 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -151,11 +153,16 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, file.path!, - filename: file.filename); + paramName, + file.path!, + filename: file.filename, + ); } else { - 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, @@ -194,12 +201,19 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -244,10 +258,7 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse( - res, - responseType: responseType, - ); + return prepareResponse(res, responseType: responseType); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 658b79b6..06c9ebe3 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest) - .fields - .addAll({"$key[$i]": v.toString()}); + (request as http.MultipartRequest).fields.addAll({ + "$key[$i]": v.toString(), + }); }); } else { - (request as http.MultipartRequest) - .fields - .addAll({key: value.toString()}); + (request as http.MultipartRequest).fields.addAll({ + key: value.toString(), + }); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value){ + params = params.map((key, value) { if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,12 +51,13 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port, + ); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -66,7 +67,9 @@ 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); @@ -113,18 +116,25 @@ 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.dart b/lib/src/enums.dart index 595afdc2..0f250ea3 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes + bytes, } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 2f198d4e..3341912f 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 cd45b6a1..1bae5c8a 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 7d2d7016..42954430 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,18 +1,16 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 af5ebaad..e20f48c6 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,26 +1,24 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index 8d86530d..b101d35f 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({ - required this.value - }); + const IndexType({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/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/name.dart b/lib/src/enums/name.dart index 613bf5f1..74823feb 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,24 +1,22 @@ 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'), - 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'), + 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 076c1c50..383e45b1 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,52 +1,50 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d34440ec..d4fef930 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index 0bf8e2ad..f01fcb01 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({ - required this.value - }); + const VCSDeploymentType({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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index f174d569..4145f701 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 c9f67200..4e901476 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 2fabb416..35c7b767 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index fdcee07a..7d27adba 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index 120723df..fec6f65a 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 504b5f8f..0e80700f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 5f3e1654..bae6618f 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 20dd7189..0ca54691 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a5b27b4f..1df01f19 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 96ce554b..21f8e9a3 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a4953a0e..298c181a 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 03ba94c7..c6eecadd 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8a5aa89d..1ef48332 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 d17f414a..8c8fcb73 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index 4098a5a1..c5fa6adc 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "attributes": attributes, - }; - } + Map toMap() { + return {"total": total, "attributes": attributes}; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 050cbe14..903c6290 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 2202d255..7374fa78 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index 0c3ddf9e..f0bc295e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index 3bb374be..b8fb5e48 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index b02adbf6..66e58c20 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "buckets": buckets.map((p) => p.toMap()).toList(), - }; - } + 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 c55110cf..72de429d 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 240e2ce0..5322aaab 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index b7ce71b8..9d5013c0 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 df80cfbb..2341fc3b 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a92a0a5b..a822c4e5 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 9605a6a9..115108a4 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 200e2c78..a3a4e3b7 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 acf0f6df..9d637d92 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 576937e7..a7983a62 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,28 +2,24 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 5ba4e70b..82bf6734 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 e0be4633..13bb322c 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 475c1c40..8eb0171f 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "columns": columns, - }; - } + Map toMap() { + return {"total": total, "columns": columns}; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index e55d1534..6221c01e 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6fd6a3b0..7b560989 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 94271aa6..66c0ce7b 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 1a9c5038..7318b7ad 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 5e954a05..ec2c0755 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 565b1d66..c52b50f2 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,28 +2,19 @@ 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()); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 073fa251..65e13be3 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 deafffe3..27eef0c1 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 1c99fdf9..7a957f1a 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 cab95b02..8d79e052 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 5eb5c0ce..5afa7932 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 ecf7e791..448c62c7 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 78ba8ab2..df81710a 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index be424a9c..cf85e457 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 d45ea081..4065e17b 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,31 +2,30 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 809106a9..8dfbeab6 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,124 +2,128 @@ 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 String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "deploymentId": deploymentId, - "trigger": trigger, - "status": status, - "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 String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "deploymentId": deploymentId, + "trigger": trigger, + "status": status, + "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 d44139ee..4ed73943 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 de8439ec..a6a9fa46 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 94ea9a14..63f49abc 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "files": files.map((p) => p.toMap()).toList(), - }; - } + 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 ea6b601a..693c9b07 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,46 +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))), - ); - } - - 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)), + ), + ); + } + + 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 7614616a..0b908240 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 afe8f6b3..eb8145d4 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 64401c3f..56c2eded 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index d5974f55..34d7225c 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,28 +2,25 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 ecf0a178..463cf696 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "value": value, - }; - } + Map toMap() { + return {"name": name, "value": value}; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index 54c31e70..fa402e97 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "version": version, - "status": status, - }; - } + Map toMap() { + return {"version": version, "status": status}; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index 0a5b6ce9..d412eba9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 95da1235..5f06906b 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,22 +2,16 @@ 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']); + } - Map toMap() { - return { - "size": size, - }; - } + Map toMap() { + return {"size": size}; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 0d6e7216..59b7092c 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,34 +2,26 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "name": name, - "ping": ping, - "status": status, - }; - } + Map toMap() { + return {"name": name, "ping": ping, "status": status}; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index 102dfe77..dec2d54f 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,34 +2,30 @@ 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'], + ); + } - Map toMap() { - return { - "remoteTime": remoteTime, - "localTime": localTime, - "diff": diff, - }; - } + Map toMap() { + return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index c43c4d57..807bdfd0 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 b8358fc1..b4c63f7d 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 b6717c4e..9d6d7aec 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 fef735fc..6d285a6a 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 1b4ff7de..490a1824 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "jwt": jwt, - }; - } + Map toMap() { + return {"jwt": jwt}; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 43eaad08..9c45adb1 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,34 +2,26 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - "nativeName": nativeName, - }; - } + 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 ea731471..2e65839e 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 b5e9ad1a..084475bf 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 10499ef5..cd5a1155 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "name": name, - }; - } + 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 c1243e06..be6ddb1f 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 cb567bd7..7fb3f364 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 9d4d7701..22273a8c 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "logs": logs.map((p) => p.toMap()).toList(), - }; - } + 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 26610e46..8ee142ad 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index f08f5738..a4d39dca 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 c4e9e858..9b93b00d 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index acaacc34..15ddf642 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 46c166fb..96bf3c65 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 d49989d8..c930a23e 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 6c8b4e36..63411988 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,22 +2,18 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "recoveryCodes": recoveryCodes, - }; - } + Map toMap() { + return {"recoveryCodes": recoveryCodes}; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index 01cf0857..fa57cb8b 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "secret": secret, - "uri": uri, - }; - } + Map toMap() { + return {"secret": secret, "uri": uri}; + } } 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/phone.dart b/lib/src/models/phone.dart index c8bbb95b..40f7bcd2 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 2d869308..879edbc4 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "phones": phones.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index edb6083e..7bc3abc9 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,23 +2,17 @@ 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, - ); - } + factory Preferences.fromMap(Map map) { + return Preferences(data: map); + } - Map toMap() { - return { - "data": data, - }; - } + 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/provider.dart b/lib/src/models/provider.dart index 4295c486..1a762f85 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 9710aea9..9347fefb 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index ed520cc4..dad35dcc 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 fcdabb97..2283653f 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,28 +2,24 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "tokens": tokens.map((p) => p.toMap()).toList(), - }; - } + 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 62e69e5b..3700e577 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 a8374e2b..01f046c6 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,31 +2,25 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "rows": rows.map((p) => p.toMap()).toList(), - }; - } + 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 35f82cfa..7c9677d8 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 c234990c..64bc2e08 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 3a1d955f..d2fe4f64 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 0257cb86..e9c478af 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 5cda6acc..1449f8bd 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index cc9e4355..e74b0d81 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "sites": sites.map((p) => p.toMap()).toList(), - }; - } + 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 e49d399c..e8fb8c75 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,40 +2,35 @@ 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(), + ); + } - Map toMap() { - return { - "memory": memory, - "cpus": cpus, - "enabled": enabled, - "slug": slug, - }; - } + 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 0d2b6a73..de4957d2 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 36e18a7e..0c926297 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 6c8c21e2..6a135b92 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 1c5b88fb..7ce86b9d 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,76 +2,78 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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)), + ), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 2b4b4b41..ebe15c71 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "tables": tables.map((p) => p.toMap()).toList(), - }; - } + 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 f2b3b6b4..4be8b545 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 6ef2725d..84233d1d 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "targets": targets.map((p) => p.toMap()).toList(), - }; - } + 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 e9058b5b..43df33a8 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 a61cc9f7..a3994c06 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "teams": teams.map((p) => p.toMap()).toList(), - }; - } + 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 4f6b8454..35115467 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 461d5694..430d44ac 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 1582a3c7..eefc62b6 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "topics": topics.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index effc397c..50bfb3ce 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index edf7a95d..2419d818 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "users": users.map((p) => p.toMap()).toList(), - }; - } + 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 58882a9f..2a8e276a 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 ee1f6f7a..ffa58eef 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } From 3c70f5baa518f24250cc64a032259bcf44bc0073 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 25 Aug 2025 17:06:49 +1200 Subject: [PATCH 19/22] Fix filepath --- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/dart_appwrite.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1471 ++++++------ lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 +++++++---------- lib/services/functions.dart | 869 +++---- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 ++--- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 2260 ++++++++----------- lib/services/sites.dart | 822 +++---- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 ++++++--------- lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1582 ++++++------- lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 244 +- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 +-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 +-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 +-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +-- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 165 files changed, 11464 insertions(+), 13097 deletions(-) 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 372b0dcf..72488b83 100644 --- a/lib/dart_appwrite.dart +++ b/lib/dart_appwrite.dart @@ -37,7 +37,7 @@ part 'services/locale.dart'; part 'services/messaging.dart'; part 'services/sites.dart'; part 'services/storage.dart'; -part 'services/tables-d-b.dart'; +part 'services/tables_db.dart'; part 'services/teams.dart'; part 'services/tokens.dart'; part 'services/users.dart'; diff --git a/lib/query.dart b/lib/query.dart index c9a2fc91..281aa756 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if (attribute != null) { + if(attribute != null) { map['attribute'] = attribute; } - - if (values != null) { + + if(values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} +} \ 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 d0c820a1..9225f30a 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,26 +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 @@ -29,32 +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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -63,674 +60,661 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 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; - } + 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() async { - final String apiPath = '/account/jwts'; + Future createJWT() async { + final String apiPath = '/account/jwts'; + + final Map apiParams = { + + + }; - final Map apiParams = {}; + final Map apiHeaders = { + 'content-type': 'application/json', - 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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 apiParams = { + + 'mfa': mfa, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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 apiParams = { + + 'otp': otp, + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiParams = { + + 'otp': otp, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - 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 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; - } + 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/challenge'; - - 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, - ); + @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/challenge'; + + 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); 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/challenge'; + Future createMFAChallenge({required enums.AuthenticationFactor factor}) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = {'factor': factor.value}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/challenge'; + @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/challenge'; final Map apiParams = { + 'challengeId': challengeId, - 'otp': otp, +'otp': otp, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/challenge'; + Future updateMFAChallenge({required String challengeId, required String otp}) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { + 'challengeId': challengeId, - 'otp': otp, +'otp': otp, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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 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 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 apiParams = {'name': name}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'oldPassword': oldPassword, +'oldPassword': oldPassword, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 apiParams = {'prefs': prefs}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -740,98 +724,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}; + final Map apiParams = { + + 'email': email, +'url': url, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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; - 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 @@ -840,212 +825,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 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 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.') - Future updateMagicURLSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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.') - Future updatePhoneSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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; - 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 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 @@ -1056,35 +1042,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, - 'phrase': phrase, +'email': email, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -1095,79 +1078,66 @@ 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, - 'url': url, - 'phrase': phrase, +'email': email, +'url': url, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { 'success': success, - 'failure': failure, - 'scopes': scopes, +'failure': failure, +'scopes': scopes, + 'project': client.config['project'], }; 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), - ); + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -1175,16 +1145,15 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri( - scheme: endpoint.scheme, + Uri url = Uri(scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&'), + 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 @@ -1192,29 +1161,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}; + final Map apiParams = { + + 'userId': userId, +'phone': phone, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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** @@ -1225,52 +1195,56 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'url': url}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 updateVerification({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/verification'; + Future updateVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 @@ -1280,44 +1254,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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/verification/phone'; + Future updatePhoneVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification/phone'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiParams = {'userId': userId, 'secret': secret}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index 8033f1cd..a91d6d3f 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,255 +1,189 @@ 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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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, - 'width': width, - 'height': height, +'width': width, +'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 = { 'name': name, - 'width': width, - 'height': height, - 'background': background, +'width': width, +'height': height, +'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, - 'size': size, - 'margin': margin, - 'download': download, +'size': size, +'margin': margin, +'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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 223f1318..f962d8b3 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1682 +1,1215 @@ 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, - }) 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}) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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.createDatabase` 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.createDatabase` instead.') + Future create({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases'; final Map apiParams = { + 'databaseId': databaseId, - 'name': name, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/databases/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.') + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'collectionId': collectionId, - 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - List? permissions, - bool? documentSecurity, - bool? enabled, - }) 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + @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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + @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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return 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/{key}/relationship' - .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/{key}/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'onDelete': onDelete?.value, - 'newKey': newKey, +'newKey': newKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'documentId': documentId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - required Map data, - List? permissions, - }) 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, required Map data, List? permissions}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - 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; - } + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'attributes': attributes, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 index by 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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); - - 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; - } -} + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/functions.dart b/lib/services/functions.dart index e86f1afe..05a7d5f7 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,316 +1,256 @@ 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, - }) async { - final String apiPath = '/functions'; + Future list({List? queries, String? search}) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? specification, - }) 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? specification}) async { + final String apiPath = '/functions'; final Map apiParams = { + 'functionId': functionId, - 'name': name, - 'runtime': runtime.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'name': name, +'runtime': runtime.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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? specification, - }) 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? specification}) async { + final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'name': name, - 'runtime': runtime?.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'runtime': runtime?.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll( - '{functionId}', - functionId, - ); + Future listDeployments({required String functionId, List? queries, String? search}) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 = { + 'entrypoint': entrypoint, - 'commands': commands, - 'code': code, - 'activate': activate, +'commands': commands, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -325,446 +265,361 @@ 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, - 'buildId': buildId, +'buildId': buildId, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String functionId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/functions/{functionId}/deployments/template'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll( - '{functionId}', - functionId, - ); + Future createVcsDeployment({required String functionId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll( - '{functionId}', - functionId, - ); + Future listExecutions({required String functionId, List? queries}) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 = { + 'body': body, - 'async': xasync, - 'path': path, - 'method': method?.value, - 'headers': headers, - 'scheduledAt': scheduledAt, +'async': xasync, +'path': path, +'method': method?.value, +'headers': headers, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index 18eb54f1..e2418b52 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,49 +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 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; - 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 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/health.dart b/lib/services/health.dart index 5250c91d..0cf64ac6 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,414 +1,438 @@ 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.HealthStatus.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 = {'domain': domain}; + final Map apiParams = { + 'domain': domain, - 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.HealthCertificate.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.HealthStatus.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.HealthStatus.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = { + 'threshold': threshold, - final Map apiParams = {'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 = { 'name': name, - 'threshold': threshold, +'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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, - ); - - final Map apiParams = {'threshold': threshold}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future getFailedJobs({required enums.Name name, int? threshold}) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll('{name}', name.value); + + final Map apiParams = { + 'threshold': threshold, + + + }; + + final Map 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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 @@ -417,20 +441,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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 4d3cc3e0..430a00c3 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,164 +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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index bf5376e5..23551577 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1805 +1,1393 @@ 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, - }) async { - final String apiPath = '/messaging/messages'; + Future listMessages({List? queries, String? search}) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'cc': cc, - 'bcc': bcc, - 'attachments': attachments, - 'draft': draft, - 'html': html, - 'scheduledAt': scheduledAt, +'subject': subject, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'cc': cc, +'bcc': bcc, +'attachments': attachments, +'draft': draft, +'html': html, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'title': title, - 'body': body, - 'topics': topics, - 'users': users, - 'targets': targets, - '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.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'title': title, +'body': body, +'topics': topics, +'users': users, +'targets': targets, +'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.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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'draft': draft, - 'scheduledAt': scheduledAt, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'draft': draft, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'draft': draft, - 'scheduledAt': scheduledAt, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'draft': draft, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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 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; - return res.data; - } + } /// Get the message activity logs listed by its unique ID. - Future listMessageLogs({ - required String messageId, - List? queries, - }) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listMessageLogs({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/providers'; + Future listProviders({List? queries, String? search}) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, - 'enabled': enabled, +'name': name, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, - 'enabled': enabled, +'name': name, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, +'enabled': enabled, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, +'enabled': enabled, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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 = { + 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'enabled': enabled, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'enabled': enabled, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, - 'enabled': enabled, +'name': name, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, +'enabled': enabled, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'enabled': enabled, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 = { + 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 = { + 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'from': from, - 'customerId': customerId, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'customerId': customerId, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'customerId': customerId, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'customerId': customerId, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'username': username, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'username': username, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'username': username, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'username': username, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'accountSid': accountSid, - 'authToken': authToken, - 'enabled': enabled, +'name': name, +'from': from, +'accountSid': accountSid, +'authToken': authToken, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'accountSid': accountSid, - 'authToken': authToken, - 'from': from, +'enabled': enabled, +'accountSid': accountSid, +'authToken': authToken, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'enabled': enabled, +'name': name, +'from': from, +'apiKey': apiKey, +'apiSecret': apiSecret, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'from': from, +'enabled': enabled, +'apiKey': apiKey, +'apiSecret': apiSecret, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } + } /// Get the provider activity logs listed by its unique ID. - Future listProviderLogs({ - required String providerId, - List? queries, - }) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( - '{providerId}', - providerId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listProviderLogs({required String providerId, List? queries}) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs' - .replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs({required String subscriberId, List? queries}) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + '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.LogList.fromMap(res.data); - } + + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({ - List? queries, - String? search, - }) async { - final String apiPath = '/messaging/topics'; + Future listTopics({List? queries, String? search}) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'subscribe': subscribe, +'name': name, +'subscribe': subscribe, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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; - return res.data; - } + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs({ - required String topicId, - List? queries, - }) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( - '{topicId}', - topicId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTopicLogs({required String topicId, List? queries}) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( - '{topicId}', - topicId, - ); + Future listSubscribers({required String topicId, List? queries, String? search}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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 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); - - 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; - } -} + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/sites.dart b/lib/services/sites.dart index d89f2192..5481986e 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,296 +1,247 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? outputDirectory, - enums.Adapter? adapter, - String? installationId, - String? fallbackFile, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites'; final Map apiParams = { + 'siteId': siteId, - 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime.value, - 'adapter': adapter?.value, - 'installationId': installationId, - 'fallbackFile': fallbackFile, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime.value, +'adapter': adapter?.value, +'installationId': installationId, +'fallbackFile': fallbackFile, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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? outputDirectory, - enums.BuildRuntime? buildRuntime, - enums.Adapter? adapter, - String? fallbackFile, - String? installationId, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime?.value, - 'adapter': adapter?.value, - 'fallbackFile': fallbackFile, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime?.value, +'adapter': adapter?.value, +'fallbackFile': fallbackFile, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future listDeployments({required String siteId, List? queries, String? search}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({ - required String siteId, - required InputFile code, - required bool activate, - String? installCommand, - String? buildCommand, - String? outputDirectory, - Function(UploadProgress)? onProgress, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'code': code, - 'activate': activate, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -305,400 +256,331 @@ 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String siteId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll( - '{siteId}', - siteId, - ); + Future createVcsDeployment({required String siteId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll( - '{siteId}', - siteId, - ); + Future listLogs({required String siteId, List? queries}) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ee630883..ccdce915 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,226 +1,184 @@ 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, - }) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({List? queries, String? search}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { + 'bucketId': bucketId, - 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'name': name, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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, - }) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( - '{bucketId}', - bucketId, - ); + Future listFiles({required String bucketId, List? queries, String? search}) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'permissions': permissions, +'file': file, +'permissions': permissions, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -236,187 +194,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 = { + 'name': name, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 = { 'width': width, - 'height': height, - 'gravity': gravity?.value, - 'quality': quality, - 'borderWidth': borderWidth, - 'borderColor': borderColor, - 'borderRadius': borderRadius, - 'opacity': opacity, - 'rotation': rotation, - 'background': background, - 'output': output?.value, - 'token': token, - +'height': height, +'gravity': gravity?.value, +'quality': quality, +'borderWidth': borderWidth, +'borderColor': borderColor, +'borderRadius': borderRadius, +'opacity': opacity, +'rotation': rotation, +'background': background, +'output': output?.value, +'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 = { '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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index f9d86004..6a007ccd 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1520 +1,1162 @@ 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, - }) async { - final String apiPath = '/tablesdb'; + Future list({List? queries, String? search}) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( - '{databaseId}', - databaseId, - ); + Future listTables({required String databaseId, List? queries, String? search}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createTable({ - required String databaseId, - required String tableId, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'tableId': tableId, - 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future updateTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - return res.data; - } + } /// List columns in the table. - Future listColumns({ - required String databaseId, - required String tableId, - List? queries, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listColumns({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + 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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listIndexes({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'columns': columns, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + 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 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); - - 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; - } + 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 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRow({ - required String databaseId, - required String tableId, - required String rowId, - required Map data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'rowId': rowId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future createRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - /// - Future upsertRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future upsertRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future updateRows({required String databaseId, required String tableId, Map? data, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future deleteRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future getRow({required String databaseId, required String tableId, required String rowId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future upsertRow({ - required String databaseId, - required String tableId, - required String rowId, - Map? data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - 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; - } + Future deleteRow({required String databaseId, required String tableId, required String rowId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future decrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? min}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future incrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? max}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/teams.dart b/lib/services/teams.dart index 5fd59641..c21a93af 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,147 +1,140 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'roles': roles, +'name': name, +'roles': roles, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiParams = {'name': name}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - 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, - }) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll( - '{teamId}', - teamId, - ); + Future listMemberships({required String teamId, List? queries, String? search}) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 @@ -149,210 +142,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 = { + 'email': email, - 'userId': userId, - 'phone': phone, - 'roles': roles, - 'url': url, - 'name': name, +'userId': userId, +'phone': phone, +'roles': roles, +'url': url, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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, - ); + /// + 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); 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 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; - 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); - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index 4e6915dc..cb04449b 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,113 +1,109 @@ 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, - }) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future list({required String bucketId, required String fileId, List? queries}) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); - - 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, - ); + 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); 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 apiParams = {'expire': expire}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/users.dart b/lib/services/users.dart index eda483bb..77d11d61 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,359 +1,314 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'password': password, - 'name': name, +'email': email, +'phone': phone, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = '/users/identities'; + Future listIdentities({List? queries, String? search}) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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; - 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordCpu': passwordCpu, +'passwordMemory': passwordMemory, +'passwordParallel': passwordParallel, +'passwordLength': passwordLength, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordSaltSeparator': passwordSaltSeparator, +'passwordSignerKey': passwordSignerKey, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'passwordVersion': passwordVersion?.value, - 'name': name, +'email': email, +'password': password, +'passwordVersion': passwordVersion?.value, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -361,909 +316,782 @@ 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 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; - 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, - ); - - 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, - ); + 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); 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 = { + 'sessionId': sessionId, - 'duration': duration, +'duration': duration, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// Get the user activity logs list by its unique ID. - Future listLogs({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/logs'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listLogs({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll( - '{userId}', - userId, - ); + Future listMemberships({required String userId, List? queries, String? search}) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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); - - 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, - ); + @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); 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 apiParams = { + + 'mfa': mfa, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } + + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll( - '{userId}', - userId, - ); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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 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 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; - } + 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 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; - 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// List the messaging targets that are associated with a user. - Future listTargets({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/targets'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - 'providerId': providerId, - 'name': name, +'providerType': providerType.value, +'identifier': identifier, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'identifier': identifier, - 'providerId': providerId, - 'name': name, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - 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, - ); - - final Map apiParams = {'length': length, 'expire': expire}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future createToken({required String userId, int? length, int? expire}) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll('{userId}', userId); + + final Map apiParams = { + + 'length': length, +'expire': expire, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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); - } -} + + } +} \ No newline at end of file diff --git a/lib/src/client.dart b/lib/src/client.dart index d82d623a..0d9be210 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,8 +81,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 08d93b85..cd82d264 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,25 +2,21 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index c961873f..ea2cd62a 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,11 +9,14 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -31,66 +34,59 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format': '1.8.0', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -139,11 +135,7 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -170,19 +162,12 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 2bd7d639..f9e695bf 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,11 +10,17 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => - ClientIO(endPoint: endPoint, selfSigned: selfSigned); +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => + ClientIO( + endPoint: endPoint, + selfSigned: selfSigned, + ); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -37,68 +43,60 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent': - 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format': '1.8.0', + 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -153,16 +151,11 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, - file.path!, - filename: file.filename, - ); + paramName, file.path!, + filename: file.filename); } else { - 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, @@ -201,19 +194,12 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -258,7 +244,10 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse(res, responseType: responseType); + return prepareResponse( + res, + responseType: responseType, + ); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 06c9ebe3..658b79b6 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest).fields.addAll({ - "$key[$i]": v.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({"$key[$i]": v.toString()}); }); } else { - (request as http.MultipartRequest).fields.addAll({ - key: value.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({key: value.toString()}); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value) { + params = params.map((key, value){ if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,13 +51,12 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port, - ); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -67,9 +66,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); @@ -116,25 +113,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.dart b/lib/src/enums.dart index 0f250ea3..595afdc2 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes, + bytes } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 3341912f..2f198d4e 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 1bae5c8a..cd45b6a1 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 42954430..7d2d7016 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,16 +1,18 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 e20f48c6..af5ebaad 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,24 +1,26 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index b101d35f..8d86530d 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({required this.value}); + const IndexType({ + 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/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/name.dart b/lib/src/enums/name.dart index 74823feb..613bf5f1 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,22 +1,24 @@ 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'), - 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'), + 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 383e45b1..076c1c50 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,50 +1,52 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d4fef930..d34440ec 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index f01fcb01..0bf8e2ad 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({required this.value}); + const VCSDeploymentType({ + 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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index 4145f701..f174d569 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 4e901476..c9f67200 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 35c7b767..2fabb416 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index 7d27adba..fdcee07a 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index fec6f65a..120723df 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 0e80700f..504b5f8f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 bae6618f..5f3e1654 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 0ca54691..20dd7189 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1df01f19..a5b27b4f 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 21f8e9a3..96ce554b 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 298c181a..a4953a0e 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c6eecadd..03ba94c7 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1ef48332..8a5aa89d 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8c8fcb73..d17f414a 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index c5fa6adc..4098a5a1 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "attributes": attributes}; - } + Map toMap() { + return { + "total": total, + "attributes": attributes, + }; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 903c6290..050cbe14 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7374fa78..2202d255 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index f0bc295e..0c3ddf9e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index b8fb5e48..3bb374be 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 66e58c20..b02adbf6 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "buckets": buckets.map((p) => p.toMap()).toList()}; - } + 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 72de429d..c55110cf 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 5322aaab..240e2ce0 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 9d5013c0..b7ce71b8 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 2341fc3b..df80cfbb 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a822c4e5..a92a0a5b 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 115108a4..9605a6a9 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a3a4e3b7..200e2c78 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 9d637d92..acf0f6df 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 a7983a62..576937e7 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,24 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 82bf6734..5ba4e70b 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 13bb322c..e0be4633 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 8eb0171f..475c1c40 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "columns": columns}; - } + Map toMap() { + return { + "total": total, + "columns": columns, + }; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index 6221c01e..e55d1534 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7b560989..6fd6a3b0 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 66c0ce7b..94271aa6 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 7318b7ad..1a9c5038 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index ec2c0755..5e954a05 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 c52b50f2..565b1d66 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,19 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 65e13be3..073fa251 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 27eef0c1..deafffe3 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 7a957f1a..1c99fdf9 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 8d79e052..cab95b02 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 5afa7932..5eb5c0ce 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 448c62c7..ecf7e791 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index df81710a..78ba8ab2 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index cf85e457..be424a9c 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 4065e17b..d45ea081 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,30 +2,31 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 8dfbeab6..809106a9 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,128 +2,124 @@ 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 String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "deploymentId": deploymentId, - "trigger": trigger, - "status": status, - "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 String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "deploymentId": deploymentId, + "trigger": trigger, + "status": status, + "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 4ed73943..d44139ee 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 a6a9fa46..de8439ec 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 63f49abc..94ea9a14 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "files": files.map((p) => p.toMap()).toList()}; - } + 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 693c9b07..ea6b601a 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,48 +2,46 @@ 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)), - ), - ); - } - - 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))), + ); + } + + 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 0b908240..7614616a 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 eb8145d4..afe8f6b3 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 56c2eded..64401c3f 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index 34d7225c..d5974f55 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,25 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 463cf696..ecf0a178 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "value": value}; - } + Map toMap() { + return { + "name": name, + "value": value, + }; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index fa402e97..54c31e70 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return {"version": version, "status": status}; - } + Map toMap() { + return { + "version": version, + "status": status, + }; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index d412eba9..0a5b6ce9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5f06906b..95da1235 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,16 +2,22 @@ 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'], + ); + } - Map toMap() { - return {"size": size}; - } + Map toMap() { + return { + "size": size, + }; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 59b7092c..0d6e7216 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,26 +2,34 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return {"name": name, "ping": ping, "status": status}; - } + Map toMap() { + return { + "name": name, + "ping": ping, + "status": status, + }; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index dec2d54f..102dfe77 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,30 +2,34 @@ 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'], + ); + } - Map toMap() { - return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; - } + Map toMap() { + return { + "remoteTime": remoteTime, + "localTime": localTime, + "diff": diff, + }; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index 807bdfd0..c43c4d57 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 b4c63f7d..b8358fc1 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 9d6d7aec..b6717c4e 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 6d285a6a..fef735fc 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 490a1824..1b4ff7de 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"jwt": jwt}; - } + Map toMap() { + return { + "jwt": jwt, + }; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 9c45adb1..43eaad08 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,26 +2,34 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code, "nativeName": nativeName}; - } + 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 2e65839e..ea731471 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 084475bf..b5e9ad1a 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 cd5a1155..10499ef5 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"code": code, "name": name}; - } + 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 be6ddb1f..c1243e06 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 7fb3f364..cb567bd7 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 22273a8c..9d4d7701 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "logs": logs.map((p) => p.toMap()).toList()}; - } + 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 8ee142ad..26610e46 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index a4d39dca..f08f5738 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 9b93b00d..c4e9e858 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index 15ddf642..acaacc34 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 96bf3c65..46c166fb 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 c930a23e..d49989d8 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 63411988..6c8b4e36 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,18 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"recoveryCodes": recoveryCodes}; - } + Map toMap() { + return { + "recoveryCodes": recoveryCodes, + }; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index fa57cb8b..01cf0857 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"secret": secret, "uri": uri}; - } + Map toMap() { + return { + "secret": secret, + "uri": uri, + }; + } } 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/phone.dart b/lib/src/models/phone.dart index 40f7bcd2..c8bbb95b 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 879edbc4..2d869308 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "phones": phones.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index 7bc3abc9..edb6083e 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,17 +2,23 @@ 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); - } + factory Preferences.fromMap(Map map) { + return Preferences( + data: map, + ); + } - Map toMap() { - return {"data": data}; - } + 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/provider.dart b/lib/src/models/provider.dart index 1a762f85..4295c486 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 9347fefb..9710aea9 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index dad35dcc..ed520cc4 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 2283653f..fcdabb97 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,24 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "tokens": tokens.map((p) => p.toMap()).toList()}; - } + 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 3700e577..62e69e5b 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 01f046c6..a8374e2b 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,25 +2,31 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "rows": rows.map((p) => p.toMap()).toList()}; - } + 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 7c9677d8..35f82cfa 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 64bc2e08..c234990c 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 d2fe4f64..3a1d955f 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 e9c478af..0257cb86 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 1449f8bd..5cda6acc 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index e74b0d81..cc9e4355 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "sites": sites.map((p) => p.toMap()).toList()}; - } + 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 e8fb8c75..e49d399c 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,35 +2,40 @@ 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(), + ); + } - Map toMap() { - return {"memory": memory, "cpus": cpus, "enabled": enabled, "slug": slug}; - } + 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 de4957d2..0d2b6a73 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 0c926297..36e18a7e 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 6a135b92..6c8c21e2 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 7ce86b9d..1c5b88fb 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,78 +2,76 @@ 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; - 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, - }); + 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, + }); - 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)), - ), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index ebe15c71..2b4b4b41 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "tables": tables.map((p) => p.toMap()).toList()}; - } + 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 4be8b545..f2b3b6b4 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 84233d1d..6ef2725d 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "targets": targets.map((p) => p.toMap()).toList()}; - } + 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 43df33a8..e9058b5b 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 a3994c06..a61cc9f7 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "teams": teams.map((p) => p.toMap()).toList()}; - } + 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 35115467..4f6b8454 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 430d44ac..461d5694 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 eefc62b6..1582a3c7 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "topics": topics.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index 50bfb3ce..effc397c 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 2419d818..edf7a95d 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "users": users.map((p) => p.toMap()).toList()}; - } + 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 2a8e276a..58882a9f 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 ffa58eef..ee1f6f7a 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } From 1cbb3fd2a3e48af8da5392fc164a50d3f372e2c6 Mon Sep 17 00:00:00 2001 From: abnegate Date: Mon, 25 Aug 2025 05:07:15 +0000 Subject: [PATCH 20/22] Commit from GitHub Actions (Format and push) --- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1471 ++++++------ lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 ++++++++++------- lib/services/functions.dart | 869 ++++--- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 +++-- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 2260 +++++++++++-------- lib/services/sites.dart | 822 ++++--- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 +++++++++------ lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1582 +++++++------ lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 244 +- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 +-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 +-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 +-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +-- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 164 files changed, 13096 insertions(+), 11463 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/query.dart b/lib/query.dart index 281aa756..c9a2fc91 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if(attribute != null) { + if (attribute != null) { map['attribute'] = attribute; } - - if(values != null) { + + if (values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} \ 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 9225f30a..d0c820a1 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,27 +1,26 @@ 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 +29,32 @@ 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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,661 +63,674 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = { - 'queries': queries, - - - }; + final Map apiParams = {'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.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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/account/identities/{identityId}'.replaceAll( + '{identityId}', + identityId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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() async { - final String apiPath = '/account/jwts'; - - final Map apiParams = { - - - }; + Future createJWT() async { + final String apiPath = '/account/jwts'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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.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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.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 apiParams = {'mfa': mfa}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + @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 apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future createMFAAuthenticator({ + required enums.AuthenticatorType type, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - 'otp': otp, - - }; + @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 apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - 'otp': otp, + 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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + @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 res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteMFAAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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/challenge'; - - 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); + @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/challenge'; + + 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, + ); 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/challenge'; + Future createMFAChallenge({ + required enums.AuthenticationFactor factor, + }) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = { - - 'factor': factor.value, + final Map apiParams = {'factor': factor.value}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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/challenge'; + @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/challenge'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/challenge'; + Future updateMFAChallenge({ + required String challengeId, + required String otp, + }) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 apiHeaders = { - 'content-type': 'application/json', + 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 apiHeaders = { - 'content-type': 'application/json', + 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 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 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'; - - final Map apiParams = { - - 'name': name, + Future updateName({required String name}) async { + final String apiPath = '/account/name'; - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'oldPassword': oldPassword, - + 'oldPassword': oldPassword, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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'; - - final Map apiParams = { - - 'prefs': prefs, - - }; + Future updatePrefs({required Map prefs}) async { + final String apiPath = '/account/prefs'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -724,99 +740,98 @@ 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'; - - final Map apiParams = { - - 'email': email, -'url': url, - - }; + Future createRecovery({ + required String email, + required String url, + }) async { + final String apiPath = '/account/recovery'; - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {'email': email, '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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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 @@ -825,213 +840,212 @@ 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'; - - final Map apiParams = { - - - }; + Future createAnonymousSession() async { + final String apiPath = '/account/sessions/anonymous'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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.') - Future updateMagicURLSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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.') - Future updatePhoneSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {'userId': userId, '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); - - final Map apiParams = { - - - }; + Future updateSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 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 @@ -1042,32 +1056,35 @@ 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, -'phrase': phrase, - + 'email': email, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 @@ -1078,66 +1095,79 @@ 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, -'url': url, -'phrase': phrase, - + 'email': email, + 'url': url, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { 'success': success, -'failure': failure, -'scopes': scopes, + 'failure': failure, + 'scopes': scopes, - 'project': client.config['project'], }; 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)); + query.add( + Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item), + ); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -1145,15 +1175,16 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri(scheme: endpoint.scheme, + Uri url = Uri( + scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&') + 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 @@ -1161,30 +1192,29 @@ 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, - - }; + final Map apiParams = {'userId': userId, 'phone': phone}; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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** @@ -1195,56 +1225,52 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; - - final Map apiParams = { - - 'url': url, + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - }; + final Map apiParams = {'url': url}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 updateVerification({required String userId, required String secret}) async { - final String apiPath = '/account/verification'; + Future updateVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification'; - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; + final Map apiParams = {'userId': userId, 'secret': secret}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -1254,47 +1280,44 @@ 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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/verification/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, + Future updatePhoneVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification/phone'; - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {'userId': userId, '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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index a91d6d3f..8033f1cd 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,189 +1,255 @@ 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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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, -'width': width, -'height': height, + 'width': width, + '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 = { 'name': name, -'width': width, -'height': height, -'background': background, + 'width': width, + 'height': height, + '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, -'size': size, -'margin': margin, -'download': download, + 'size': size, + 'margin': margin, + '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/databases.dart b/lib/services/databases.dart index f962d8b3..223f1318 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1215 +1,1682 @@ 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}) 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, + }) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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.createDatabase` 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.createDatabase` instead.', + ) + Future create({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases'; final Map apiParams = { - 'databaseId': databaseId, -'name': name, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, bool? enabled}) async { - final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.', + ) + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'collectionId': collectionId, -'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) 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, + required String name, + List? permissions, + bool? documentSecurity, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + @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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + @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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return 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/{key}/relationship'.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/{key}/relationship' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'onDelete': onDelete?.value, -'newKey': newKey, - + 'newKey': newKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - } + } /// 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'documentId': documentId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + final Map apiParams = {'queries': queries}; + + final Map 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, required Map data, List? permissions}) 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, + required Map data, + List? permissions, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - 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; - - } + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'attributes': attributes, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 index by 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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); - - 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; - - } -} \ No newline at end of file + @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 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/functions.dart b/lib/services/functions.dart index 05a7d5f7..e86f1afe 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,256 +1,316 @@ 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}) async { - final String apiPath = '/functions'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? specification}) 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? specification, + }) async { + final String apiPath = '/functions'; final Map apiParams = { - 'functionId': functionId, -'name': name, -'runtime': runtime.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'name': name, + 'runtime': runtime.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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? specification}) 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? specification, + }) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'name': name, -'runtime': runtime?.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'runtime': runtime?.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String functionId}) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateFunctionDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployment'.replaceAll( + '{functionId}', + functionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); + Future listDeployments({ + required String functionId, + List? queries, + String? search, + }) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 = { - 'entrypoint': entrypoint, -'commands': commands, -'code': code, -'activate': activate, - + 'commands': commands, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -265,361 +325,446 @@ 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, -'buildId': buildId, - + 'buildId': buildId, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String functionId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/functions/{functionId}/deployments/template' + .replaceAll('{functionId}', functionId); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll('{functionId}', functionId); + Future createVcsDeployment({ + required String functionId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployments/{deploymentId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 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}) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - - final Map apiParams = { - 'queries': queries, + Future listExecutions({ + required String functionId, + List? queries, + }) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll( + '{functionId}', + functionId, + ); - - }; + final Map apiParams = {'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.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 = { - 'body': body, -'async': xasync, -'path': path, -'method': method?.value, -'headers': headers, -'scheduledAt': scheduledAt, - + 'async': xasync, + 'path': path, + 'method': method?.value, + 'headers': headers, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteExecution({ + required String functionId, + required String executionId, + }) async { + final String apiPath = '/functions/{functionId}/executions/{executionId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{executionId}', executionId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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, + }) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index e2418b52..18eb54f1 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,51 +1,49 @@ 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 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); - - return res.data; + 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 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); - - return res.data; + final res = await client.call( + HttpMethod.post, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/health.dart b/lib/services/health.dart index 0cf64ac6..5250c91d 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,438 +1,414 @@ 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.HealthStatus.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 = { - 'domain': domain, + final Map apiParams = {'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); - - } + } /// 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.HealthStatus.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.HealthStatus.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 = { - 'threshold': threshold, - - - }; + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueCertificates({int? threshold}) async { + final String apiPath = '/health/queue/certificates'; - - }; + final Map apiParams = {'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 = { 'name': name, -'threshold': threshold, - - + '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 = { - 'threshold': threshold, + final Map apiParams = {'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); - - final Map apiParams = { - 'threshold': threshold, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future getFailedJobs({ + required enums.Name name, + int? threshold, + }) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll( + '{name}', + name.value, + ); + + final Map apiParams = {'threshold': threshold}; + + final Map 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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueFunctions({int? threshold}) async { + final String apiPath = '/health/queue/functions'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueStatsResources({int? threshold}) async { + final String apiPath = '/health/queue/stats-resources'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 @@ -441,21 +417,20 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 430a00c3..4d3cc3e0 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,172 +1,164 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 23551577..bf5376e5 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1393 +1,1805 @@ 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}) async { - final String apiPath = '/messaging/messages'; + Future listMessages({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'topics': topics, -'users': users, -'targets': targets, -'cc': cc, -'bcc': bcc, -'attachments': attachments, -'draft': draft, -'html': html, -'scheduledAt': scheduledAt, - + 'subject': subject, + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'cc': cc, + 'bcc': bcc, + 'attachments': attachments, + 'draft': draft, + 'html': html, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'title': title, -'body': body, -'topics': topics, -'users': users, -'targets': targets, -'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.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'title': title, + 'body': body, + 'topics': topics, + 'users': users, + 'targets': targets, + '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.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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'topics': topics, -'users': users, -'targets': targets, -'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'draft': draft, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'topics': topics, -'users': users, -'targets': targets, -'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'draft': draft, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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}) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listMessageLogs({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/providers'; + Future listProviders({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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 = { - 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'enabled': enabled, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'enabled': enabled, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, -'enabled': enabled, - + 'name': name, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, - + 'enabled': enabled, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'enabled': enabled, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 = { - 'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 = { - 'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, -'from': from, -'customerId': customerId, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'customerId': customerId, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'customerId': customerId, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'customerId': customerId, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'from': from, -'username': username, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'username': username, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'username': username, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'username': username, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'from': from, -'accountSid': accountSid, -'authToken': authToken, -'enabled': enabled, - + 'name': name, + 'from': from, + 'accountSid': accountSid, + 'authToken': authToken, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'accountSid': accountSid, -'authToken': authToken, -'from': from, - + 'enabled': enabled, + 'accountSid': accountSid, + 'authToken': authToken, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'from': from, -'apiKey': apiKey, -'apiSecret': apiSecret, -'enabled': enabled, - + 'name': name, + 'from': from, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'apiSecret': apiSecret, -'from': from, - + 'enabled': enabled, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteProvider({required String providerId}) async { + final String apiPath = '/messaging/providers/{providerId}'.replaceAll( + '{providerId}', + providerId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listProviderLogs({ + required String providerId, + List? queries, + }) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( + '{providerId}', + providerId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs({ + required String subscriberId, + List? queries, + }) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs' + .replaceAll('{subscriberId}', subscriberId); - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.LogList.fromMap(res.data); - - } + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({List? queries, String? search}) async { - final String apiPath = '/messaging/topics'; + Future listTopics({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'subscribe': subscribe, - + 'name': name, + 'subscribe': subscribe, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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}) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTopicLogs({ + required String topicId, + List? queries, + }) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( + '{topicId}', + topicId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); + Future listSubscribers({ + required String topicId, + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( + '{topicId}', + topicId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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 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); - - 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; - - } -} \ No newline at end of file + 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 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/sites.dart b/lib/services/sites.dart index 5481986e..d89f2192 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,247 +1,296 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.Adapter? adapter, + String? installationId, + String? fallbackFile, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites'; final Map apiParams = { - 'siteId': siteId, -'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime.value, -'adapter': adapter?.value, -'installationId': installationId, -'fallbackFile': fallbackFile, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime.value, + 'adapter': adapter?.value, + 'installationId': installationId, + 'fallbackFile': fallbackFile, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.BuildRuntime? buildRuntime, + enums.Adapter? adapter, + String? fallbackFile, + String? installationId, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime?.value, -'adapter': adapter?.value, -'fallbackFile': fallbackFile, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime?.value, + 'adapter': adapter?.value, + 'fallbackFile': fallbackFile, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + Future delete({required String siteId}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateSiteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployment'.replaceAll( + '{siteId}', + siteId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future listDeployments({ + required String siteId, + List? queries, + String? search, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future createDeployment({ + required String siteId, + required InputFile code, + required bool activate, + String? installCommand, + String? buildCommand, + String? outputDirectory, + Function(UploadProgress)? onProgress, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'code': code, -'activate': activate, - + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -256,331 +305,400 @@ 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, + 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 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String siteId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll('{siteId}', siteId); + Future createVcsDeployment({ + required String siteId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - 'queries': queries, + Future listLogs({ + required String siteId, + List? queries, + }) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll( + '{siteId}', + siteId, + ); - - }; + final Map apiParams = {'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.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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ccdce915..ee630883 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,184 +1,226 @@ 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}) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({ + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { - 'bucketId': bucketId, -'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'name': name, + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) 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, + }) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { - 'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteBucket({required String bucketId}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); + Future listFiles({ + required String bucketId, + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'permissions': permissions, - + 'file': file, + 'permissions': permissions, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -194,137 +236,187 @@ 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 = { - 'name': name, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 = { 'width': width, -'height': height, -'gravity': gravity?.value, -'quality': quality, -'borderWidth': borderWidth, -'borderColor': borderColor, -'borderRadius': borderRadius, -'opacity': opacity, -'rotation': rotation, -'background': background, -'output': output?.value, -'token': token, - - + 'height': height, + 'gravity': gravity?.value, + 'quality': quality, + 'borderWidth': borderWidth, + 'borderColor': borderColor, + 'borderRadius': borderRadius, + 'opacity': opacity, + 'rotation': rotation, + 'background': background, + 'output': output?.value, + '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 = { '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 6a007ccd..f9d86004 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1162 +1,1520 @@ 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}) async { - final String apiPath = '/tablesdb'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, required String name, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + Future listTables({ + required String databaseId, + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'tableId': tableId, -'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future updateTable({ + required String databaseId, + required String tableId, + required String name, + List? permissions, + bool? rowSecurity, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteTable({ + required String databaseId, + required String tableId, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listColumns({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - /// - 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); + /// + 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - /// - 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); + /// + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + 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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + 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 apiHeaders = {'content-type': 'application/json'}; + + 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listIndexes({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'columns': columns, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + 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 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); - - 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; - - } + 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 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRow({required String databaseId, required String tableId, required String rowId, required Map data, List? permissions}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'rowId': rowId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + Future createRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - /// - Future upsertRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future upsertRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future updateRows({ + required String databaseId, + required String tableId, + Map? data, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + Future deleteRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future getRow({ + required String databaseId, + required String tableId, + required String rowId, + List? queries, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future upsertRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - 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; - - } + Future deleteRow({ + required String databaseId, + required String tableId, + required String rowId, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future decrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? min, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future incrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? max, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.patch, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); return models.Row.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/teams.dart b/lib/services/teams.dart index c21a93af..5fd59641 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,140 +1,147 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'roles': roles, - + 'name': name, + 'roles': roles, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - 'name': name, + 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 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); + Future listMemberships({ + required String teamId, + List? queries, + String? search, + }) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll( + '{teamId}', + teamId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 @@ -142,182 +149,210 @@ 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 = { - 'email': email, -'userId': userId, -'phone': phone, -'roles': roles, -'url': url, -'name': name, - + 'userId': userId, + 'phone': phone, + 'roles': roles, + 'url': url, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - 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); + /// + 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, + ); 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index cb04449b..4e6915dc 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,109 +1,113 @@ 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}) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future list({ + required String bucketId, + required String fileId, + List? queries, + }) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); + + final Map apiParams = {'queries': queries}; + + final Map 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); - - 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); + 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, + ); 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); - - final Map apiParams = { - - 'expire': expire, + 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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String tokenId}) async { + final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/users.dart b/lib/services/users.dart index 77d11d61..eda483bb 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,314 +1,359 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'password': password, -'name': name, - + 'email': email, + 'phone': phone, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/users/identities'; + Future listIdentities({ + List? queries, + String? search, + }) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordCpu': passwordCpu, + 'passwordMemory': passwordMemory, + 'passwordParallel': passwordParallel, + 'passwordLength': passwordLength, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordSaltSeparator': passwordSaltSeparator, + 'passwordSignerKey': passwordSignerKey, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'passwordVersion': passwordVersion?.value, -'name': name, - + 'email': email, + 'password': password, + 'passwordVersion': passwordVersion?.value, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -316,782 +361,909 @@ 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); 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 = { - 'sessionId': sessionId, -'duration': duration, - + 'duration': duration, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// Get the user activity logs list by its unique ID. - Future listLogs({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listLogs({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/logs'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); + Future listMemberships({ + required String userId, + List? queries, + String? search, + }) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll( + '{userId}', + userId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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); - - 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); + @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, + ); 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 apiParams = {'mfa': mfa}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @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 apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + Future updateMFARecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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 apiHeaders = {'content-type': 'application/json'}; + + 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 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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 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 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; - - } + 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); - - final Map apiParams = { - - - }; + Future deleteSession({ + required String userId, + required String sessionId, + }) async { + final String apiPath = '/users/{userId}/sessions/{sessionId}' + .replaceAll('{userId}', userId) + .replaceAll('{sessionId}', sessionId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// List the messaging targets that are associated with a user. - Future listTargets({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/targets'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, -'providerId': providerId, -'name': name, - + 'providerType': providerType.value, + 'identifier': identifier, + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'identifier': identifier, -'providerId': providerId, -'name': name, - + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteTarget({ + required String userId, + required String targetId, + }) async { + final String apiPath = '/users/{userId}/targets/{targetId}' + .replaceAll('{userId}', userId) + .replaceAll('{targetId}', targetId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'length': length, -'expire': expire, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future createToken({ + required String userId, + int? length, + int? expire, + }) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'length': length, 'expire': expire}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/src/client.dart b/lib/src/client.dart index 0d9be210..d82d623a 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,7 +81,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 cd82d264..08d93b85 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,21 +2,25 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index ea2cd62a..c961873f 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,14 +9,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => +ClientBase createClient({required String endPoint, required bool selfSigned}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -34,59 +31,66 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format' : '1.8.0', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -135,7 +139,11 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -162,12 +170,19 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index f9e695bf..2bd7d639 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,17 +10,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => - ClientIO( - endPoint: endPoint, - selfSigned: selfSigned, - ); +ClientBase createClient({required String endPoint, required bool selfSigned}) => + ClientIO(endPoint: endPoint, selfSigned: selfSigned); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -43,60 +37,68 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format' : '1.8.0', + 'user-agent': + 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -151,11 +153,16 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, file.path!, - filename: file.filename); + paramName, + file.path!, + filename: file.filename, + ); } else { - 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, @@ -194,12 +201,19 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -244,10 +258,7 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse( - res, - responseType: responseType, - ); + return prepareResponse(res, responseType: responseType); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 658b79b6..06c9ebe3 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest) - .fields - .addAll({"$key[$i]": v.toString()}); + (request as http.MultipartRequest).fields.addAll({ + "$key[$i]": v.toString(), + }); }); } else { - (request as http.MultipartRequest) - .fields - .addAll({key: value.toString()}); + (request as http.MultipartRequest).fields.addAll({ + key: value.toString(), + }); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value){ + params = params.map((key, value) { if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,12 +51,13 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port, + ); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -66,7 +67,9 @@ 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); @@ -113,18 +116,25 @@ 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.dart b/lib/src/enums.dart index 595afdc2..0f250ea3 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes + bytes, } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 2f198d4e..3341912f 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 cd45b6a1..1bae5c8a 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 7d2d7016..42954430 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,18 +1,16 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 af5ebaad..e20f48c6 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,26 +1,24 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index 8d86530d..b101d35f 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({ - required this.value - }); + const IndexType({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/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/name.dart b/lib/src/enums/name.dart index 613bf5f1..74823feb 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,24 +1,22 @@ 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'), - 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'), + 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 076c1c50..383e45b1 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,52 +1,50 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d34440ec..d4fef930 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index 0bf8e2ad..f01fcb01 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({ - required this.value - }); + const VCSDeploymentType({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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index f174d569..4145f701 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 c9f67200..4e901476 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 2fabb416..35c7b767 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index fdcee07a..7d27adba 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index 120723df..fec6f65a 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 504b5f8f..0e80700f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 5f3e1654..bae6618f 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 20dd7189..0ca54691 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a5b27b4f..1df01f19 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 96ce554b..21f8e9a3 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a4953a0e..298c181a 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 03ba94c7..c6eecadd 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8a5aa89d..1ef48332 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 d17f414a..8c8fcb73 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index 4098a5a1..c5fa6adc 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "attributes": attributes, - }; - } + Map toMap() { + return {"total": total, "attributes": attributes}; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 050cbe14..903c6290 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 2202d255..7374fa78 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index 0c3ddf9e..f0bc295e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index 3bb374be..b8fb5e48 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index b02adbf6..66e58c20 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "buckets": buckets.map((p) => p.toMap()).toList(), - }; - } + 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 c55110cf..72de429d 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 240e2ce0..5322aaab 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index b7ce71b8..9d5013c0 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 df80cfbb..2341fc3b 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a92a0a5b..a822c4e5 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 9605a6a9..115108a4 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 200e2c78..a3a4e3b7 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 acf0f6df..9d637d92 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 576937e7..a7983a62 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,28 +2,24 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 5ba4e70b..82bf6734 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 e0be4633..13bb322c 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 475c1c40..8eb0171f 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "columns": columns, - }; - } + Map toMap() { + return {"total": total, "columns": columns}; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index e55d1534..6221c01e 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6fd6a3b0..7b560989 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 94271aa6..66c0ce7b 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 1a9c5038..7318b7ad 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 5e954a05..ec2c0755 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 565b1d66..c52b50f2 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,28 +2,19 @@ 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()); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 073fa251..65e13be3 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 deafffe3..27eef0c1 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 1c99fdf9..7a957f1a 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 cab95b02..8d79e052 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 5eb5c0ce..5afa7932 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 ecf7e791..448c62c7 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 78ba8ab2..df81710a 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index be424a9c..cf85e457 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 d45ea081..4065e17b 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,31 +2,30 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 809106a9..8dfbeab6 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,124 +2,128 @@ 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 String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "deploymentId": deploymentId, - "trigger": trigger, - "status": status, - "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 String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "deploymentId": deploymentId, + "trigger": trigger, + "status": status, + "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 d44139ee..4ed73943 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 de8439ec..a6a9fa46 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 94ea9a14..63f49abc 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "files": files.map((p) => p.toMap()).toList(), - }; - } + 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 ea6b601a..693c9b07 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,46 +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))), - ); - } - - 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)), + ), + ); + } + + 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 7614616a..0b908240 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 afe8f6b3..eb8145d4 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 64401c3f..56c2eded 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index d5974f55..34d7225c 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,28 +2,25 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 ecf0a178..463cf696 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "value": value, - }; - } + Map toMap() { + return {"name": name, "value": value}; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index 54c31e70..fa402e97 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "version": version, - "status": status, - }; - } + Map toMap() { + return {"version": version, "status": status}; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index 0a5b6ce9..d412eba9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 95da1235..5f06906b 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,22 +2,16 @@ 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']); + } - Map toMap() { - return { - "size": size, - }; - } + Map toMap() { + return {"size": size}; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 0d6e7216..59b7092c 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,34 +2,26 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "name": name, - "ping": ping, - "status": status, - }; - } + Map toMap() { + return {"name": name, "ping": ping, "status": status}; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index 102dfe77..dec2d54f 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,34 +2,30 @@ 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'], + ); + } - Map toMap() { - return { - "remoteTime": remoteTime, - "localTime": localTime, - "diff": diff, - }; - } + Map toMap() { + return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index c43c4d57..807bdfd0 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 b8358fc1..b4c63f7d 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 b6717c4e..9d6d7aec 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 fef735fc..6d285a6a 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 1b4ff7de..490a1824 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "jwt": jwt, - }; - } + Map toMap() { + return {"jwt": jwt}; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 43eaad08..9c45adb1 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,34 +2,26 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - "nativeName": nativeName, - }; - } + 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 ea731471..2e65839e 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 b5e9ad1a..084475bf 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 10499ef5..cd5a1155 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "name": name, - }; - } + 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 c1243e06..be6ddb1f 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 cb567bd7..7fb3f364 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 9d4d7701..22273a8c 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "logs": logs.map((p) => p.toMap()).toList(), - }; - } + 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 26610e46..8ee142ad 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index f08f5738..a4d39dca 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 c4e9e858..9b93b00d 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index acaacc34..15ddf642 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 46c166fb..96bf3c65 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 d49989d8..c930a23e 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 6c8b4e36..63411988 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,22 +2,18 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "recoveryCodes": recoveryCodes, - }; - } + Map toMap() { + return {"recoveryCodes": recoveryCodes}; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index 01cf0857..fa57cb8b 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "secret": secret, - "uri": uri, - }; - } + Map toMap() { + return {"secret": secret, "uri": uri}; + } } 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/phone.dart b/lib/src/models/phone.dart index c8bbb95b..40f7bcd2 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 2d869308..879edbc4 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "phones": phones.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index edb6083e..7bc3abc9 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,23 +2,17 @@ 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, - ); - } + factory Preferences.fromMap(Map map) { + return Preferences(data: map); + } - Map toMap() { - return { - "data": data, - }; - } + 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/provider.dart b/lib/src/models/provider.dart index 4295c486..1a762f85 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 9710aea9..9347fefb 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index ed520cc4..dad35dcc 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 fcdabb97..2283653f 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,28 +2,24 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "tokens": tokens.map((p) => p.toMap()).toList(), - }; - } + 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 62e69e5b..3700e577 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 a8374e2b..01f046c6 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,31 +2,25 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "rows": rows.map((p) => p.toMap()).toList(), - }; - } + 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 35f82cfa..7c9677d8 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 c234990c..64bc2e08 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 3a1d955f..d2fe4f64 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 0257cb86..e9c478af 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 5cda6acc..1449f8bd 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index cc9e4355..e74b0d81 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "sites": sites.map((p) => p.toMap()).toList(), - }; - } + 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 e49d399c..e8fb8c75 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,40 +2,35 @@ 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(), + ); + } - Map toMap() { - return { - "memory": memory, - "cpus": cpus, - "enabled": enabled, - "slug": slug, - }; - } + 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 0d2b6a73..de4957d2 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 36e18a7e..0c926297 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 6c8c21e2..6a135b92 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 1c5b88fb..7ce86b9d 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,76 +2,78 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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)), + ), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 2b4b4b41..ebe15c71 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "tables": tables.map((p) => p.toMap()).toList(), - }; - } + 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 f2b3b6b4..4be8b545 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 6ef2725d..84233d1d 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "targets": targets.map((p) => p.toMap()).toList(), - }; - } + 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 e9058b5b..43df33a8 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 a61cc9f7..a3994c06 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "teams": teams.map((p) => p.toMap()).toList(), - }; - } + 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 4f6b8454..35115467 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 461d5694..430d44ac 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 1582a3c7..eefc62b6 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "topics": topics.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index effc397c..50bfb3ce 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index edf7a95d..2419d818 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "users": users.map((p) => p.toMap()).toList(), - }; - } + 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 58882a9f..2a8e276a 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 ee1f6f7a..ffa58eef 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } From 5fb7a4e3cee164dcade3d4c8beff43d4369c16b1 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 26 Aug 2025 04:25:39 +1200 Subject: [PATCH 21/22] Fix docs --- .../{create-j-w-t.md => create-jwt.md} | 0 .../account/create-m-f-a-authenticator.md | 12 - .../account/create-m-f-a-challenge.md | 11 - .../account/create-m-f-a-recovery-codes.md | 10 - ...r-l-token.md => create-magic-url-token.md} | 0 .../account/create-mfa-authenticator.md | 2 +- docs/examples/account/create-mfa-challenge.md | 2 +- .../account/create-mfa-recovery-codes.md | 2 +- ...auth2token.md => create-o-auth-2-token.md} | 0 .../account/delete-m-f-a-authenticator.md | 12 - .../account/delete-mfa-authenticator.md | 2 +- .../account/get-m-f-a-recovery-codes.md | 10 - .../account/get-mfa-recovery-codes.md | 2 +- docs/examples/account/list-m-f-a-factors.md | 10 - docs/examples/account/list-mfa-factors.md | 2 +- .../account/update-m-f-a-authenticator.md | 13 - .../account/update-m-f-a-challenge.md | 13 - .../account/update-m-f-a-recovery-codes.md | 10 - ...session.md => update-magic-url-session.md} | 0 .../account/update-mfa-authenticator.md | 2 +- docs/examples/account/update-mfa-challenge.md | 2 +- .../account/update-mfa-recovery-codes.md | 2 +- .../{update-m-f-a.md => update-mfa.md} | 0 .../avatars/{get-q-r.md => get-qr.md} | 0 .../examples/health/{get-d-b.md => get-db.md} | 0 ...-countries-e-u.md => list-countries-eu.md} | 0 .../messaging/create-a-p-n-s-provider.md | 19 - .../messaging/create-apns-provider.md | 2 +- .../messaging/create-f-c-m-provider.md | 15 - .../examples/messaging/create-fcm-provider.md | 2 +- ...1provider.md => create-msg-91-provider.md} | 0 docs/examples/messaging/create-s-m-s.md | 18 - .../messaging/create-s-m-t-p-provider.md | 25 - docs/examples/messaging/create-sms.md | 2 +- .../messaging/create-smtp-provider.md | 2 +- .../messaging/update-a-p-n-s-provider.md | 19 - .../messaging/update-apns-provider.md | 2 +- .../messaging/update-f-c-m-provider.md | 15 - .../examples/messaging/update-fcm-provider.md | 2 +- ...1provider.md => update-msg-91-provider.md} | 0 docs/examples/messaging/update-s-m-s.md | 18 - .../messaging/update-s-m-t-p-provider.md | 25 - docs/examples/messaging/update-sms.md | 2 +- .../messaging/update-smtp-provider.md | 2 +- ...e-argon2user.md => create-argon-2-user.md} | 0 .../users/{create-j-w-t.md => create-jwt.md} | 0 .../users/create-m-f-a-recovery-codes.md | 12 - ...create-m-d5user.md => create-md-5-user.md} | 0 .../users/create-mfa-recovery-codes.md | 2 +- ...-h-pass-user.md => create-ph-pass-user.md} | 0 ...reate-s-h-a-user.md => create-sha-user.md} | 0 .../users/delete-m-f-a-authenticator.md | 13 - .../users/delete-mfa-authenticator.md | 2 +- .../users/get-m-f-a-recovery-codes.md | 12 - docs/examples/users/get-mfa-recovery-codes.md | 2 +- docs/examples/users/list-m-f-a-factors.md | 12 - docs/examples/users/list-mfa-factors.md | 2 +- .../users/update-m-f-a-recovery-codes.md | 12 - docs/examples/users/update-m-f-a.md | 13 - .../users/update-mfa-recovery-codes.md | 2 +- docs/examples/users/update-mfa.md | 2 +- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1471 ++++++----- lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 ++++++--------- lib/services/functions.dart | 869 +++---- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 ++-- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 2260 +++++++---------- lib/services/sites.dart | 822 +++--- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 ++++++-------- lib/services/teams.dart | 421 ++- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1582 +++++------- lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 +-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 244 +- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 +-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 +-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 +-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 225 files changed, 11486 insertions(+), 13448 deletions(-) rename docs/examples/account/{create-j-w-t.md => create-jwt.md} (100%) delete mode 100644 docs/examples/account/create-m-f-a-authenticator.md delete mode 100644 docs/examples/account/create-m-f-a-challenge.md delete mode 100644 docs/examples/account/create-m-f-a-recovery-codes.md rename docs/examples/account/{create-magic-u-r-l-token.md => create-magic-url-token.md} (100%) rename docs/examples/account/{create-o-auth2token.md => create-o-auth-2-token.md} (100%) delete mode 100644 docs/examples/account/delete-m-f-a-authenticator.md delete mode 100644 docs/examples/account/get-m-f-a-recovery-codes.md delete mode 100644 docs/examples/account/list-m-f-a-factors.md delete mode 100644 docs/examples/account/update-m-f-a-authenticator.md delete mode 100644 docs/examples/account/update-m-f-a-challenge.md delete mode 100644 docs/examples/account/update-m-f-a-recovery-codes.md rename docs/examples/account/{update-magic-u-r-l-session.md => update-magic-url-session.md} (100%) rename docs/examples/account/{update-m-f-a.md => update-mfa.md} (100%) rename docs/examples/avatars/{get-q-r.md => get-qr.md} (100%) rename docs/examples/health/{get-d-b.md => get-db.md} (100%) rename docs/examples/locale/{list-countries-e-u.md => list-countries-eu.md} (100%) delete mode 100644 docs/examples/messaging/create-a-p-n-s-provider.md delete mode 100644 docs/examples/messaging/create-f-c-m-provider.md rename docs/examples/messaging/{create-msg91provider.md => create-msg-91-provider.md} (100%) delete mode 100644 docs/examples/messaging/create-s-m-s.md delete mode 100644 docs/examples/messaging/create-s-m-t-p-provider.md delete mode 100644 docs/examples/messaging/update-a-p-n-s-provider.md delete mode 100644 docs/examples/messaging/update-f-c-m-provider.md rename docs/examples/messaging/{update-msg91provider.md => update-msg-91-provider.md} (100%) delete mode 100644 docs/examples/messaging/update-s-m-s.md delete mode 100644 docs/examples/messaging/update-s-m-t-p-provider.md rename docs/examples/users/{create-argon2user.md => create-argon-2-user.md} (100%) rename docs/examples/users/{create-j-w-t.md => create-jwt.md} (100%) delete mode 100644 docs/examples/users/create-m-f-a-recovery-codes.md rename docs/examples/users/{create-m-d5user.md => create-md-5-user.md} (100%) rename docs/examples/users/{create-p-h-pass-user.md => create-ph-pass-user.md} (100%) rename docs/examples/users/{create-s-h-a-user.md => create-sha-user.md} (100%) delete mode 100644 docs/examples/users/delete-m-f-a-authenticator.md delete mode 100644 docs/examples/users/get-m-f-a-recovery-codes.md delete mode 100644 docs/examples/users/list-m-f-a-factors.md delete mode 100644 docs/examples/users/update-m-f-a-recovery-codes.md delete mode 100644 docs/examples/users/update-m-f-a.md diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-jwt.md similarity index 100% rename from docs/examples/account/create-j-w-t.md rename to docs/examples/account/create-jwt.md diff --git a/docs/examples/account/create-m-f-a-authenticator.md b/docs/examples/account/create-m-f-a-authenticator.md deleted file mode 100644 index 4dd2191f..00000000 --- a/docs/examples/account/create-m-f-a-authenticator.md +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:dart_appwrite/dart_appwrite.dart'; - -Client client = Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -Account account = Account(client); - -MfaType result = await account.createMFAAuthenticator( - type: AuthenticatorType.totp, -); diff --git a/docs/examples/account/create-m-f-a-challenge.md b/docs/examples/account/create-m-f-a-challenge.md deleted file mode 100644 index 5df3abad..00000000 --- a/docs/examples/account/create-m-f-a-challenge.md +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:dart_appwrite/dart_appwrite.dart'; - -Client client = Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -Account account = Account(client); - -MfaChallenge result = await account.createMFAChallenge( - factor: AuthenticationFactor.email, -); diff --git a/docs/examples/account/create-m-f-a-recovery-codes.md b/docs/examples/account/create-m-f-a-recovery-codes.md deleted file mode 100644 index 1e8d4788..00000000 --- a/docs/examples/account/create-m-f-a-recovery-codes.md +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:dart_appwrite/dart_appwrite.dart'; - -Client client = Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -Account account = Account(client); - -MfaRecoveryCodes result = await account.createMFARecoveryCodes(); diff --git a/docs/examples/account/create-magic-u-r-l-token.md b/docs/examples/account/create-magic-url-token.md similarity index 100% rename from docs/examples/account/create-magic-u-r-l-token.md rename to docs/examples/account/create-magic-url-token.md diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md index 87797fa6..4dd2191f 100644 --- a/docs/examples/account/create-mfa-authenticator.md +++ b/docs/examples/account/create-mfa-authenticator.md @@ -7,6 +7,6 @@ Client client = Client() Account account = Account(client); -MfaType result = await account.createMfaAuthenticator( +MfaType result = await account.createMFAAuthenticator( type: AuthenticatorType.totp, ); diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index 62f3eaf2..5df3abad 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -6,6 +6,6 @@ Client client = Client() Account account = Account(client); -MfaChallenge result = await account.createMfaChallenge( +MfaChallenge result = await account.createMFAChallenge( factor: AuthenticationFactor.email, ); diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md index 5ebe0e9e..1e8d4788 100644 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -7,4 +7,4 @@ Client client = Client() Account account = Account(client); -MfaRecoveryCodes result = await account.createMfaRecoveryCodes(); +MfaRecoveryCodes result = await account.createMFARecoveryCodes(); diff --git a/docs/examples/account/create-o-auth2token.md b/docs/examples/account/create-o-auth-2-token.md similarity index 100% rename from docs/examples/account/create-o-auth2token.md rename to docs/examples/account/create-o-auth-2-token.md diff --git a/docs/examples/account/delete-m-f-a-authenticator.md b/docs/examples/account/delete-m-f-a-authenticator.md deleted file mode 100644 index 7f3f4ab1..00000000 --- a/docs/examples/account/delete-m-f-a-authenticator.md +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:dart_appwrite/dart_appwrite.dart'; - -Client client = Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -Account account = Account(client); - -await account.deleteMFAAuthenticator( - type: AuthenticatorType.totp, -); diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index efd5263e..7f3f4ab1 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -7,6 +7,6 @@ Client client = Client() Account account = Account(client); -await account.deleteMfaAuthenticator( +await account.deleteMFAAuthenticator( type: AuthenticatorType.totp, ); diff --git a/docs/examples/account/get-m-f-a-recovery-codes.md b/docs/examples/account/get-m-f-a-recovery-codes.md deleted file mode 100644 index 5ff858fd..00000000 --- a/docs/examples/account/get-m-f-a-recovery-codes.md +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:dart_appwrite/dart_appwrite.dart'; - -Client client = Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -Account account = Account(client); - -MfaRecoveryCodes result = await account.getMFARecoveryCodes(); diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md index b073d402..5ff858fd 100644 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -7,4 +7,4 @@ Client client = Client() Account account = Account(client); -MfaRecoveryCodes result = await account.getMfaRecoveryCodes(); +MfaRecoveryCodes result = await account.getMFARecoveryCodes(); diff --git a/docs/examples/account/list-m-f-a-factors.md b/docs/examples/account/list-m-f-a-factors.md deleted file mode 100644 index 083b51d6..00000000 --- a/docs/examples/account/list-m-f-a-factors.md +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:dart_appwrite/dart_appwrite.dart'; - -Client client = Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -Account account = Account(client); - -MfaFactors result = await account.listMFAFactors(); diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md index 32b269fb..083b51d6 100644 --- a/docs/examples/account/list-mfa-factors.md +++ b/docs/examples/account/list-mfa-factors.md @@ -7,4 +7,4 @@ Client client = Client() Account account = Account(client); -MfaFactors result = await account.listMfaFactors(); +MfaFactors result = await account.listMFAFactors(); diff --git a/docs/examples/account/update-m-f-a-authenticator.md b/docs/examples/account/update-m-f-a-authenticator.md deleted file mode 100644 index c475d30e..00000000 --- a/docs/examples/account/update-m-f-a-authenticator.md +++ /dev/null @@ -1,13 +0,0 @@ -import 'package:dart_appwrite/dart_appwrite.dart'; - -Client client = Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -Account account = Account(client); - -User result = await account.updateMFAAuthenticator( - type: AuthenticatorType.totp, - otp: '', -); diff --git a/docs/examples/account/update-m-f-a-challenge.md b/docs/examples/account/update-m-f-a-challenge.md deleted file mode 100644 index 6cf3bb47..00000000 --- a/docs/examples/account/update-m-f-a-challenge.md +++ /dev/null @@ -1,13 +0,0 @@ -import 'package:dart_appwrite/dart_appwrite.dart'; - -Client client = Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -Account account = Account(client); - -Session result = await account.updateMFAChallenge( - challengeId: '', - otp: '', -); diff --git a/docs/examples/account/update-m-f-a-recovery-codes.md b/docs/examples/account/update-m-f-a-recovery-codes.md deleted file mode 100644 index 10fc77d2..00000000 --- a/docs/examples/account/update-m-f-a-recovery-codes.md +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:dart_appwrite/dart_appwrite.dart'; - -Client client = Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -Account account = Account(client); - -MfaRecoveryCodes result = await account.updateMFARecoveryCodes(); diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-url-session.md similarity index 100% rename from docs/examples/account/update-magic-u-r-l-session.md rename to docs/examples/account/update-magic-url-session.md diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md index 5a0f98f5..c475d30e 100644 --- a/docs/examples/account/update-mfa-authenticator.md +++ b/docs/examples/account/update-mfa-authenticator.md @@ -7,7 +7,7 @@ Client client = Client() Account account = Account(client); -User result = await account.updateMfaAuthenticator( +User result = await account.updateMFAAuthenticator( type: AuthenticatorType.totp, otp: '', ); diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md index 749c4cd6..6cf3bb47 100644 --- a/docs/examples/account/update-mfa-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -7,7 +7,7 @@ Client client = Client() Account account = Account(client); -Session result = await account.updateMfaChallenge( +Session result = await account.updateMFAChallenge( challengeId: '', otp: '', ); diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md index 7e274f0e..10fc77d2 100644 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -7,4 +7,4 @@ Client client = Client() Account account = Account(client); -MfaRecoveryCodes result = await account.updateMfaRecoveryCodes(); +MfaRecoveryCodes result = await account.updateMFARecoveryCodes(); diff --git a/docs/examples/account/update-m-f-a.md b/docs/examples/account/update-mfa.md similarity index 100% rename from docs/examples/account/update-m-f-a.md rename to docs/examples/account/update-mfa.md diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-qr.md similarity index 100% rename from docs/examples/avatars/get-q-r.md rename to docs/examples/avatars/get-qr.md diff --git a/docs/examples/health/get-d-b.md b/docs/examples/health/get-db.md similarity index 100% rename from docs/examples/health/get-d-b.md rename to docs/examples/health/get-db.md diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-eu.md similarity index 100% rename from docs/examples/locale/list-countries-e-u.md rename to docs/examples/locale/list-countries-eu.md diff --git a/docs/examples/messaging/create-a-p-n-s-provider.md b/docs/examples/messaging/create-a-p-n-s-provider.md deleted file mode 100644 index a4faf2da..00000000 --- a/docs/examples/messaging/create-a-p-n-s-provider.md +++ /dev/null @@ -1,19 +0,0 @@ -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 - -Messaging messaging = Messaging(client); - -Provider result = await messaging.createAPNSProvider( - providerId: '', - name: '', - authKey: '', // (optional) - authKeyId: '', // (optional) - teamId: '', // (optional) - bundleId: '', // (optional) - sandbox: false, // (optional) - enabled: false, // (optional) -); diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md index 82c1eb5d..a4faf2da 100644 --- a/docs/examples/messaging/create-apns-provider.md +++ b/docs/examples/messaging/create-apns-provider.md @@ -7,7 +7,7 @@ Client client = Client() Messaging messaging = Messaging(client); -Provider result = await messaging.createApnsProvider( +Provider result = await messaging.createAPNSProvider( providerId: '', name: '', authKey: '', // (optional) diff --git a/docs/examples/messaging/create-f-c-m-provider.md b/docs/examples/messaging/create-f-c-m-provider.md deleted file mode 100644 index ce4f810d..00000000 --- a/docs/examples/messaging/create-f-c-m-provider.md +++ /dev/null @@ -1,15 +0,0 @@ -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 - -Messaging messaging = Messaging(client); - -Provider result = await messaging.createFCMProvider( - providerId: '', - name: '', - serviceAccountJSON: {}, // (optional) - enabled: false, // (optional) -); diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md index 25c2cb8c..ce4f810d 100644 --- a/docs/examples/messaging/create-fcm-provider.md +++ b/docs/examples/messaging/create-fcm-provider.md @@ -7,7 +7,7 @@ Client client = Client() Messaging messaging = Messaging(client); -Provider result = await messaging.createFcmProvider( +Provider result = await messaging.createFCMProvider( providerId: '', name: '', serviceAccountJSON: {}, // (optional) diff --git a/docs/examples/messaging/create-msg91provider.md b/docs/examples/messaging/create-msg-91-provider.md similarity index 100% rename from docs/examples/messaging/create-msg91provider.md rename to docs/examples/messaging/create-msg-91-provider.md diff --git a/docs/examples/messaging/create-s-m-s.md b/docs/examples/messaging/create-s-m-s.md deleted file mode 100644 index ca90bc60..00000000 --- a/docs/examples/messaging/create-s-m-s.md +++ /dev/null @@ -1,18 +0,0 @@ -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 - -Messaging messaging = Messaging(client); - -Message result = await messaging.createSMS( - messageId: '', - content: '', - topics: [], // (optional) - users: [], // (optional) - targets: [], // (optional) - draft: false, // (optional) - scheduledAt: '', // (optional) -); diff --git a/docs/examples/messaging/create-s-m-t-p-provider.md b/docs/examples/messaging/create-s-m-t-p-provider.md deleted file mode 100644 index 644d30fa..00000000 --- a/docs/examples/messaging/create-s-m-t-p-provider.md +++ /dev/null @@ -1,25 +0,0 @@ -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 - -Messaging messaging = Messaging(client); - -Provider result = await messaging.createSMTPProvider( - providerId: '', - name: '', - host: '', - port: 1, // (optional) - username: '', // (optional) - password: '', // (optional) - encryption: SmtpEncryption.none, // (optional) - autoTLS: false, // (optional) - mailer: '', // (optional) - fromName: '', // (optional) - fromEmail: 'email@example.com', // (optional) - replyToName: '', // (optional) - replyToEmail: 'email@example.com', // (optional) - enabled: false, // (optional) -); diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md index 04a71587..ca90bc60 100644 --- a/docs/examples/messaging/create-sms.md +++ b/docs/examples/messaging/create-sms.md @@ -7,7 +7,7 @@ Client client = Client() Messaging messaging = Messaging(client); -Message result = await messaging.createSms( +Message result = await messaging.createSMS( messageId: '', content: '', topics: [], // (optional) diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index 6201987f..644d30fa 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -7,7 +7,7 @@ Client client = Client() Messaging messaging = Messaging(client); -Provider result = await messaging.createSmtpProvider( +Provider result = await messaging.createSMTPProvider( providerId: '', name: '', host: '', diff --git a/docs/examples/messaging/update-a-p-n-s-provider.md b/docs/examples/messaging/update-a-p-n-s-provider.md deleted file mode 100644 index 7f3bc834..00000000 --- a/docs/examples/messaging/update-a-p-n-s-provider.md +++ /dev/null @@ -1,19 +0,0 @@ -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 - -Messaging messaging = Messaging(client); - -Provider result = await messaging.updateAPNSProvider( - providerId: '', - name: '', // (optional) - enabled: false, // (optional) - authKey: '', // (optional) - authKeyId: '', // (optional) - teamId: '', // (optional) - bundleId: '', // (optional) - sandbox: false, // (optional) -); diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md index edc0a1f7..7f3bc834 100644 --- a/docs/examples/messaging/update-apns-provider.md +++ b/docs/examples/messaging/update-apns-provider.md @@ -7,7 +7,7 @@ Client client = Client() Messaging messaging = Messaging(client); -Provider result = await messaging.updateApnsProvider( +Provider result = await messaging.updateAPNSProvider( providerId: '', name: '', // (optional) enabled: false, // (optional) diff --git a/docs/examples/messaging/update-f-c-m-provider.md b/docs/examples/messaging/update-f-c-m-provider.md deleted file mode 100644 index 65afba1f..00000000 --- a/docs/examples/messaging/update-f-c-m-provider.md +++ /dev/null @@ -1,15 +0,0 @@ -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 - -Messaging messaging = Messaging(client); - -Provider result = await messaging.updateFCMProvider( - providerId: '', - name: '', // (optional) - enabled: false, // (optional) - serviceAccountJSON: {}, // (optional) -); diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md index 1e2d8a8c..65afba1f 100644 --- a/docs/examples/messaging/update-fcm-provider.md +++ b/docs/examples/messaging/update-fcm-provider.md @@ -7,7 +7,7 @@ Client client = Client() Messaging messaging = Messaging(client); -Provider result = await messaging.updateFcmProvider( +Provider result = await messaging.updateFCMProvider( providerId: '', name: '', // (optional) enabled: false, // (optional) diff --git a/docs/examples/messaging/update-msg91provider.md b/docs/examples/messaging/update-msg-91-provider.md similarity index 100% rename from docs/examples/messaging/update-msg91provider.md rename to docs/examples/messaging/update-msg-91-provider.md diff --git a/docs/examples/messaging/update-s-m-s.md b/docs/examples/messaging/update-s-m-s.md deleted file mode 100644 index 26e6649b..00000000 --- a/docs/examples/messaging/update-s-m-s.md +++ /dev/null @@ -1,18 +0,0 @@ -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 - -Messaging messaging = Messaging(client); - -Message result = await messaging.updateSMS( - messageId: '', - topics: [], // (optional) - users: [], // (optional) - targets: [], // (optional) - content: '', // (optional) - draft: false, // (optional) - scheduledAt: '', // (optional) -); diff --git a/docs/examples/messaging/update-s-m-t-p-provider.md b/docs/examples/messaging/update-s-m-t-p-provider.md deleted file mode 100644 index 911fa144..00000000 --- a/docs/examples/messaging/update-s-m-t-p-provider.md +++ /dev/null @@ -1,25 +0,0 @@ -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 - -Messaging messaging = Messaging(client); - -Provider result = await messaging.updateSMTPProvider( - providerId: '', - name: '', // (optional) - host: '', // (optional) - port: 1, // (optional) - username: '', // (optional) - password: '', // (optional) - encryption: SmtpEncryption.none, // (optional) - autoTLS: false, // (optional) - mailer: '', // (optional) - fromName: '', // (optional) - fromEmail: 'email@example.com', // (optional) - replyToName: '', // (optional) - replyToEmail: '', // (optional) - enabled: false, // (optional) -); diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md index f4356dee..26e6649b 100644 --- a/docs/examples/messaging/update-sms.md +++ b/docs/examples/messaging/update-sms.md @@ -7,7 +7,7 @@ Client client = Client() Messaging messaging = Messaging(client); -Message result = await messaging.updateSms( +Message result = await messaging.updateSMS( messageId: '', topics: [], // (optional) users: [], // (optional) diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index 16530c01..911fa144 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -7,7 +7,7 @@ Client client = Client() Messaging messaging = Messaging(client); -Provider result = await messaging.updateSmtpProvider( +Provider result = await messaging.updateSMTPProvider( providerId: '', name: '', // (optional) host: '', // (optional) diff --git a/docs/examples/users/create-argon2user.md b/docs/examples/users/create-argon-2-user.md similarity index 100% rename from docs/examples/users/create-argon2user.md rename to docs/examples/users/create-argon-2-user.md diff --git a/docs/examples/users/create-j-w-t.md b/docs/examples/users/create-jwt.md similarity index 100% rename from docs/examples/users/create-j-w-t.md rename to docs/examples/users/create-jwt.md diff --git a/docs/examples/users/create-m-f-a-recovery-codes.md b/docs/examples/users/create-m-f-a-recovery-codes.md deleted file mode 100644 index 12a7e32f..00000000 --- a/docs/examples/users/create-m-f-a-recovery-codes.md +++ /dev/null @@ -1,12 +0,0 @@ -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 - -Users users = Users(client); - -MfaRecoveryCodes result = await users.createMFARecoveryCodes( - userId: '', -); diff --git a/docs/examples/users/create-m-d5user.md b/docs/examples/users/create-md-5-user.md similarity index 100% rename from docs/examples/users/create-m-d5user.md rename to docs/examples/users/create-md-5-user.md diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md index c2b9562e..12a7e32f 100644 --- a/docs/examples/users/create-mfa-recovery-codes.md +++ b/docs/examples/users/create-mfa-recovery-codes.md @@ -7,6 +7,6 @@ Client client = Client() Users users = Users(client); -MfaRecoveryCodes result = await users.createMfaRecoveryCodes( +MfaRecoveryCodes result = await users.createMFARecoveryCodes( userId: '', ); diff --git a/docs/examples/users/create-p-h-pass-user.md b/docs/examples/users/create-ph-pass-user.md similarity index 100% rename from docs/examples/users/create-p-h-pass-user.md rename to docs/examples/users/create-ph-pass-user.md diff --git a/docs/examples/users/create-s-h-a-user.md b/docs/examples/users/create-sha-user.md similarity index 100% rename from docs/examples/users/create-s-h-a-user.md rename to docs/examples/users/create-sha-user.md diff --git a/docs/examples/users/delete-m-f-a-authenticator.md b/docs/examples/users/delete-m-f-a-authenticator.md deleted file mode 100644 index b5dcc6af..00000000 --- a/docs/examples/users/delete-m-f-a-authenticator.md +++ /dev/null @@ -1,13 +0,0 @@ -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 - -Users users = Users(client); - -await users.deleteMFAAuthenticator( - userId: '', - type: AuthenticatorType.totp, -); diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md index eed7dbd4..b5dcc6af 100644 --- a/docs/examples/users/delete-mfa-authenticator.md +++ b/docs/examples/users/delete-mfa-authenticator.md @@ -7,7 +7,7 @@ Client client = Client() Users users = Users(client); -await users.deleteMfaAuthenticator( +await users.deleteMFAAuthenticator( userId: '', type: AuthenticatorType.totp, ); diff --git a/docs/examples/users/get-m-f-a-recovery-codes.md b/docs/examples/users/get-m-f-a-recovery-codes.md deleted file mode 100644 index e16158bf..00000000 --- a/docs/examples/users/get-m-f-a-recovery-codes.md +++ /dev/null @@ -1,12 +0,0 @@ -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 - -Users users = Users(client); - -MfaRecoveryCodes result = await users.getMFARecoveryCodes( - userId: '', -); diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md index cf66c676..e16158bf 100644 --- a/docs/examples/users/get-mfa-recovery-codes.md +++ b/docs/examples/users/get-mfa-recovery-codes.md @@ -7,6 +7,6 @@ Client client = Client() Users users = Users(client); -MfaRecoveryCodes result = await users.getMfaRecoveryCodes( +MfaRecoveryCodes result = await users.getMFARecoveryCodes( userId: '', ); diff --git a/docs/examples/users/list-m-f-a-factors.md b/docs/examples/users/list-m-f-a-factors.md deleted file mode 100644 index 290109d2..00000000 --- a/docs/examples/users/list-m-f-a-factors.md +++ /dev/null @@ -1,12 +0,0 @@ -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 - -Users users = Users(client); - -MfaFactors result = await users.listMFAFactors( - userId: '', -); diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md index 7134ee5d..290109d2 100644 --- a/docs/examples/users/list-mfa-factors.md +++ b/docs/examples/users/list-mfa-factors.md @@ -7,6 +7,6 @@ Client client = Client() Users users = Users(client); -MfaFactors result = await users.listMfaFactors( +MfaFactors result = await users.listMFAFactors( userId: '', ); diff --git a/docs/examples/users/update-m-f-a-recovery-codes.md b/docs/examples/users/update-m-f-a-recovery-codes.md deleted file mode 100644 index a2340ff8..00000000 --- a/docs/examples/users/update-m-f-a-recovery-codes.md +++ /dev/null @@ -1,12 +0,0 @@ -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 - -Users users = Users(client); - -MfaRecoveryCodes result = await users.updateMFARecoveryCodes( - userId: '', -); diff --git a/docs/examples/users/update-m-f-a.md b/docs/examples/users/update-m-f-a.md deleted file mode 100644 index 7d3b71d9..00000000 --- a/docs/examples/users/update-m-f-a.md +++ /dev/null @@ -1,13 +0,0 @@ -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 - -Users users = Users(client); - -User result = await users.updateMFA( - userId: '', - mfa: false, -); diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md index 3b7d81f5..a2340ff8 100644 --- a/docs/examples/users/update-mfa-recovery-codes.md +++ b/docs/examples/users/update-mfa-recovery-codes.md @@ -7,6 +7,6 @@ Client client = Client() Users users = Users(client); -MfaRecoveryCodes result = await users.updateMfaRecoveryCodes( +MfaRecoveryCodes result = await users.updateMFARecoveryCodes( userId: '', ); diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md index f26b1055..7d3b71d9 100644 --- a/docs/examples/users/update-mfa.md +++ b/docs/examples/users/update-mfa.md @@ -7,7 +7,7 @@ Client client = Client() Users users = Users(client); -User result = await users.updateMfa( +User result = await users.updateMFA( userId: '', mfa: false, ); 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/query.dart b/lib/query.dart index c9a2fc91..281aa756 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if (attribute != null) { + if(attribute != null) { map['attribute'] = attribute; } - - if (values != null) { + + if(values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} +} \ 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 d0c820a1..9225f30a 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,26 +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 @@ -29,32 +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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -63,674 +60,661 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 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; - } + 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() async { - final String apiPath = '/account/jwts'; + Future createJWT() async { + final String apiPath = '/account/jwts'; + + final Map apiParams = { + + + }; - final Map apiParams = {}; + final Map apiHeaders = { + 'content-type': 'application/json', - 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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 apiParams = { + + 'mfa': mfa, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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 apiParams = { + + 'otp': otp, + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiParams = { + + 'otp': otp, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - 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 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; - } + 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/challenge'; - - 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, - ); + @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/challenge'; + + 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); 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/challenge'; + Future createMFAChallenge({required enums.AuthenticationFactor factor}) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = {'factor': factor.value}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/challenge'; + @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/challenge'; final Map apiParams = { + 'challengeId': challengeId, - 'otp': otp, +'otp': otp, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/challenge'; + Future updateMFAChallenge({required String challengeId, required String otp}) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { + 'challengeId': challengeId, - 'otp': otp, +'otp': otp, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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 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 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 apiParams = {'name': name}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'oldPassword': oldPassword, +'oldPassword': oldPassword, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 apiParams = {'prefs': prefs}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -740,98 +724,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}; + final Map apiParams = { + + 'email': email, +'url': url, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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; - 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 @@ -840,212 +825,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 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 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.') - Future updateMagicURLSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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.') - Future updatePhoneSession({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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; - 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 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 @@ -1056,35 +1042,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, - 'phrase': phrase, +'email': email, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -1095,79 +1078,66 @@ 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, - 'url': url, - 'phrase': phrase, +'email': email, +'url': url, +'phrase': phrase, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { 'success': success, - 'failure': failure, - 'scopes': scopes, +'failure': failure, +'scopes': scopes, + 'project': client.config['project'], }; 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), - ); + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -1175,16 +1145,15 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri( - scheme: endpoint.scheme, + Uri url = Uri(scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&'), + 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 @@ -1192,29 +1161,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}; + final Map apiParams = { + + 'userId': userId, +'phone': phone, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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** @@ -1225,52 +1195,56 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'url': url}; + 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 Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 updateVerification({ - required String userId, - required String secret, - }) async { - final String apiPath = '/account/verification'; + Future updateVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification'; - final Map apiParams = {'userId': userId, 'secret': secret}; + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 @@ -1280,44 +1254,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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/verification/phone'; + Future updatePhoneVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verification/phone'; + + final Map apiParams = { + + 'userId': userId, +'secret': secret, - final Map apiParams = {'userId': userId, 'secret': secret}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index 8033f1cd..a91d6d3f 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,255 +1,189 @@ 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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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 = { 'width': width, - 'height': height, - 'quality': quality, +'height': height, +'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, - 'width': width, - 'height': height, +'width': width, +'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 = { 'name': name, - 'width': width, - 'height': height, - 'background': background, +'width': width, +'height': height, +'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, - 'size': size, - 'margin': margin, - 'download': download, +'size': size, +'margin': margin, +'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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 223f1318..f962d8b3 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1682 +1,1215 @@ 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, - }) 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}) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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.createDatabase` 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.createDatabase` instead.') + Future create({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases'; final Map apiParams = { + 'databaseId': databaseId, - 'name': name, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/databases/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.') + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'collectionId': collectionId, - 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - required String name, - List? permissions, - bool? documentSecurity, - bool? enabled, - }) 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'documentSecurity': documentSecurity, - 'enabled': enabled, +'permissions': permissions, +'documentSecurity': documentSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + @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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + @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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return 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/{key}/relationship' - .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/{key}/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'onDelete': onDelete?.value, - 'newKey': newKey, +'newKey': newKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'documentId': documentId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'documents': documents}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'documents': documents, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - required Map data, - List? permissions, - }) 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, required Map data, List? permissions}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); - - 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; - } + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'attributes': attributes, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 index by 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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); - - 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; - } -} + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/functions.dart b/lib/services/functions.dart index e86f1afe..05a7d5f7 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,316 +1,256 @@ 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, - }) async { - final String apiPath = '/functions'; + Future list({List? queries, String? search}) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? specification, - }) 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? specification}) async { + final String apiPath = '/functions'; final Map apiParams = { + 'functionId': functionId, - 'name': name, - 'runtime': runtime.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'name': name, +'runtime': runtime.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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? specification, - }) 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? specification}) async { + final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'name': name, - 'runtime': runtime?.value, - 'execute': execute, - 'events': events, - 'schedule': schedule, - 'timeout': timeout, - 'enabled': enabled, - 'logging': logging, - 'entrypoint': entrypoint, - 'commands': commands, - 'scopes': scopes, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, +'runtime': runtime?.value, +'execute': execute, +'events': events, +'schedule': schedule, +'timeout': timeout, +'enabled': enabled, +'logging': logging, +'entrypoint': entrypoint, +'commands': commands, +'scopes': scopes, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll( - '{functionId}', - functionId, - ); + Future listDeployments({required String functionId, List? queries, String? search}) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 = { + 'entrypoint': entrypoint, - 'commands': commands, - 'code': code, - 'activate': activate, +'commands': commands, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -325,446 +265,361 @@ 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, - 'buildId': buildId, +'buildId': buildId, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String functionId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/functions/{functionId}/deployments/template'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll( - '{functionId}', - functionId, - ); + Future createVcsDeployment({required String functionId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll( - '{functionId}', - functionId, - ); + Future listExecutions({required String functionId, List? queries}) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 = { + 'body': body, - 'async': xasync, - 'path': path, - 'method': method?.value, - 'headers': headers, - 'scheduledAt': scheduledAt, +'async': xasync, +'path': path, +'method': method?.value, +'headers': headers, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index 18eb54f1..e2418b52 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,49 +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 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; - 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 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/health.dart b/lib/services/health.dart index 5250c91d..0cf64ac6 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,414 +1,438 @@ 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.HealthStatus.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 = {'domain': domain}; + final Map apiParams = { + 'domain': domain, - 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.HealthCertificate.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.HealthStatus.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.HealthStatus.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = { + 'threshold': threshold, - final Map apiParams = {'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 = { 'name': name, - 'threshold': threshold, +'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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, - ); - - final Map apiParams = {'threshold': threshold}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future getFailedJobs({required enums.Name name, int? threshold}) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll('{name}', name.value); + + final Map apiParams = { + 'threshold': threshold, + + + }; + + final Map 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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + '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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = { + 'threshold': threshold, - final Map apiParams = {'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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 = {'threshold': threshold}; + final Map apiParams = { + 'threshold': threshold, - 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.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 @@ -417,20 +441,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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 4d3cc3e0..430a00c3 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,164 +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); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index bf5376e5..23551577 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1805 +1,1393 @@ 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, - }) async { - final String apiPath = '/messaging/messages'; + Future listMessages({List? queries, String? search}) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'cc': cc, - 'bcc': bcc, - 'attachments': attachments, - 'draft': draft, - 'html': html, - 'scheduledAt': scheduledAt, +'subject': subject, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'cc': cc, +'bcc': bcc, +'attachments': attachments, +'draft': draft, +'html': html, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'title': title, - 'body': body, - 'topics': topics, - 'users': users, - 'targets': targets, - '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.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'title': title, +'body': body, +'topics': topics, +'users': users, +'targets': targets, +'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.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, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'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); 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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'draft': draft, - 'scheduledAt': scheduledAt, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'draft': draft, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'topics': topics, - 'users': users, - 'targets': targets, - 'draft': draft, - 'scheduledAt': scheduledAt, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'draft': draft, +'scheduledAt': scheduledAt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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 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; - return res.data; - } + } /// Get the message activity logs listed by its unique ID. - Future listMessageLogs({ - required String messageId, - List? queries, - }) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listMessageLogs({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( - '{messageId}', - messageId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String messageId, List? queries}) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/providers'; + Future listProviders({List? queries, String? search}) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, - 'enabled': enabled, +'name': name, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, - 'enabled': enabled, +'name': name, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, +'enabled': enabled, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'authKey': authKey, - 'authKeyId': authKeyId, - 'teamId': teamId, - 'bundleId': bundleId, - 'sandbox': sandbox, +'enabled': enabled, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'sandbox': sandbox, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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 = { + 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'apiKey': apiKey, - 'domain': domain, - 'isEuRegion': isEuRegion, - 'enabled': enabled, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'apiKey': apiKey, +'domain': domain, +'isEuRegion': isEuRegion, +'enabled': enabled, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, - 'enabled': enabled, +'name': name, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'templateId': templateId, - 'senderId': senderId, - 'authKey': authKey, +'enabled': enabled, +'templateId': templateId, +'senderId': senderId, +'authKey': authKey, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, +'enabled': enabled, +'apiKey': apiKey, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 = { + 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 = { + 'name': name, - 'host': host, - 'port': port, - 'username': username, - 'password': password, - 'encryption': encryption?.value, - 'autoTLS': autoTLS, - 'mailer': mailer, - 'fromName': fromName, - 'fromEmail': fromEmail, - 'replyToName': replyToName, - 'replyToEmail': replyToEmail, - 'enabled': enabled, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'host': host, +'port': port, +'username': username, +'password': password, +'encryption': encryption?.value, +'autoTLS': autoTLS, +'mailer': mailer, +'fromName': fromName, +'fromEmail': fromEmail, +'replyToName': replyToName, +'replyToEmail': replyToEmail, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - 'from': from, - 'customerId': customerId, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'customerId': customerId, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'customerId': customerId, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'customerId': customerId, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'username': username, - 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +'from': from, +'username': username, +'apiKey': apiKey, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'username': username, - 'apiKey': apiKey, - 'from': from, +'enabled': enabled, +'username': username, +'apiKey': apiKey, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'accountSid': accountSid, - 'authToken': authToken, - 'enabled': enabled, +'name': name, +'from': from, +'accountSid': accountSid, +'authToken': authToken, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'accountSid': accountSid, - 'authToken': authToken, - 'from': from, +'enabled': enabled, +'accountSid': accountSid, +'authToken': authToken, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'from': from, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'enabled': enabled, +'name': name, +'from': from, +'apiKey': apiKey, +'apiSecret': apiSecret, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'name': name, - 'enabled': enabled, - 'apiKey': apiKey, - 'apiSecret': apiSecret, - 'from': from, +'enabled': enabled, +'apiKey': apiKey, +'apiSecret': apiSecret, +'from': from, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } + } /// Get the provider activity logs listed by its unique ID. - Future listProviderLogs({ - required String providerId, - List? queries, - }) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( - '{providerId}', - providerId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listProviderLogs({required String providerId, List? queries}) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs' - .replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs({required String subscriberId, List? queries}) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + '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.LogList.fromMap(res.data); - } + + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({ - List? queries, - String? search, - }) async { - final String apiPath = '/messaging/topics'; + Future listTopics({List? queries, String? search}) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'subscribe': subscribe, +'name': name, +'subscribe': subscribe, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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; - return res.data; - } + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs({ - required String topicId, - List? queries, - }) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( - '{topicId}', - topicId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTopicLogs({required String topicId, List? queries}) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( - '{topicId}', - topicId, - ); + Future listSubscribers({required String topicId, List? queries, String? search}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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 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); - - 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; - } -} + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/sites.dart b/lib/services/sites.dart index d89f2192..5481986e 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,296 +1,247 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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? outputDirectory, - enums.Adapter? adapter, - String? installationId, - String? fallbackFile, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites'; final Map apiParams = { + 'siteId': siteId, - 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime.value, - 'adapter': adapter?.value, - 'installationId': installationId, - 'fallbackFile': fallbackFile, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'name': name, +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime.value, +'adapter': adapter?.value, +'installationId': installationId, +'fallbackFile': fallbackFile, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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? outputDirectory, - enums.BuildRuntime? buildRuntime, - enums.Adapter? adapter, - String? fallbackFile, - String? installationId, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? specification, - }) 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'name': name, - 'framework': framework.value, - 'enabled': enabled, - 'logging': logging, - 'timeout': timeout, - 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime?.value, - 'adapter': adapter?.value, - 'fallbackFile': fallbackFile, - 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - 'providerBranch': providerBranch, - 'providerSilentMode': providerSilentMode, - 'providerRootDirectory': providerRootDirectory, - 'specification': specification, - }; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); +'framework': framework.value, +'enabled': enabled, +'logging': logging, +'timeout': timeout, +'installCommand': installCommand, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime?.value, +'adapter': adapter?.value, +'fallbackFile': fallbackFile, +'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +'providerBranch': providerBranch, +'providerSilentMode': providerSilentMode, +'providerRootDirectory': providerRootDirectory, +'specification': specification, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future listDeployments({required String siteId, List? queries, String? search}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({ - required String siteId, - required InputFile code, - required bool activate, - String? installCommand, - String? buildCommand, - String? outputDirectory, - Function(UploadProgress)? onProgress, - }) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll( - '{siteId}', - siteId, - ); + Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'installCommand': installCommand, - 'buildCommand': buildCommand, - 'outputDirectory': outputDirectory, - 'code': code, - 'activate': activate, +'buildCommand': buildCommand, +'outputDirectory': outputDirectory, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -305,400 +256,331 @@ 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 apiParams = { + + 'deploymentId': deploymentId, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({ - required String siteId, - required String repository, - required String owner, - required String rootDirectory, - required String version, - 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 String version, bool? activate}) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'version': version, - 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'version': version, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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.VCSDeploymentType type, - required String reference, - bool? activate, - }) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll( - '{siteId}', - siteId, - ); + Future createVcsDeployment({required String siteId, required enums.VCSDeploymentType 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, - 'activate': activate, +'reference': reference, +'activate': activate, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 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, - }) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll( - '{siteId}', - siteId, - ); + Future listLogs({required String siteId, List? queries}) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - final Map apiParams = {'queries': queries}; + final Map apiParams = { + 'queries': queries, - 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.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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, required String value, bool? secret}) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, required 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 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } -} + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} \ No newline at end of file diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ee630883..ccdce915 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,226 +1,184 @@ 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, - }) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({List? queries, String? search}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - }) 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}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { + 'bucketId': bucketId, - 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'name': name, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'fileSecurity': fileSecurity, - 'enabled': enabled, - 'maximumFileSize': maximumFileSize, - 'allowedFileExtensions': allowedFileExtensions, - 'compression': compression?.value, - 'encryption': encryption, - 'antivirus': antivirus, +'permissions': permissions, +'fileSecurity': fileSecurity, +'enabled': enabled, +'maximumFileSize': maximumFileSize, +'allowedFileExtensions': allowedFileExtensions, +'compression': compression?.value, +'encryption': encryption, +'antivirus': antivirus, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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, - }) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( - '{bucketId}', - bucketId, - ); + Future listFiles({required String bucketId, List? queries, String? search}) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'permissions': permissions, +'file': file, +'permissions': permissions, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -236,187 +194,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 = { + 'name': name, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 Map apiHeaders = { + 'content-type': 'application/json', - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + }; - return res.data; - } + 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 = { '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 = { 'width': width, - 'height': height, - 'gravity': gravity?.value, - 'quality': quality, - 'borderWidth': borderWidth, - 'borderColor': borderColor, - 'borderRadius': borderRadius, - 'opacity': opacity, - 'rotation': rotation, - 'background': background, - 'output': output?.value, - 'token': token, - +'height': height, +'gravity': gravity?.value, +'quality': quality, +'borderWidth': borderWidth, +'borderColor': borderColor, +'borderRadius': borderRadius, +'opacity': opacity, +'rotation': rotation, +'background': background, +'output': output?.value, +'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 = { '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; - } -} + } +} \ No newline at end of file diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index f9d86004..6a007ccd 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1520 +1,1162 @@ 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, - }) async { - final String apiPath = '/tablesdb'; + Future list({List? queries, String? search}) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'enabled': enabled, +'name': name, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - } + + } /// 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, - required String name, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll( - '{databaseId}', - databaseId, - ); - - final Map apiParams = {'name': name, 'enabled': enabled}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future update({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - } + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( - '{databaseId}', - databaseId, - ); + Future listTables({required String databaseId, List? queries, String? search}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createTable({ - required String databaseId, - required String tableId, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'tableId': tableId, - 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'name': name, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future updateTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - 'rowSecurity': rowSecurity, - 'enabled': enabled, +'permissions': permissions, +'rowSecurity': rowSecurity, +'enabled': enabled, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - return res.data; - } + } /// List columns in the table. - Future listColumns({ - required String databaseId, - required String tableId, - List? queries, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listColumns({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); + /// + 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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 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, - 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - 'onDelete': onDelete?.value, +'type': type.value, +'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +'onDelete': onDelete?.value, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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, - 'array': array, - 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +'array': array, +'encrypt': encrypt, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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. - /// - 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); + /// + 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 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 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, - 'array': array, +'required': xrequired, +'default': xdefault, +'array': array, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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); - } + + } /// 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); - - return res.data; - } + 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 apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } /// 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); - - 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; - } + 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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listIndexes({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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.IndexType 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.IndexType 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, - 'orders': orders, - 'lengths': lengths, +'type': type.value, +'columns': columns, +'orders': orders, +'lengths': lengths, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + 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 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); - - 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; - } + 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 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 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRow({ - required String databaseId, - required String tableId, - required String rowId, - required Map data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'rowId': rowId, - 'data': data, - 'permissions': permissions, +'data': data, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future createRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - /// - Future upsertRows({ - required String databaseId, - required String tableId, - required List rows, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'rows': rows}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future upsertRows({required String databaseId, required String tableId, required List rows}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'rows': rows, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'data': data, 'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future updateRows({required String databaseId, required String tableId, Map? data, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'data': data, +'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.delete, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future deleteRows({required String databaseId, required String tableId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'queries': queries, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future getRow({required String databaseId, required String tableId, required String rowId, List? queries}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future upsertRow({ - required String databaseId, - required String tableId, - required String rowId, - Map? data, - List? permissions, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) 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}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'data': data, - 'permissions': permissions, +'permissions': permissions, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); - - 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; - } + Future deleteRow({required String databaseId, required String tableId, required String rowId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + + 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; + + } /// 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, - }) 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 = {'value': value, 'min': min}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future decrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? min}) 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 = { + + 'value': value, +'min': min, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - }) 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 = {'value': value, 'max': max}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future incrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? max}) 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 = { + + 'value': value, +'max': max, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/teams.dart b/lib/services/teams.dart index 5fd59641..c21a93af 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,147 +1,140 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'roles': roles, +'name': name, +'roles': roles, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiParams = {'name': name}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - 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, - }) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll( - '{teamId}', - teamId, - ); + Future listMemberships({required String teamId, List? queries, String? search}) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 @@ -149,210 +142,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 = { + 'email': email, - 'userId': userId, - 'phone': phone, - 'roles': roles, - 'url': url, - 'name': name, +'userId': userId, +'phone': phone, +'roles': roles, +'url': url, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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); - - 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, - ); + /// + 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); 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 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; - 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); - - final Map apiParams = {'userId': userId, 'secret': secret}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + 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, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } -} + + } +} \ No newline at end of file diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index 4e6915dc..cb04449b 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,113 +1,109 @@ 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, - }) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future list({required String bucketId, required String fileId, List? queries}) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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); - - 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, - ); + 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); 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 apiParams = {'expire': expire}; + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 apiHeaders = { + 'content-type': 'application/json', - 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; - return res.data; - } -} + } +} \ No newline at end of file diff --git a/lib/services/users.dart b/lib/services/users.dart index eda483bb..77d11d61 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,359 +1,314 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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, - 'password': password, - 'name': name, +'email': email, +'phone': phone, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - }) async { - final String apiPath = '/users/identities'; + Future listIdentities({List? queries, String? search}) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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 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; - 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordCpu': passwordCpu, +'passwordMemory': passwordMemory, +'passwordParallel': passwordParallel, +'passwordLength': passwordLength, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordSaltSeparator': passwordSaltSeparator, +'passwordSignerKey': passwordSignerKey, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - 'passwordVersion': passwordVersion?.value, - 'name': name, +'email': email, +'password': password, +'passwordVersion': passwordVersion?.value, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 @@ -361,909 +316,782 @@ 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 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; - 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, - ); - - 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, - ); + 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); 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 = { + 'sessionId': sessionId, - 'duration': duration, +'duration': duration, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// Get the user activity logs list by its unique ID. - Future listLogs({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/logs'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listLogs({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - }) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll( - '{userId}', - userId, - ); + Future listMemberships({required String userId, List? queries, String? search}) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); final Map apiParams = { 'queries': queries, - 'search': search, +'search': search, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.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); - - 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, - ); + @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); 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 apiParams = { + + 'mfa': mfa, - final Map apiHeaders = {'content-type': 'application/json'}; + }; - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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); - - 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; - } + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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; - 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.put, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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, - ); - - final Map apiParams = {}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.patch, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + @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 apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); 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, - ); - - 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, - ); + 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); return models.Preferences.fromMap(res.data); - } + + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll( - '{userId}', - userId, - ); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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 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 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; - } + 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 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; - 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, - ); - - 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, - ); + 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); return models.User.fromMap(res.data); - } + + } /// List the messaging targets that are associated with a user. - Future listTargets({ - required String userId, - List? queries, - }) async { - final String apiPath = '/users/{userId}/targets'.replaceAll( - '{userId}', - userId, - ); - - final Map apiParams = {'queries': queries}; - - final Map apiHeaders = {}; - - final res = await client.call( - HttpMethod.get, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + Future listTargets({required String userId, List? queries}) async { + final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); + + final Map apiParams = { + 'queries': queries, + + + }; + + final Map 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, - 'providerId': providerId, - 'name': name, +'providerType': providerType.value, +'identifier': identifier, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 = { + 'identifier': identifier, - 'providerId': providerId, - 'name': name, +'providerId': providerId, +'name': name, + }; - final Map apiHeaders = {'content-type': 'application/json'}; + 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 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; - 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, - ); - - final Map apiParams = {'length': length, 'expire': expire}; - - final Map apiHeaders = {'content-type': 'application/json'}; - - final res = await client.call( - HttpMethod.post, - path: apiPath, - params: apiParams, - headers: apiHeaders, - ); + /// + Future createToken({required String userId, int? length, int? expire}) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll('{userId}', userId); + + final Map apiParams = { + + 'length': length, +'expire': expire, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + 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 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 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); - } -} + + } +} \ No newline at end of file diff --git a/lib/src/client.dart b/lib/src/client.dart index d82d623a..0d9be210 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,8 +81,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 08d93b85..cd82d264 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,25 +2,21 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index c961873f..ea2cd62a 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,11 +9,14 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -31,66 +34,59 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format': '1.8.0', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -139,11 +135,7 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -170,19 +162,12 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 2bd7d639..f9e695bf 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,11 +10,17 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({required String endPoint, required bool selfSigned}) => - ClientIO(endPoint: endPoint, selfSigned: selfSigned); +ClientBase createClient({ + required String endPoint, + required bool selfSigned, +}) => + ClientIO( + endPoint: endPoint, + selfSigned: selfSigned, + ); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5 * 1024 * 1024; + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -37,68 +43,60 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent': - 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format': '1.8.0', + 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format' : '1.8.0', }; config = {}; - assert( - _endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'", - ); + assert(_endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'"); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -153,16 +151,11 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, - file.path!, - filename: file.filename, - ); + paramName, file.path!, + filename: file.filename); } else { - 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, @@ -201,19 +194,12 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call( - HttpMethod.post, - path: path, - headers: headers, - params: params, - ); + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -258,7 +244,10 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse(res, responseType: responseType); + return prepareResponse( + res, + responseType: responseType, + ); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 06c9ebe3..658b79b6 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest).fields.addAll({ - "$key[$i]": v.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({"$key[$i]": v.toString()}); }); } else { - (request as http.MultipartRequest).fields.addAll({ - key: value.toString(), - }); + (request as http.MultipartRequest) + .fields + .addAll({key: value.toString()}); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value) { + params = params.map((key, value){ if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,13 +51,12 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port, - ); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -67,9 +66,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); @@ -116,25 +113,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.dart b/lib/src/enums.dart index 0f250ea3..595afdc2 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes, + bytes } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 3341912f..2f198d4e 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 1bae5c8a..cd45b6a1 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 42954430..7d2d7016 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,16 +1,18 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 e20f48c6..af5ebaad 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,24 +1,26 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index b101d35f..8d86530d 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({required this.value}); + const IndexType({ + 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/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/name.dart b/lib/src/enums/name.dart index 74823feb..613bf5f1 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,22 +1,24 @@ 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'), - 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'), + 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 383e45b1..076c1c50 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,50 +1,52 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d4fef930..d34440ec 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,75 +1,77 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index f01fcb01..0bf8e2ad 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({required this.value}); + const VCSDeploymentType({ + 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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index 4145f701..f174d569 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 4e901476..c9f67200 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 35c7b767..2fabb416 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index 7d27adba..fdcee07a 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index fec6f65a..120723df 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 0e80700f..504b5f8f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 bae6618f..5f3e1654 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"type": type}; - } + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 0ca54691..20dd7189 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1df01f19..a5b27b4f 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 21f8e9a3..96ce554b 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 298c181a..a4953a0e 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 c6eecadd..03ba94c7 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 1ef48332..8a5aa89d 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8c8fcb73..d17f414a 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index c5fa6adc..4098a5a1 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "attributes": attributes}; - } + Map toMap() { + return { + "total": total, + "attributes": attributes, + }; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 903c6290..050cbe14 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7374fa78..2202d255 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index f0bc295e..0c3ddf9e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index b8fb5e48..3bb374be 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 66e58c20..b02adbf6 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "buckets": buckets.map((p) => p.toMap()).toList()}; - } + 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 72de429d..c55110cf 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 5322aaab..240e2ce0 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 9d5013c0..b7ce71b8 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 2341fc3b..df80cfbb 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a822c4e5..a92a0a5b 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 115108a4..9605a6a9 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a3a4e3b7..200e2c78 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 9d637d92..acf0f6df 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 a7983a62..576937e7 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,24 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 82bf6734..5ba4e70b 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 13bb322c..e0be4633 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 8eb0171f..475c1c40 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,22 +2,28 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"total": total, "columns": columns}; - } + Map toMap() { + return { + "total": total, + "columns": columns, + }; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index 6221c01e..e55d1534 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 7b560989..6fd6a3b0 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 66c0ce7b..94271aa6 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 7318b7ad..1a9c5038 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index ec2c0755..5e954a05 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 c52b50f2..565b1d66 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,19 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code}; - } + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 65e13be3..073fa251 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 27eef0c1..deafffe3 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 7a957f1a..1c99fdf9 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 8d79e052..cab95b02 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 5afa7932..5eb5c0ce 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 448c62c7..ecf7e791 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index df81710a..78ba8ab2 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index cf85e457..be424a9c 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 4065e17b..d45ea081 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,30 +2,31 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 8dfbeab6..809106a9 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,128 +2,124 @@ 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 String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "deploymentId": deploymentId, - "trigger": trigger, - "status": status, - "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 String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "deploymentId": deploymentId, + "trigger": trigger, + "status": status, + "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 4ed73943..d44139ee 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 a6a9fa46..de8439ec 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 63f49abc..94ea9a14 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "files": files.map((p) => p.toMap()).toList()}; - } + 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 693c9b07..ea6b601a 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,48 +2,46 @@ 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)), - ), - ); - } - - 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))), + ); + } + + 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 0b908240..7614616a 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 eb8145d4..afe8f6b3 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 56c2eded..64401c3f 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index 34d7225c..d5974f55 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,25 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 463cf696..ecf0a178 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "value": value}; - } + Map toMap() { + return { + "name": name, + "value": value, + }; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index fa402e97..54c31e70 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,22 +2,28 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return {"version": version, "status": status}; - } + Map toMap() { + return { + "version": version, + "status": status, + }; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index d412eba9..0a5b6ce9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 5f06906b..95da1235 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,16 +2,22 @@ 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'], + ); + } - Map toMap() { - return {"size": size}; - } + Map toMap() { + return { + "size": size, + }; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 59b7092c..0d6e7216 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,26 +2,34 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return {"name": name, "ping": ping, "status": status}; - } + Map toMap() { + return { + "name": name, + "ping": ping, + "status": status, + }; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index dec2d54f..102dfe77 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,30 +2,34 @@ 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'], + ); + } - Map toMap() { - return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; - } + Map toMap() { + return { + "remoteTime": remoteTime, + "localTime": localTime, + "diff": diff, + }; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index 807bdfd0..c43c4d57 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 b4c63f7d..b8358fc1 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 9d6d7aec..b6717c4e 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 6d285a6a..fef735fc 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "indexes": indexes.map((p) => p.toMap()).toList()}; - } + 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 490a1824..1b4ff7de 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,16 +2,22 @@ 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(), + ); + } - Map toMap() { - return {"jwt": jwt}; - } + Map toMap() { + return { + "jwt": jwt, + }; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 9c45adb1..43eaad08 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,26 +2,34 @@ 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(), + ); + } - Map toMap() { - return {"name": name, "code": code, "nativeName": nativeName}; - } + 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 2e65839e..ea731471 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 084475bf..b5e9ad1a 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 cd5a1155..10499ef5 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"code": code, "name": name}; - } + 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 be6ddb1f..c1243e06 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 7fb3f364..cb567bd7 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 22273a8c..9d4d7701 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "logs": logs.map((p) => p.toMap()).toList()}; - } + 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 8ee142ad..26610e46 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index a4d39dca..f08f5738 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 9b93b00d..c4e9e858 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index 15ddf642..acaacc34 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 96bf3c65..46c166fb 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 c930a23e..d49989d8 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 63411988..6c8b4e36 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,18 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return {"recoveryCodes": recoveryCodes}; - } + Map toMap() { + return { + "recoveryCodes": recoveryCodes, + }; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index fa57cb8b..01cf0857 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,22 +2,28 @@ 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(), + ); + } - Map toMap() { - return {"secret": secret, "uri": uri}; - } + Map toMap() { + return { + "secret": secret, + "uri": uri, + }; + } } 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/phone.dart b/lib/src/models/phone.dart index 40f7bcd2..c8bbb95b 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 879edbc4..2d869308 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "phones": phones.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index 7bc3abc9..edb6083e 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,17 +2,23 @@ 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); - } + factory Preferences.fromMap(Map map) { + return Preferences( + data: map, + ); + } - Map toMap() { - return {"data": data}; - } + 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/provider.dart b/lib/src/models/provider.dart index 1a762f85..4295c486 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 9347fefb..9710aea9 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index dad35dcc..ed520cc4 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 2283653f..fcdabb97 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,24 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "tokens": tokens.map((p) => p.toMap()).toList()}; - } + 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 3700e577..62e69e5b 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 01f046c6..a8374e2b 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,25 +2,31 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "rows": rows.map((p) => p.toMap()).toList()}; - } + 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 7c9677d8..35f82cfa 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 64bc2e08..c234990c 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 d2fe4f64..3a1d955f 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 e9c478af..0257cb86 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 1449f8bd..5cda6acc 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index e74b0d81..cc9e4355 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "sites": sites.map((p) => p.toMap()).toList()}; - } + 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 e8fb8c75..e49d399c 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,35 +2,40 @@ 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(), + ); + } - Map toMap() { - return {"memory": memory, "cpus": cpus, "enabled": enabled, "slug": slug}; - } + 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 de4957d2..0d2b6a73 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 0c926297..36e18a7e 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 6a135b92..6c8c21e2 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 7ce86b9d..1c5b88fb 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,78 +2,76 @@ 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; - 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, - }); + 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, + }); - 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)), - ), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index ebe15c71..2b4b4b41 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "tables": tables.map((p) => p.toMap()).toList()}; - } + 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 4be8b545..f2b3b6b4 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 84233d1d..6ef2725d 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "targets": targets.map((p) => p.toMap()).toList()}; - } + 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 43df33a8..e9058b5b 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 a3994c06..a61cc9f7 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "teams": teams.map((p) => p.toMap()).toList()}; - } + 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 35115467..4f6b8454 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 430d44ac..461d5694 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 eefc62b6..1582a3c7 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; - } + Map toMap() { + return { + "total": total, + "topics": topics.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index 50bfb3ce..effc397c 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 2419d818..edf7a95d 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,22 +2,28 @@ 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))), + ); + } - Map toMap() { - return {"total": total, "users": users.map((p) => p.toMap()).toList()}; - } + 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 2a8e276a..58882a9f 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 ffa58eef..ee1f6f7a 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,27 +2,28 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } From dacb79c6a35120546012c289c75a857c3e34c4c5 Mon Sep 17 00:00:00 2001 From: abnegate Date: Mon, 25 Aug 2025 16:26:05 +0000 Subject: [PATCH 22/22] Commit from GitHub Actions (Format and push) --- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/query.dart | 16 +- lib/role.dart | 2 +- lib/services/account.dart | 1471 ++++++------ lib/services/avatars.dart | 196 +- lib/services/databases.dart | 2083 ++++++++++------- lib/services/functions.dart | 869 ++++--- lib/services/graphql.dart | 58 +- lib/services/health.dart | 543 +++-- lib/services/locale.dart | 194 +- lib/services/messaging.dart | 2260 +++++++++++-------- lib/services/sites.dart | 822 ++++--- lib/services/storage.dart | 428 ++-- lib/services/tables_db.dart | 1848 +++++++++------ lib/services/teams.dart | 421 ++-- lib/services/tokens.dart | 154 +- lib/services/users.dart | 1582 +++++++------ lib/src/client.dart | 5 +- lib/src/client_base.dart | 6 +- lib/src/client_browser.dart | 123 +- lib/src/client_io.dart | 143 +- lib/src/client_mixin.dart | 64 +- lib/src/enums.dart | 2 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/build_runtime.dart | 140 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/execution_method.dart | 22 +- lib/src/enums/flag.dart | 400 ++-- lib/src/enums/framework.dart | 38 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_type.dart | 16 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/name.dart | 34 +- lib/src/enums/o_auth_provider.dart | 90 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 140 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/vcs_deployment_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/algo_argon2.dart | 60 +- lib/src/models/algo_bcrypt.dart | 24 +- lib/src/models/algo_md5.dart | 24 +- lib/src/models/algo_phpass.dart | 24 +- lib/src/models/algo_scrypt.dart | 84 +- lib/src/models/algo_scrypt_modified.dart | 60 +- lib/src/models/algo_sha.dart | 24 +- lib/src/models/attribute_boolean.dart | 110 +- lib/src/models/attribute_datetime.dart | 120 +- lib/src/models/attribute_email.dart | 120 +- lib/src/models/attribute_enum.dart | 130 +- lib/src/models/attribute_float.dart | 130 +- lib/src/models/attribute_integer.dart | 130 +- lib/src/models/attribute_ip.dart | 120 +- lib/src/models/attribute_list.dart | 34 +- lib/src/models/attribute_relationship.dart | 192 +- lib/src/models/attribute_string.dart | 130 +- lib/src/models/attribute_url.dart | 120 +- lib/src/models/bucket.dart | 140 +- lib/src/models/bucket_list.dart | 34 +- lib/src/models/collection.dart | 120 +- lib/src/models/collection_list.dart | 39 +- lib/src/models/column_boolean.dart | 110 +- lib/src/models/column_datetime.dart | 120 +- lib/src/models/column_email.dart | 120 +- lib/src/models/column_enum.dart | 130 +- lib/src/models/column_float.dart | 130 +- lib/src/models/column_index.dart | 120 +- lib/src/models/column_index_list.dart | 36 +- lib/src/models/column_integer.dart | 130 +- lib/src/models/column_ip.dart | 120 +- lib/src/models/column_list.dart | 34 +- lib/src/models/column_relationship.dart | 192 +- lib/src/models/column_string.dart | 130 +- lib/src/models/column_url.dart | 120 +- lib/src/models/continent.dart | 34 +- lib/src/models/continent_list.dart | 39 +- lib/src/models/country.dart | 31 +- lib/src/models/country_list.dart | 39 +- lib/src/models/currency.dart | 108 +- lib/src/models/currency_list.dart | 39 +- lib/src/models/database.dart | 96 +- lib/src/models/database_list.dart | 39 +- lib/src/models/deployment.dart | 338 +-- lib/src/models/deployment_list.dart | 39 +- lib/src/models/document.dart | 100 +- lib/src/models/document_list.dart | 43 +- lib/src/models/execution.dart | 244 +- lib/src/models/execution_list.dart | 39 +- lib/src/models/file.dart | 130 +- lib/src/models/file_list.dart | 34 +- lib/src/models/framework.dart | 86 +- lib/src/models/framework_adapter.dart | 84 +- lib/src/models/framework_list.dart | 39 +- lib/src/models/function.dart | 348 +-- lib/src/models/function_list.dart | 37 +- lib/src/models/headers.dart | 34 +- lib/src/models/health_antivirus.dart | 34 +- lib/src/models/health_certificate.dart | 96 +- lib/src/models/health_queue.dart | 24 +- lib/src/models/health_status.dart | 42 +- lib/src/models/health_time.dart | 46 +- lib/src/models/identity.dart | 120 +- lib/src/models/identity_list.dart | 39 +- lib/src/models/index.dart | 120 +- lib/src/models/index_list.dart | 34 +- lib/src/models/jwt.dart | 24 +- lib/src/models/language.dart | 42 +- lib/src/models/language_list.dart | 39 +- lib/src/models/locale.dart | 108 +- lib/src/models/locale_code.dart | 34 +- lib/src/models/locale_code_list.dart | 39 +- lib/src/models/log.dart | 276 +-- lib/src/models/log_list.dart | 34 +- lib/src/models/membership.dart | 180 +- lib/src/models/membership_list.dart | 39 +- lib/src/models/message.dart | 180 +- lib/src/models/message_list.dart | 39 +- lib/src/models/mfa_challenge.dart | 60 +- lib/src/models/mfa_factors.dart | 60 +- lib/src/models/mfa_recovery_codes.dart | 26 +- lib/src/models/mfa_type.dart | 34 +- lib/src/models/model.dart | 2 +- lib/src/models/phone.dart | 50 +- lib/src/models/phone_list.dart | 34 +- lib/src/models/preferences.dart | 24 +- lib/src/models/provider.dart | 110 +- lib/src/models/provider_list.dart | 39 +- lib/src/models/resource_token.dart | 108 +- lib/src/models/resource_token_list.dart | 36 +- lib/src/models/row.dart | 100 +- lib/src/models/row_list.dart | 38 +- lib/src/models/runtime.dart | 100 +- lib/src/models/runtime_list.dart | 39 +- lib/src/models/session.dart | 358 +-- lib/src/models/session_list.dart | 39 +- lib/src/models/site.dart | 358 +-- lib/src/models/site_list.dart | 34 +- lib/src/models/specification.dart | 55 +- lib/src/models/specification_list.dart | 39 +- lib/src/models/subscriber.dart | 110 +- lib/src/models/subscriber_list.dart | 39 +- lib/src/models/table.dart | 122 +- lib/src/models/table_list.dart | 34 +- lib/src/models/target.dart | 110 +- lib/src/models/target_list.dart | 34 +- lib/src/models/team.dart | 96 +- lib/src/models/team_list.dart | 34 +- lib/src/models/token.dart | 96 +- lib/src/models/topic.dart | 100 +- lib/src/models/topic_list.dart | 34 +- lib/src/models/user.dart | 252 +-- lib/src/models/user_list.dart | 34 +- lib/src/models/variable.dart | 100 +- lib/src/models/variable_list.dart | 39 +- 164 files changed, 13096 insertions(+), 11463 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/query.dart b/lib/query.dart index 281aa756..c9a2fc91 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -11,11 +11,11 @@ class Query { Map toJson() { final map = {'method': method}; - if(attribute != null) { + if (attribute != null) { map['attribute'] = attribute; } - - if(values != null) { + + if (values != null) { map['values'] = values is List ? values : [values]; } @@ -26,7 +26,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. @@ -144,14 +144,14 @@ class Query { Query._('orderDesc', attribute).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) => @@ -161,9 +161,9 @@ 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(); -} \ 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 9225f30a..d0c820a1 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,27 +1,26 @@ 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 +29,32 @@ 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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,661 +63,674 @@ 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 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}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries}) async { + final String apiPath = '/account/identities'; - final Map apiParams = { - 'queries': queries, - - - }; + final Map apiParams = {'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.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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/account/identities/{identityId}'.replaceAll( + '{identityId}', + identityId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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() async { - final String apiPath = '/account/jwts'; - - final Map apiParams = { - - - }; + Future createJWT() async { + final String apiPath = '/account/jwts'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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.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}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries}) async { + final String apiPath = '/account/logs'; - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.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 apiParams = {'mfa': mfa}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + @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 apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future createMFAAuthenticator({ + required enums.AuthenticatorType type, + }) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - 'otp': otp, - - }; + @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 apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - 'otp': otp, + 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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + @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 res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteMFAAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll( + '{type}', + type.value, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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/challenge'; - - 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); + @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/challenge'; + + 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, + ); 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/challenge'; + Future createMFAChallenge({ + required enums.AuthenticationFactor factor, + }) async { + final String apiPath = '/account/mfa/challenge'; - final Map apiParams = { - - 'factor': factor.value, + final Map apiParams = {'factor': factor.value}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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/challenge'; + @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/challenge'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/challenge'; + Future updateMFAChallenge({ + required String challengeId, + required String otp, + }) async { + final String apiPath = '/account/mfa/challenge'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 apiHeaders = { - 'content-type': 'application/json', + 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 apiHeaders = { - 'content-type': 'application/json', + 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 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 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'; - - final Map apiParams = { - - 'name': name, + Future updateName({required String name}) async { + final String apiPath = '/account/name'; - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'oldPassword': oldPassword, - + 'oldPassword': oldPassword, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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'; - - final Map apiParams = { - - 'prefs': prefs, - - }; + Future updatePrefs({required Map prefs}) async { + final String apiPath = '/account/prefs'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -724,99 +740,98 @@ 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'; - - final Map apiParams = { - - 'email': email, -'url': url, - - }; + Future createRecovery({ + required String email, + required String url, + }) async { + final String apiPath = '/account/recovery'; - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {'email': email, '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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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 @@ -825,213 +840,212 @@ 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'; - - final Map apiParams = { - - - }; + Future createAnonymousSession() async { + final String apiPath = '/account/sessions/anonymous'; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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.') - Future updateMagicURLSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/magic-url'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updateMagicURLSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/magic-url'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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.') - Future updatePhoneSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated('This API has been deprecated.') + Future updatePhoneSession({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/sessions/phone'; + + final Map apiParams = {'userId': userId, 'secret': secret}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {'userId': userId, '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); - - final Map apiParams = { - - - }; + Future updateSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll( + '{sessionId}', + sessionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 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 @@ -1042,32 +1056,35 @@ 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, -'phrase': phrase, - + 'email': email, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 @@ -1078,66 +1095,79 @@ 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, -'url': url, -'phrase': phrase, - + 'email': email, + 'url': url, + 'phrase': phrase, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { 'success': success, -'failure': failure, -'scopes': scopes, + 'failure': failure, + 'scopes': scopes, - 'project': client.config['project'], }; 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)); + query.add( + Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item), + ); } } else if (value != null) { query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); @@ -1145,15 +1175,16 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri(scheme: endpoint.scheme, + Uri url = Uri( + scheme: endpoint.scheme, host: endpoint.host, port: endpoint.port, path: endpoint.path + apiPath, - query: query.join('&') + 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 @@ -1161,30 +1192,29 @@ 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, - - }; + final Map apiParams = {'userId': userId, 'phone': phone}; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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** @@ -1195,56 +1225,52 @@ 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 createVerification({required String url}) async { - final String apiPath = '/account/verification'; - - final Map apiParams = { - - 'url': url, + /// + Future createVerification({required String url}) async { + final String apiPath = '/account/verification'; - }; + final Map apiParams = {'url': url}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 updateVerification({required String userId, required String secret}) async { - final String apiPath = '/account/verification'; + Future updateVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification'; - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; + final Map apiParams = {'userId': userId, 'secret': secret}; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -1254,47 +1280,44 @@ 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/verification/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verification/phone'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/verification/phone'; - - final Map apiParams = { - - 'userId': userId, -'secret': secret, + Future updatePhoneVerification({ + required String userId, + required String secret, + }) async { + final String apiPath = '/account/verification/phone'; - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {'userId': userId, '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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index a91d6d3f..8033f1cd 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,189 +1,255 @@ 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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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 = { 'width': width, -'height': height, -'quality': quality, + 'height': height, + '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, -'width': width, -'height': height, + 'width': width, + '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 = { 'name': name, -'width': width, -'height': height, -'background': background, + 'width': width, + 'height': height, + '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, -'size': size, -'margin': margin, -'download': download, + 'size': size, + 'margin': margin, + '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/databases.dart b/lib/services/databases.dart index f962d8b3..223f1318 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1215 +1,1682 @@ 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}) 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, + }) async { + final String apiPath = '/databases'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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.createDatabase` 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.createDatabase` instead.', + ) + Future create({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases'; final Map apiParams = { - 'databaseId': databaseId, -'name': name, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, bool? enabled}) async { - final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.', + ) + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'collectionId': collectionId, -'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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, required String name, List? permissions, bool? documentSecurity, bool? enabled}) 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, + required String name, + List? permissions, + bool? documentSecurity, + bool? enabled, + }) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'documentSecurity': documentSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'documentSecurity': documentSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + @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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + @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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return 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/{key}/relationship'.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/{key}/relationship' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'onDelete': onDelete?.value, -'newKey': newKey, - + 'newKey': newKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - } + } /// 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'documentId': documentId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'documents': documents, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'documents': documents}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + final Map apiParams = {'queries': queries}; + + final Map 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, required Map data, List? permissions}) 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, + required Map data, + List? permissions, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); - - 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; - - } + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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, + }) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'attributes': attributes, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 index by 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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); - - 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; - - } -} \ No newline at end of file + @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 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/functions.dart b/lib/services/functions.dart index 05a7d5f7..e86f1afe 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,256 +1,316 @@ 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}) async { - final String apiPath = '/functions'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/functions'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? specification}) 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? specification, + }) async { + final String apiPath = '/functions'; final Map apiParams = { - 'functionId': functionId, -'name': name, -'runtime': runtime.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'name': name, + 'runtime': runtime.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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? specification}) 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? specification, + }) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'name': name, -'runtime': runtime?.value, -'execute': execute, -'events': events, -'schedule': schedule, -'timeout': timeout, -'enabled': enabled, -'logging': logging, -'entrypoint': entrypoint, -'commands': commands, -'scopes': scopes, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - + 'runtime': runtime?.value, + 'execute': execute, + 'events': events, + 'schedule': schedule, + 'timeout': timeout, + 'enabled': enabled, + 'logging': logging, + 'entrypoint': entrypoint, + 'commands': commands, + 'scopes': scopes, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String functionId}) async { + final String apiPath = '/functions/{functionId}'.replaceAll( + '{functionId}', + functionId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateFunctionDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployment'.replaceAll( + '{functionId}', + functionId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); + Future listDeployments({ + required String functionId, + List? queries, + String? search, + }) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 = { - 'entrypoint': entrypoint, -'commands': commands, -'code': code, -'activate': activate, - + 'commands': commands, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -265,361 +325,446 @@ 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, -'buildId': buildId, - + 'buildId': buildId, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/functions#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String functionId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/functions/{functionId}/deployments/template' + .replaceAll('{functionId}', functionId); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll('{functionId}', functionId); + Future createVcsDeployment({ + required String functionId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String functionId, + required String deploymentId, + }) async { + final String apiPath = '/functions/{functionId}/deployments/{deploymentId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 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}) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); - - final Map apiParams = { - 'queries': queries, + Future listExecutions({ + required String functionId, + List? queries, + }) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll( + '{functionId}', + functionId, + ); - - }; + final Map apiParams = {'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.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 = { - 'body': body, -'async': xasync, -'path': path, -'method': method?.value, -'headers': headers, -'scheduledAt': scheduledAt, - + 'async': xasync, + 'path': path, + 'method': method?.value, + 'headers': headers, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; + Future deleteExecution({ + required String functionId, + required String executionId, + }) async { + final String apiPath = '/functions/{functionId}/executions/{executionId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{executionId}', executionId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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, + }) async { + final String apiPath = '/functions/{functionId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll( + '{functionId}', + functionId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index e2418b52..18eb54f1 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,51 +1,49 @@ 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 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); - - return res.data; + 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 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); - - return res.data; + final res = await client.call( + HttpMethod.post, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/health.dart b/lib/services/health.dart index 0cf64ac6..5250c91d 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,438 +1,414 @@ 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.HealthStatus.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 = { - 'domain': domain, + final Map apiParams = {'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); - - } + } /// 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.HealthStatus.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.HealthStatus.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 = { - 'threshold': threshold, - - - }; + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueCertificates({int? threshold}) async { + final String apiPath = '/health/queue/certificates'; - - }; + final Map apiParams = {'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 = { 'name': name, -'threshold': threshold, - - + '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 = { - 'threshold': threshold, + final Map apiParams = {'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); - - final Map apiParams = { - 'threshold': threshold, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future getFailedJobs({ + required enums.Name name, + int? threshold, + }) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll( + '{name}', + name.value, + ); + + final Map apiParams = {'threshold': threshold}; + + final Map 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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueFunctions({int? threshold}) async { + final String apiPath = '/health/queue/functions'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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'; - - final Map apiParams = { - 'threshold': threshold, + Future getQueueStatsResources({int? threshold}) async { + final String apiPath = '/health/queue/stats-resources'; - - }; + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 = { - 'threshold': threshold, + final Map apiParams = {'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 @@ -441,21 +417,20 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 430a00c3..4d3cc3e0 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,172 +1,164 @@ 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 23551577..bf5376e5 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1393 +1,1805 @@ 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}) async { - final String apiPath = '/messaging/messages'; + Future listMessages({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'topics': topics, -'users': users, -'targets': targets, -'cc': cc, -'bcc': bcc, -'attachments': attachments, -'draft': draft, -'html': html, -'scheduledAt': scheduledAt, - + 'subject': subject, + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'cc': cc, + 'bcc': bcc, + 'attachments': attachments, + 'draft': draft, + 'html': html, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'title': title, -'body': body, -'topics': topics, -'users': users, -'targets': targets, -'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.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'title': title, + 'body': body, + 'topics': topics, + 'users': users, + 'targets': targets, + '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.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, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + '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, + ); 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, -'topics': topics, -'users': users, -'targets': targets, -'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'draft': draft, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'topics': topics, -'users': users, -'targets': targets, -'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + 'topics': topics, + 'users': users, + 'targets': targets, + 'draft': draft, + 'scheduledAt': scheduledAt, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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}) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listMessageLogs({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String messageId, + List? queries, + }) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll( + '{messageId}', + messageId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/providers'; + Future listProviders({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'authKey': authKey, -'authKeyId': authKeyId, -'teamId': teamId, -'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + 'authKey': authKey, + 'authKeyId': authKeyId, + 'teamId': teamId, + 'bundleId': bundleId, + 'sandbox': sandbox, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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 = { - 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'apiKey': apiKey, -'domain': domain, -'isEuRegion': isEuRegion, -'enabled': enabled, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'apiKey': apiKey, + 'domain': domain, + 'isEuRegion': isEuRegion, + 'enabled': enabled, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, -'enabled': enabled, - + 'name': name, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'templateId': templateId, -'senderId': senderId, -'authKey': authKey, - + 'enabled': enabled, + 'templateId': templateId, + 'senderId': senderId, + 'authKey': authKey, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, - + 'enabled': enabled, + 'apiKey': apiKey, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 = { - 'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 = { - 'name': name, -'host': host, -'port': port, -'username': username, -'password': password, -'encryption': encryption?.value, -'autoTLS': autoTLS, -'mailer': mailer, -'fromName': fromName, -'fromEmail': fromEmail, -'replyToName': replyToName, -'replyToEmail': replyToEmail, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'encryption': encryption?.value, + 'autoTLS': autoTLS, + 'mailer': mailer, + 'fromName': fromName, + 'fromEmail': fromEmail, + 'replyToName': replyToName, + 'replyToEmail': replyToEmail, + 'enabled': enabled, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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, -'from': from, -'customerId': customerId, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'customerId': customerId, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'customerId': customerId, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'customerId': customerId, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'from': from, -'username': username, -'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + 'from': from, + 'username': username, + 'apiKey': apiKey, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'username': username, -'apiKey': apiKey, -'from': from, - + 'enabled': enabled, + 'username': username, + 'apiKey': apiKey, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'from': from, -'accountSid': accountSid, -'authToken': authToken, -'enabled': enabled, - + 'name': name, + 'from': from, + 'accountSid': accountSid, + 'authToken': authToken, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'accountSid': accountSid, -'authToken': authToken, -'from': from, - + 'enabled': enabled, + 'accountSid': accountSid, + 'authToken': authToken, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'from': from, -'apiKey': apiKey, -'apiSecret': apiSecret, -'enabled': enabled, - + 'name': name, + 'from': from, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 = { - 'name': name, -'enabled': enabled, -'apiKey': apiKey, -'apiSecret': apiSecret, -'from': from, - + 'enabled': enabled, + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'from': from, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteProvider({required String providerId}) async { + final String apiPath = '/messaging/providers/{providerId}'.replaceAll( + '{providerId}', + providerId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listProviderLogs({ + required String providerId, + List? queries, + }) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll( + '{providerId}', + providerId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs({ + required String subscriberId, + List? queries, + }) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs' + .replaceAll('{subscriberId}', subscriberId); - final Map apiParams = { - 'queries': queries, + final Map apiParams = {'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.LogList.fromMap(res.data); - - } + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({List? queries, String? search}) async { - final String apiPath = '/messaging/topics'; + Future listTopics({ + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'subscribe': subscribe, - + 'name': name, + 'subscribe': subscribe, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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}) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTopicLogs({ + required String topicId, + List? queries, + }) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll( + '{topicId}', + topicId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); + Future listSubscribers({ + required String topicId, + List? queries, + String? search, + }) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll( + '{topicId}', + topicId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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 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); - - 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; - - } -} \ No newline at end of file + 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 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/sites.dart b/lib/services/sites.dart index 5481986e..d89f2192 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,247 +1,296 @@ 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}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search}) async { + final String apiPath = '/sites'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.Adapter? adapter, + String? installationId, + String? fallbackFile, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites'; final Map apiParams = { - 'siteId': siteId, -'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime.value, -'adapter': adapter?.value, -'installationId': installationId, -'fallbackFile': fallbackFile, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + 'name': name, + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime.value, + 'adapter': adapter?.value, + 'installationId': installationId, + 'fallbackFile': fallbackFile, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? specification}) 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? outputDirectory, + enums.BuildRuntime? buildRuntime, + enums.Adapter? adapter, + String? fallbackFile, + String? installationId, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? specification, + }) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'name': name, -'framework': framework.value, -'enabled': enabled, -'logging': logging, -'timeout': timeout, -'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime?.value, -'adapter': adapter?.value, -'fallbackFile': fallbackFile, -'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -'providerBranch': providerBranch, -'providerSilentMode': providerSilentMode, -'providerRootDirectory': providerRootDirectory, -'specification': specification, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + 'framework': framework.value, + 'enabled': enabled, + 'logging': logging, + 'timeout': timeout, + 'installCommand': installCommand, + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime?.value, + 'adapter': adapter?.value, + 'fallbackFile': fallbackFile, + 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + 'providerBranch': providerBranch, + 'providerSilentMode': providerSilentMode, + 'providerRootDirectory': providerRootDirectory, + 'specification': specification, + }; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + Future delete({required String siteId}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, - - }; + Future updateSiteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployment'.replaceAll( + '{siteId}', + siteId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future listDeployments({ + required String siteId, + List? queries, + String? search, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 function's deployment to use your new deployment ID. - Future createDeployment({required String siteId, required InputFile code, required bool activate, String? installCommand, String? buildCommand, String? outputDirectory, Function(UploadProgress)? onProgress}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future createDeployment({ + required String siteId, + required InputFile code, + required bool activate, + String? installCommand, + String? buildCommand, + String? outputDirectory, + Function(UploadProgress)? onProgress, + }) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'installCommand': installCommand, -'buildCommand': buildCommand, -'outputDirectory': outputDirectory, -'code': code, -'activate': activate, - + 'buildCommand': buildCommand, + 'outputDirectory': outputDirectory, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -256,331 +305,400 @@ 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); - - final Map apiParams = { - - 'deploymentId': deploymentId, + 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 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/server/sites#listTemplates) to /// find the template details. - Future createTemplateDeployment({required String siteId, required String repository, required String owner, required String rootDirectory, required String version, 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 String version, + bool? activate, + }) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'version': version, -'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'version': version, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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.VCSDeploymentType type, required String reference, bool? activate}) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll('{siteId}', siteId); + Future createVcsDeployment({ + required String siteId, + required enums.VCSDeploymentType 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, -'activate': activate, - + 'reference': reference, + 'activate': activate, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteDeployment({ + required String siteId, + required String deploymentId, + }) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); - - final Map apiParams = { - 'queries': queries, + Future listLogs({ + required String siteId, + List? queries, + }) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll( + '{siteId}', + siteId, + ); - - }; + final Map apiParams = {'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.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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { + final String apiPath = '/sites/{siteId}/variables'.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.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 key, + required String value, + bool? secret, + }) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll( + '{siteId}', + siteId, + ); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, + required 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 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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/storage.dart b/lib/services/storage.dart index ccdce915..ee630883 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,184 +1,226 @@ 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}) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({ + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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}) 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, + }) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { - 'bucketId': bucketId, -'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'name': name, + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) 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, + }) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { - 'name': name, -'permissions': permissions, -'fileSecurity': fileSecurity, -'enabled': enabled, -'maximumFileSize': maximumFileSize, -'allowedFileExtensions': allowedFileExtensions, -'compression': compression?.value, -'encryption': encryption, -'antivirus': antivirus, - + 'permissions': permissions, + 'fileSecurity': fileSecurity, + 'enabled': enabled, + 'maximumFileSize': maximumFileSize, + 'allowedFileExtensions': allowedFileExtensions, + 'compression': compression?.value, + 'encryption': encryption, + 'antivirus': antivirus, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future deleteBucket({required String bucketId}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll( + '{bucketId}', + bucketId, + ); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); + Future listFiles({ + required String bucketId, + List? queries, + String? search, + }) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll( + '{bucketId}', + bucketId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'permissions': permissions, - + 'file': file, + 'permissions': permissions, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -194,137 +236,187 @@ 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 = { - 'name': name, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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 = { '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 = { 'width': width, -'height': height, -'gravity': gravity?.value, -'quality': quality, -'borderWidth': borderWidth, -'borderColor': borderColor, -'borderRadius': borderRadius, -'opacity': opacity, -'rotation': rotation, -'background': background, -'output': output?.value, -'token': token, - - + 'height': height, + 'gravity': gravity?.value, + 'quality': quality, + 'borderWidth': borderWidth, + 'borderColor': borderColor, + 'borderRadius': borderRadius, + 'opacity': opacity, + 'rotation': rotation, + 'background': background, + 'output': output?.value, + '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 = { '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; - } -} \ No newline at end of file + } +} diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 6a007ccd..f9d86004 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1162 +1,1520 @@ 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}) async { - final String apiPath = '/tablesdb'; + Future list({ + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'enabled': enabled, - + 'name': name, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - } + } /// 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, required String name, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); - - final Map apiParams = { - - 'name': name, -'enabled': enabled, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + Future update({ + required String databaseId, + required String name, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll( + '{databaseId}', + databaseId, + ); + + final Map apiParams = {'name': name, 'enabled': enabled}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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; - - } + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + Future listTables({ + required String databaseId, + List? queries, + String? search, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll( + '{databaseId}', + databaseId, + ); final Map apiParams = { - 'tableId': tableId, -'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'name': name, + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, required String name, List? permissions, bool? rowSecurity, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future updateTable({ + required String databaseId, + required String tableId, + required String name, + List? permissions, + bool? rowSecurity, + bool? enabled, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'name': name, -'permissions': permissions, -'rowSecurity': rowSecurity, -'enabled': enabled, - + 'permissions': permissions, + 'rowSecurity': rowSecurity, + 'enabled': enabled, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteTable({ + required String databaseId, + required String tableId, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listColumns({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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); + /// + 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 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, -'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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 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, -'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -'onDelete': onDelete?.value, - + 'type': type.value, + 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + 'onDelete': onDelete?.value, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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. - /// - 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); + /// + 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, -'array': array, -'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + 'array': array, + 'encrypt': encrypt, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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. - /// - 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); + /// + 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 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 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, -'array': array, - + 'required': xrequired, + 'default': xdefault, + 'array': array, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 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); - - } + } /// 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - - } + 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 apiHeaders = {}; + + final res = await client.call( + HttpMethod.get, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); + + return res.data; + } /// 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); - - 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; - - } + 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 apiHeaders = {'content-type': 'application/json'}; + + 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listIndexes({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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.IndexType 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.IndexType 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, -'orders': orders, -'lengths': lengths, - + 'type': type.value, + 'columns': columns, + 'orders': orders, + 'lengths': lengths, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + 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 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); - - 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; - - } + 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 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 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRow({required String databaseId, required String tableId, required String rowId, required Map data, List? permissions}) 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, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'rowId': rowId, -'data': data, -'permissions': permissions, - + 'data': data, + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future createRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + Future createRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - /// - Future upsertRows({required String databaseId, required String tableId, required List rows}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'rows': rows, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future upsertRows({ + required String databaseId, + required String tableId, + required List rows, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'rows': rows}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'data': data, -'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future updateRows({ + required String databaseId, + required String tableId, + Map? data, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'data': data, 'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - - final Map apiParams = { - - 'queries': queries, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + Future deleteRows({ + required String databaseId, + required String tableId, + List? queries, + }) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = {'queries': queries}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future getRow({ + required String databaseId, + required String tableId, + required String rowId, + List? queries, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + final Map apiParams = {'queries': queries}; + + final Map 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/server/tablesdb#tablesDBCreateTable) /// API or directly from your database console. - Future upsertRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) 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, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'data': data, -'permissions': permissions, - + 'permissions': permissions, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); - - 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; - - } + Future deleteRow({ + required String databaseId, + required String tableId, + required String rowId, + }) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); + + 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; + } /// 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}) 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 = { - - 'value': value, -'min': min, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future decrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? min, + }) 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 = {'value': value, 'min': min}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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}) 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 = { - - 'value': value, -'max': max, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + Future incrementRowColumn({ + required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? max, + }) 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 = {'value': value, 'max': max}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + final res = await client.call( + HttpMethod.patch, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); return models.Row.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/teams.dart b/lib/services/teams.dart index c21a93af..5fd59641 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,140 +1,147 @@ 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}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search}) async { + final String apiPath = '/teams'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'roles': roles, - + 'name': name, + 'roles': roles, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - 'name': name, + 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 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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}) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); + Future listMemberships({ + required String teamId, + List? queries, + String? search, + }) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll( + '{teamId}', + teamId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 @@ -142,182 +149,210 @@ 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 = { - 'email': email, -'userId': userId, -'phone': phone, -'roles': roles, -'url': url, -'name': name, - + 'userId': userId, + 'phone': phone, + 'roles': roles, + 'url': url, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - 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); + /// + 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, + ); 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'userId': userId, -'secret': secret, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + /// + 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}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } -} \ No newline at end of file + } +} diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index cb04449b..4e6915dc 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,109 +1,113 @@ 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}) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future list({ + required String bucketId, + required String fileId, + List? queries, + }) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); + + final Map apiParams = {'queries': queries}; + + final Map 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); - - 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); + 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, + ); 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); - - final Map apiParams = { - - 'expire': expire, + 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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', + Future delete({required String tokenId}) async { + final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + final res = await client.call( + HttpMethod.delete, + path: apiPath, + params: apiParams, + headers: apiHeaders, + ); - } -} \ No newline at end of file + return res.data; + } +} diff --git a/lib/services/users.dart b/lib/services/users.dart index 77d11d61..eda483bb 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,314 +1,359 @@ 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}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search}) async { + final String apiPath = '/users'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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, -'password': password, -'name': name, - + 'email': email, + 'phone': phone, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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}) async { - final String apiPath = '/users/identities'; + Future listIdentities({ + List? queries, + String? search, + }) async { + final String apiPath = '/users/identities'; final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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 Map apiHeaders = {'content-type': 'application/json'}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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, -'name': name, - + 'email': email, + 'password': password, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordCpu': passwordCpu, + 'passwordMemory': passwordMemory, + 'passwordParallel': passwordParallel, + 'passwordLength': passwordLength, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordSaltSeparator': passwordSaltSeparator, + 'passwordSignerKey': passwordSignerKey, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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, -'passwordVersion': passwordVersion?.value, -'name': name, - + 'email': email, + 'password': password, + 'passwordVersion': passwordVersion?.value, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', + 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 @@ -316,782 +361,909 @@ 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 apiHeaders = { - 'content-type': 'application/json', - - }; + final Map apiParams = {}; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); 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 = { - 'sessionId': sessionId, -'duration': duration, - + 'duration': duration, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// Get the user activity logs list by its unique ID. - Future listLogs({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listLogs({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/logs'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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}) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); + Future listMemberships({ + required String userId, + List? queries, + String? search, + }) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll( + '{userId}', + userId, + ); final Map apiParams = { 'queries': queries, -'search': search, - - + 'search': search, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.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); - - 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); + @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, + ); 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 apiParams = {'mfa': mfa}; - }; + final Map apiHeaders = {'content-type': 'application/json'}; - 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); - - 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; - - } + @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 apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + 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 apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + @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 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + @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 apiHeaders = {'content-type': 'application/json'}; + + 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); - - final Map apiParams = { - - - }; + Future updateMFARecoveryCodes({ + required String userId, + }) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll( + '{userId}', + userId, + ); - final Map apiHeaders = { - 'content-type': 'application/json', + 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); - - final Map apiParams = { - - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + @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 apiHeaders = {'content-type': 'application/json'}; + + 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 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); 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); - - 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); + 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, + ); return models.Preferences.fromMap(res.data); - - } + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); + Future listSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.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.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 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 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; - - } + 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); - - final Map apiParams = { - - - }; + Future deleteSession({ + required String userId, + required String sessionId, + }) async { + final String apiPath = '/users/{userId}/sessions/{sessionId}' + .replaceAll('{userId}', userId) + .replaceAll('{sessionId}', sessionId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - 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); + 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, + ); return models.User.fromMap(res.data); - - } + } /// List the messaging targets that are associated with a user. - Future listTargets({required String userId, List? queries}) async { - final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); - - final Map apiParams = { - 'queries': queries, - - - }; - - final Map apiHeaders = { - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + Future listTargets({ + required String userId, + List? queries, + }) async { + final String apiPath = '/users/{userId}/targets'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'queries': queries}; + + final Map 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, -'providerId': providerId, -'name': name, - + 'providerType': providerType.value, + 'identifier': identifier, + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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 = { - 'identifier': identifier, -'providerId': providerId, -'name': name, - + 'providerId': providerId, + 'name': name, }; - final Map apiHeaders = { - 'content-type': 'application/json', - - }; + 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); - - final Map apiParams = { - - - }; + Future deleteTarget({ + required String userId, + required String targetId, + }) async { + final String apiPath = '/users/{userId}/targets/{targetId}' + .replaceAll('{userId}', userId) + .replaceAll('{targetId}', targetId); - final Map apiHeaders = { - 'content-type': 'application/json', + final Map apiParams = {}; - }; - - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = {'content-type': 'application/json'}; - return res.data; + 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); - - final Map apiParams = { - - 'length': length, -'expire': expire, - - }; - - final Map apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + /// + Future createToken({ + required String userId, + int? length, + int? expire, + }) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll( + '{userId}', + userId, + ); + + final Map apiParams = {'length': length, 'expire': expire}; + + final Map apiHeaders = {'content-type': 'application/json'}; + + 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 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 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); - - } -} \ No newline at end of file + } +} diff --git a/lib/src/client.dart b/lib/src/client.dart index 0d9be210..d82d623a 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -27,7 +27,7 @@ abstract class Client { 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. @@ -81,7 +81,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 cd82d264..08d93b85 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,21 +2,25 @@ 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index ea2cd62a..c961873f 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -9,14 +9,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => +ClientBase createClient({required String endPoint, required bool selfSigned}) => ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -34,59 +31,66 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'X-Appwrite-Response-Format' : '1.8.0', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -135,7 +139,11 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= CHUNK_SIZE) { - 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, @@ -162,12 +170,19 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + CHUNK_SIZE, 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index f9e695bf..2bd7d639 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -10,17 +10,11 @@ import 'response.dart'; import 'input_file.dart'; import 'upload_progress.dart'; -ClientBase createClient({ - required String endPoint, - required bool selfSigned, -}) => - ClientIO( - endPoint: endPoint, - selfSigned: selfSigned, - ); +ClientBase createClient({required String endPoint, required bool selfSigned}) => + ClientIO(endPoint: endPoint, selfSigned: selfSigned); class ClientIO extends ClientBase with ClientMixin { - static const int CHUNK_SIZE = 5*1024*1024; + static const int CHUNK_SIZE = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -43,60 +37,68 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '17.0.0', - 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format' : '1.8.0', + 'user-agent': + 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format': '1.8.0', }; config = {}; - assert(_endPoint.startsWith(RegExp("http://|https://")), - "endPoint $_endPoint must start with 'http'"); + assert( + _endPoint.startsWith(RegExp("http://|https://")), + "endPoint $_endPoint must start with 'http'", + ); } @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 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; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -151,11 +153,16 @@ class ClientIO extends ClientBase with ClientMixin { if (size <= CHUNK_SIZE) { if (file.path != null) { params[paramName] = await http.MultipartFile.fromPath( - paramName, file.path!, - filename: file.filename); + paramName, + file.path!, + filename: file.filename, + ); } else { - 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, @@ -194,12 +201,19 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(CHUNK_SIZE); } - 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 + CHUNK_SIZE - 1), size - 1)}/$size'; - res = await call(HttpMethod.post, - path: path, headers: headers, params: params); + res = await call( + HttpMethod.post, + path: path, + headers: headers, + params: params, + ); offset += CHUNK_SIZE; if (offset < size) { headers['x-appwrite-id'] = res.data['\$id']; @@ -244,10 +258,7 @@ class ClientIO extends ClientBase with ClientMixin { try { final streamedResponse = await _httpClient.send(request); res = await toResponse(streamedResponse); - return prepareResponse( - res, - responseType: responseType, - ); + return prepareResponse(res, responseType: responseType); } catch (e) { if (e is AppwriteException) { rethrow; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 658b79b6..06c9ebe3 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -26,21 +26,21 @@ mixin ClientMixin { } else { if (value is List) { value.asMap().forEach((i, v) { - (request as http.MultipartRequest) - .fields - .addAll({"$key[$i]": v.toString()}); + (request as http.MultipartRequest).fields.addAll({ + "$key[$i]": v.toString(), + }); }); } else { - (request as http.MultipartRequest) - .fields - .addAll({key: value.toString()}); + (request as http.MultipartRequest).fields.addAll({ + key: value.toString(), + }); } } }); } } else if (method == HttpMethod.get) { if (params.isNotEmpty) { - params = params.map((key, value){ + params = params.map((key, value) { if (value is int || value is double) { return MapEntry(key, value.toString()); } @@ -51,12 +51,13 @@ mixin ClientMixin { }); } uri = Uri( - fragment: uri.fragment, - path: uri.path, - host: uri.host, - scheme: uri.scheme, - queryParameters: params, - port: uri.port); + fragment: uri.fragment, + path: uri.path, + host: uri.host, + scheme: uri.scheme, + queryParameters: params, + port: uri.port, + ); request = http.Request(method.name(), uri); } else { (request as http.Request).body = jsonEncode(params); @@ -66,7 +67,9 @@ 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); @@ -113,18 +116,25 @@ 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.dart b/lib/src/enums.dart index 595afdc2..0f250ea3 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -17,5 +17,5 @@ enum ResponseType { plain, /// Get original bytes, the type of response will be `List` - bytes + bytes, } 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/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/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/build_runtime.dart b/lib/src/enums/build_runtime.dart index 2f198d4e..3341912f 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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 cd45b6a1..1bae5c8a 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'), - unionChinaPay(value: 'union-china-pay'), - 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'), + unionChinaPay(value: 'union-china-pay'), + 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/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/execution_method.dart b/lib/src/enums/execution_method.dart index 7d2d7016..42954430 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,18 +1,16 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); - 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/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 af5ebaad..e20f48c6 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,26 +1,24 @@ 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'), - 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'), + 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/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_type.dart b/lib/src/enums/index_type.dart index 8d86530d..b101d35f 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum IndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'); - const IndexType({ - required this.value - }); + const IndexType({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/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/name.dart b/lib/src/enums/name.dart index 613bf5f1..74823feb 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,24 +1,22 @@ 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'), - 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'), + 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 076c1c50..383e45b1 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,52 +1,50 @@ 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'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'); + 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'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'); - 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/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/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 d34440ec..d4fef930 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,77 +1,75 @@ 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'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - 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'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - deno121(value: 'deno-1.21'), - deno124(value: 'deno-1.24'), - deno135(value: 'deno-1.35'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - 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'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - 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'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - go123(value: 'go-1.23'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'); + 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'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + 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'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + deno121(value: 'deno-1.21'), + deno124(value: 'deno-1.24'), + deno135(value: 'deno-1.35'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + 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'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + 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'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + go123(value: 'go-1.23'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'); - 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/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/vcs_deployment_type.dart b/lib/src/enums/vcs_deployment_type.dart index 0bf8e2ad..f01fcb01 100644 --- a/lib/src/enums/vcs_deployment_type.dart +++ b/lib/src/enums/vcs_deployment_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum VCSDeploymentType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSDeploymentType({ - required this.value - }); + const VCSDeploymentType({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/algo_argon2.dart b/lib/src/models/algo_argon2.dart index f174d569..4145f701 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + 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 c9f67200..4e901476 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 2fabb416..35c7b767 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index fdcee07a..7d27adba 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index 120723df..fec6f65a 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,46 +2,46 @@ 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'], - ); - } - - 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'], + ); + } + + 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 504b5f8f..0e80700f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + 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 5f3e1654..bae6618f 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "type": type, - }; - } + Map toMap() { + return {"type": type}; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 20dd7189..0ca54691 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a5b27b4f..1df01f19 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 96ce554b..21f8e9a3 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a4953a0e..298c181a 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 03ba94c7..c6eecadd 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 8a5aa89d..1ef48332 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 d17f414a..8c8fcb73 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index 4098a5a1..c5fa6adc 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "attributes": attributes, - }; - } + Map toMap() { + return {"total": total, "attributes": attributes}; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 050cbe14..903c6290 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 2202d255..7374fa78 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index 0c3ddf9e..f0bc295e 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index 3bb374be..b8fb5e48 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,88 +2,88 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; + /// Bucket ID. + final String $id; - /// Bucket creation time in ISO 8601 format. - final String $createdAt; + /// Bucket creation time in ISO 8601 format. + final String $createdAt; - /// Bucket update date in ISO 8601 format. - final String $updatedAt; + /// Bucket update date in ISO 8601 format. + final String $updatedAt; - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// 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; + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; - /// Bucket name. - final String name; + /// Bucket name. + final String name; - /// Bucket enabled. - final bool enabled; + /// Bucket enabled. + final bool enabled; - /// Maximum file size supported. - final int maximumFileSize; + /// Maximum file size supported. + final int maximumFileSize; - /// Allowed file extensions. - final List allowedFileExtensions; + /// Allowed file extensions. + final List allowedFileExtensions; - /// Compression algorithm choosen 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; + /// Compression algorithm choosen 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; + /// Bucket is encrypted. + final bool encryption; - /// Virus scanning is enabled. - final bool antivirus; + /// Virus scanning is enabled. + final bool antivirus; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index b02adbf6..66e58c20 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "buckets": buckets.map((p) => p.toMap()).toList(), - }; - } + 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 c55110cf..72de429d 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,76 +2,76 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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))), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 240e2ce0..5322aaab 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index b7ce71b8..9d5013c0 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,70 +2,70 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 df80cfbb..2341fc3b 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 a92a0a5b..a822c4e5 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 9605a6a9..115108a4 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 200e2c78..a3a4e3b7 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 acf0f6df..9d637d92 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,76 +2,76 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + 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 576937e7..a7983a62 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,28 +2,24 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 5ba4e70b..82bf6734 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 e0be4633..13bb322c 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 475c1c40..8eb0171f 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,28 +2,22 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "total": total, - "columns": columns, - }; - } + Map toMap() { + return {"total": total, "columns": columns}; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index e55d1534..6221c01e 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,100 +2,100 @@ 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 String 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: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "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 String 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: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "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 6fd6a3b0..7b560989 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,82 +2,82 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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'], + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index 94271aa6..66c0ce7b 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,76 +2,76 @@ 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 String status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String 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: map['status'].toString(), - 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: map['status'].toString(), + 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(), + ); + } - Map toMap() { - return { - "key": key, - "type": type, - "status": status, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + Map toMap() { + return { + "key": key, + "type": type, + "status": status, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 1a9c5038..7318b7ad 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 5e954a05..ec2c0755 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + 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 565b1d66..c52b50f2 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,28 +2,19 @@ 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()); + } - Map toMap() { - return { - "name": name, - "code": code, - }; - } + Map toMap() { + return {"name": name, "code": code}; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 073fa251..65e13be3 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + 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 deafffe3..27eef0c1 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 1c99fdf9..7a957f1a 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + 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 cab95b02..8d79e052 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,52 +2,52 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; - - /// Database name. - final String name; - - /// Database creation date in ISO 8601 format. - final String $createdAt; - - /// 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; - - /// Database type. - final String type; - - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - }); - - 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: map['type'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type, - }; - } + /// Database ID. + final String $id; + + /// Database name. + final String name; + + /// Database creation date in ISO 8601 format. + final String $createdAt; + + /// 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; + + /// Database type. + final String type; + + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + }); + + 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: map['type'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type, + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 5eb5c0ce..5afa7932 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + 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 ecf7e791..448c62c7 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,178 +2,178 @@ 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", and "failed". - final String 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 branch of the vcs repository - final String providerBranch; - - /// 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 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.providerBranch, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - 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: map['status'].toString(), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - 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, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerBranch": providerBranch, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "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", and "failed". + final String 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 branch of the vcs repository + final String providerBranch; + + /// 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 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.providerBranch, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + 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: map['status'].toString(), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + 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, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerBranch": providerBranch, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 78ba8ab2..df81710a 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index be424a9c..cf85e457 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document automatically incrementing ID. - final int $sequence; + /// Document automatically incrementing ID. + final int $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'], - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 d45ea081..4065e17b 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,31 +2,30 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + 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/execution.dart b/lib/src/models/execution.dart index 809106a9..8dfbeab6 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,124 +2,128 @@ 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 String trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - final String status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// 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 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: map['trigger'].toString(), - status: map['status'].toString(), - 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(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "deploymentId": deploymentId, - "trigger": trigger, - "status": status, - "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 String trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + final String status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// 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 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: map['trigger'].toString(), + status: map['status'].toString(), + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "deploymentId": deploymentId, + "trigger": trigger, + "status": status, + "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 d44139ee..4ed73943 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + 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 de8439ec..a6a9fa46 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,82 +2,82 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; + /// File ID. + final String $id; - /// Bucket ID. - final String bucketId; + /// Bucket ID. + final String bucketId; - /// File creation date in ISO 8601 format. - final String $createdAt; + /// File creation date in ISO 8601 format. + final String $createdAt; - /// File update date in ISO 8601 format. - final String $updatedAt; + /// 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 permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// File name. - final String name; + /// File name. + final String name; - /// File MD5 signature. - final String signature; + /// File MD5 signature. + final String signature; - /// File mime type. - final String mimeType; + /// File mime type. + final String mimeType; - /// File original size in bytes. - final int sizeOriginal; + /// File original size in bytes. + final int sizeOriginal; - /// Total number of chunks available - final int chunksTotal; + /// Total number of chunks available + final int chunksTotal; - /// Total number of chunks uploaded - final int chunksUploaded; + /// Total number of chunks uploaded + final int chunksUploaded; - 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, - }); + 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, + }); - 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'], - ); - } + 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'], + ); + } - 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, - }; - } + 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, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 94ea9a14..63f49abc 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "files": files.map((p) => p.toMap()).toList(), - }; - } + 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 ea6b601a..693c9b07 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,46 +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))), - ); - } - - 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)), + ), + ); + } + + 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 7614616a..0b908240 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,46 +2,46 @@ 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(), - ); - } - - 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(), + ); + } + + 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 afe8f6b3..eb8145d4 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + 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 64401c3f..56c2eded 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,184 +2,184 @@ 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; - - /// 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'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 builds and executions. - final String specification; - - 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.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.specification, - }); - - 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(), - 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'], - specification: map['specification'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "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, - "specification": specification, - }; - } + /// 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; + + /// Function execution and build runtime. + final String runtime; + + /// 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 builds and executions. + final String specification; + + 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.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.specification, + }); + + 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(), + 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'], + specification: map['specification'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "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, + "specification": specification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index d5974f55..34d7225c 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,28 +2,25 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + 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 ecf0a178..463cf696 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "value": value, - }; - } + Map toMap() { + return {"name": name, "value": value}; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index 54c31e70..fa402e97 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,28 +2,22 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` - final String status; + /// Antivirus status. Possible values can are: `disabled`, `offline`, `online` + final String 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: map['status'].toString(), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "version": version, - "status": status, - }; - } + Map toMap() { + return {"version": version, "status": status}; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index 0a5b6ce9..d412eba9 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 95da1235..5f06906b 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,22 +2,16 @@ 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']); + } - Map toMap() { - return { - "size": size, - }; - } + Map toMap() { + return {"size": size}; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 0d6e7216..59b7092c 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,34 +2,26 @@ 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 can are: `pass`, `fail` - final String status; + /// Service status. Possible values can are: `pass`, `fail` + final String 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: map['status'].toString(), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: map['status'].toString(), + ); + } - Map toMap() { - return { - "name": name, - "ping": ping, - "status": status, - }; - } + Map toMap() { + return {"name": name, "ping": ping, "status": status}; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index 102dfe77..dec2d54f 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,34 +2,30 @@ 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'], + ); + } - Map toMap() { - return { - "remoteTime": remoteTime, - "localTime": localTime, - "diff": diff, - }; - } + Map toMap() { + return {"remoteTime": remoteTime, "localTime": localTime, "diff": diff}; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index c43c4d57..807bdfd0 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,76 +2,76 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + 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 b8358fc1..b4c63f7d 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + 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 b6717c4e..9d6d7aec 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,76 +2,76 @@ 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 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 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: map['status'].toString(), - 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: map['status'].toString(), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "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 fef735fc..6d285a6a 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + 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 1b4ff7de..490a1824 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,22 +2,16 @@ 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()); + } - Map toMap() { - return { - "jwt": jwt, - }; - } + Map toMap() { + return {"jwt": jwt}; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 43eaad08..9c45adb1 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,34 +2,26 @@ 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(), + ); + } - Map toMap() { - return { - "name": name, - "code": code, - "nativeName": nativeName, - }; - } + 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 ea731471..2e65839e 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + 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 b5e9ad1a..084475bf 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 10499ef5..cd5a1155 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "name": name, - }; - } + 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 c1243e06..be6ddb1f 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + 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 cb567bd7..7fb3f364 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,142 +2,142 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID. - final String userId; - - /// User Email. - final String userEmail; - - /// User Name. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// 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.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(), - 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(), - ); - } - - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "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. + final String userId; + + /// User Email. + final String userEmail; + + /// User Name. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// 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.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(), + 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(), + ); + } + + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "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 9d4d7701..22273a8c 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "logs": logs.map((p) => p.toMap()).toList(), - }; - } + 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 26610e46..8ee142ad 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,94 +2,94 @@ 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'] ?? []), - ); - } - - 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; + + /// 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'] ?? []), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index f08f5738..a4d39dca 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + 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 c4e9e858..9b93b00d 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,94 +2,94 @@ 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 String 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: map['status'].toString(), - ); - } - - 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, - }; - } + /// 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 String 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: map['status'].toString(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index acaacc34..15ddf642 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + 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 46c166fb..96bf3c65 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,40 +2,40 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + 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 d49989d8..c930a23e 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,40 +2,40 @@ 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'], + ); + } - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + 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 6c8b4e36..63411988 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,22 +2,18 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "recoveryCodes": recoveryCodes, - }; - } + Map toMap() { + return {"recoveryCodes": recoveryCodes}; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index 01cf0857..fa57cb8b 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,28 +2,22 @@ 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(), + ); + } - Map toMap() { - return { - "secret": secret, - "uri": uri, - }; - } + Map toMap() { + return {"secret": secret, "uri": uri}; + } } 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/phone.dart b/lib/src/models/phone.dart index c8bbb95b..40f7bcd2 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,34 +2,34 @@ 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(), + ); + } - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + 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 2d869308..879edbc4 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "phones": phones.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "phones": phones.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index edb6083e..7bc3abc9 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,23 +2,17 @@ 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, - ); - } + factory Preferences.fromMap(Map map) { + return Preferences(data: map); + } - Map toMap() { - return { - "data": data, - }; - } + 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/provider.dart b/lib/src/models/provider.dart index 4295c486..1a762f85 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + 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 9710aea9..9347fefb 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index ed520cc4..dad35dcc 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,58 +2,58 @@ 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(), - ); - } - - 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(), + ); + } + + 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 fcdabb97..2283653f 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,28 +2,24 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "tokens": tokens.map((p) => p.toMap()).toList(), - }; - } + 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 62e69e5b..3700e577 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row automatically incrementing ID. - final int $sequence; + /// Row automatically incrementing ID. + final int $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'], - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'], + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map, + ); + } - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + 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 a8374e2b..01f046c6 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,31 +2,25 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "rows": rows.map((p) => p.toMap()).toList(), - }; - } + 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 35f82cfa..7c9677d8 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + 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 c234990c..64bc2e08 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + 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 3a1d955f..d2fe4f64 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,190 +2,190 @@ 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(), - ); - } - - 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(), + ); + } + + 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 0257cb86..e9c478af 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + 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 5cda6acc..1449f8bd 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,190 +2,190 @@ 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's active deployment ID. - final String deploymentId; - - /// 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; - - /// 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 builds and executions. - final String specification; - - /// 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.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.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.specification, - 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(), - 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(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - specification: map['specification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "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, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "specification": specification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Site framework. + final String framework; + + /// Site's active deployment ID. + final String deploymentId; + + /// 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; + + /// 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 builds and executions. + final String specification; + + /// 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.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.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.specification, + 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(), + 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(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + specification: map['specification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "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, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "specification": specification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index cc9e4355..e74b0d81 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "sites": sites.map((p) => p.toMap()).toList(), - }; - } + 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 e49d399c..e8fb8c75 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,40 +2,35 @@ 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(), + ); + } - Map toMap() { - return { - "memory": memory, - "cpus": cpus, - "enabled": enabled, - "slug": slug, - }; - } + 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 0d2b6a73..de4957d2 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + 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 36e18a7e..0c926297 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,70 +2,70 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + 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 6c8c21e2..6a135b92 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + 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 1c5b88fb..7ce86b9d 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,76 +2,78 @@ 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; - 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, - }); + 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, + }); - 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))), - ); - } + 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)), + ), + ); + } - 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(), - }; - } + 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(), + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 2b4b4b41..ebe15c71 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "tables": tables.map((p) => p.toMap()).toList(), - }; - } + 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 f2b3b6b4..4be8b545 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,70 +2,70 @@ 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'], + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + 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 6ef2725d..84233d1d 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "targets": targets.map((p) => p.toMap()).toList(), - }; - } + 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 e9058b5b..43df33a8 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,52 +2,52 @@ 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']), - ); - } - - 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']), + ); + } + + 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 a61cc9f7..a3994c06 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "teams": teams.map((p) => p.toMap()).toList(), - }; - } + 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 4f6b8454..35115467 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,52 +2,52 @@ 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(), - ); - } - - 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(), + ); + } + + 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 461d5694..430d44ac 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,64 +2,64 @@ 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'] ?? []), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + 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 1582a3c7..eefc62b6 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "topics": topics.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return {"total": total, "topics": topics.map((p) => p.toMap()).toList()}; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index effc397c..50bfb3ce 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,130 +2,130 @@ 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; - - 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, - }); - - 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(), - ); - } - - 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, - }; - } + /// 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; + + 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, + }); + + 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(), + ); + } + + 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, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index edf7a95d..2419d818 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,28 +2,22 @@ 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))), + ); + } - Map toMap() { - return { - "total": total, - "users": users.map((p) => p.toMap()).toList(), - }; - } + 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 58882a9f..2a8e276a 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,64 +2,64 @@ 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(), + ); + } - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + 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 ee1f6f7a..ffa58eef 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,28 +2,27 @@ 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)), + ), + ); + } - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } }