From 2590349b466ccdf4157444ca44b114731eb599d5 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 16 Feb 2024 23:04:30 +1300 Subject: [PATCH 1/7] Release candidate for 1.5.x --- README.md | 4 +- docs/examples/account/add-authenticator.md | 23 + .../account/create-anonymous-session.md | 20 + .../account/create-email-password-session.md | 23 + docs/examples/account/create-email-token.md | 23 + docs/examples/account/create-j-w-t.md | 20 + .../account/create-magic-u-r-l-token.md | 23 + .../examples/account/create-o-auth2session.md | 22 + docs/examples/account/create-phone-token.md | 23 + .../account/create-phone-verification.md | 4 +- docs/examples/account/create-recovery.md | 8 +- docs/examples/account/create-session.md | 23 + docs/examples/account/create-verification.md | 6 +- docs/examples/account/create.md | 24 + docs/examples/account/create2f-a-challenge.md | 22 + docs/examples/account/delete-authenticator.md | 24 + docs/examples/account/delete-identity.md | 6 +- docs/examples/account/delete-session.md | 6 +- docs/examples/account/delete-sessions.md | 4 +- docs/examples/account/get-prefs.md | 4 +- docs/examples/account/get-session.md | 6 +- docs/examples/account/get.md | 4 +- docs/examples/account/list-factors.md | 21 + docs/examples/account/list-identities.md | 4 +- docs/examples/account/list-logs.md | 4 +- docs/examples/account/list-sessions.md | 4 +- docs/examples/account/update-challenge.md | 24 + docs/examples/account/update-email.md | 8 +- docs/examples/account/update-m-f-a.md | 23 + .../account/update-magic-u-r-l-session.md | 23 + docs/examples/account/update-name.md | 6 +- docs/examples/account/update-password.md | 6 +- .../account/update-phone-verification.md | 8 +- docs/examples/account/update-phone.md | 8 +- docs/examples/account/update-prefs.md | 6 +- docs/examples/account/update-recovery.md | 11 +- docs/examples/account/update-session.md | 6 +- docs/examples/account/update-status.md | 4 +- docs/examples/account/update-verification.md | 8 +- docs/examples/account/verify-authenticator.md | 24 + docs/examples/avatars/get-browser.md | 6 +- docs/examples/avatars/get-credit-card.md | 6 +- docs/examples/avatars/get-favicon.md | 6 +- docs/examples/avatars/get-flag.md | 6 +- docs/examples/avatars/get-image.md | 6 +- docs/examples/avatars/get-initials.md | 4 +- docs/examples/avatars/get-q-r.md | 6 +- .../databases/create-boolean-attribute.md | 10 +- docs/examples/databases/create-collection.md | 8 +- .../databases/create-datetime-attribute.md | 10 +- docs/examples/databases/create-document.md | 12 +- .../databases/create-email-attribute.md | 10 +- .../databases/create-enum-attribute.md | 12 +- .../databases/create-float-attribute.md | 10 +- docs/examples/databases/create-index.md | 12 +- .../databases/create-integer-attribute.md | 10 +- .../examples/databases/create-ip-attribute.md | 10 +- .../create-relationship-attribute.md | 10 +- .../databases/create-string-attribute.md | 12 +- .../databases/create-url-attribute.md | 10 +- docs/examples/databases/create.md | 6 +- docs/examples/databases/delete-attribute.md | 8 +- docs/examples/databases/delete-collection.md | 6 +- docs/examples/databases/delete-document.md | 10 +- docs/examples/databases/delete-index.md | 8 +- docs/examples/databases/delete.md | 4 +- docs/examples/databases/get-attribute.md | 8 +- docs/examples/databases/get-collection.md | 6 +- docs/examples/databases/get-document.md | 10 +- docs/examples/databases/get-index.md | 8 +- docs/examples/databases/get.md | 4 +- docs/examples/databases/list-attributes.md | 6 +- docs/examples/databases/list-collections.md | 4 +- docs/examples/databases/list-documents.md | 8 +- docs/examples/databases/list-indexes.md | 6 +- docs/examples/databases/list.md | 2 +- .../databases/update-boolean-attribute.md | 12 +- docs/examples/databases/update-collection.md | 8 +- .../databases/update-datetime-attribute.md | 12 +- docs/examples/databases/update-document.md | 10 +- .../databases/update-email-attribute.md | 12 +- .../databases/update-enum-attribute.md | 14 +- .../databases/update-float-attribute.md | 16 +- .../databases/update-integer-attribute.md | 16 +- .../examples/databases/update-ip-attribute.md | 12 +- .../update-relationship-attribute.md | 8 +- .../databases/update-string-attribute.md | 12 +- .../databases/update-url-attribute.md | 12 +- docs/examples/databases/update.md | 6 +- docs/examples/functions/create-build.md | 8 +- docs/examples/functions/create-deployment.md | 8 +- docs/examples/functions/create-execution.md | 6 +- docs/examples/functions/create-variable.md | 8 +- docs/examples/functions/create.md | 8 +- docs/examples/functions/delete-deployment.md | 6 +- docs/examples/functions/delete-variable.md | 6 +- docs/examples/functions/delete.md | 4 +- .../examples/functions/download-deployment.md | 6 +- docs/examples/functions/get-deployment.md | 6 +- docs/examples/functions/get-execution.md | 8 +- docs/examples/functions/get-variable.md | 6 +- docs/examples/functions/get.md | 4 +- docs/examples/functions/list-deployments.md | 4 +- docs/examples/functions/list-executions.md | 6 +- docs/examples/functions/list-runtimes.md | 2 +- docs/examples/functions/list-variables.md | 4 +- docs/examples/functions/list.md | 2 +- docs/examples/functions/update-deployment.md | 6 +- docs/examples/functions/update-variable.md | 8 +- docs/examples/functions/update.md | 6 +- docs/examples/graphql/mutation.md | 4 +- docs/examples/graphql/query.md | 4 +- docs/examples/health/get-antivirus.md | 2 +- docs/examples/health/get-cache.md | 2 +- docs/examples/health/get-certificate.md | 22 + docs/examples/health/get-d-b.md | 2 +- docs/examples/health/get-failed-jobs.md | 23 + docs/examples/health/get-pub-sub.md | 2 +- docs/examples/health/get-queue-builds.md | 2 +- .../examples/health/get-queue-certificates.md | 2 +- docs/examples/health/get-queue-databases.md | 2 +- docs/examples/health/get-queue-deletes.md | 2 +- docs/examples/health/get-queue-functions.md | 2 +- docs/examples/health/get-queue-logs.md | 2 +- docs/examples/health/get-queue-mails.md | 2 +- docs/examples/health/get-queue-messaging.md | 2 +- docs/examples/health/get-queue-migrations.md | 2 +- docs/examples/health/get-queue-webhooks.md | 2 +- docs/examples/health/get-queue.md | 2 +- docs/examples/health/get-storage-local.md | 2 +- docs/examples/health/get-time.md | 2 +- docs/examples/health/get.md | 2 +- docs/examples/locale/get.md | 4 +- docs/examples/locale/list-codes.md | 4 +- docs/examples/locale/list-continents.md | 4 +- docs/examples/locale/list-countries-e-u.md | 4 +- docs/examples/locale/list-countries-phones.md | 4 +- docs/examples/locale/list-countries.md | 4 +- docs/examples/locale/list-currencies.md | 4 +- docs/examples/locale/list-languages.md | 4 +- .../messaging/create-a-p-n-s-provider.md | 24 + docs/examples/messaging/create-email.md | 25 + .../messaging/create-f-c-m-provider.md | 24 + .../messaging/create-mailgun-provider.md | 24 + .../messaging/create-msg91provider.md | 24 + docs/examples/messaging/create-push.md | 25 + docs/examples/messaging/create-s-m-s.md | 24 + .../messaging/create-s-m-t-p-provider.md | 25 + .../messaging/create-sendgrid-provider.md | 24 + docs/examples/messaging/create-subscriber.md | 25 + .../messaging/create-telesign-provider.md | 24 + .../messaging/create-textmagic-provider.md | 24 + docs/examples/messaging/create-topic.md | 24 + .../messaging/create-twilio-provider.md | 24 + .../messaging/create-vonage-provider.md | 24 + docs/examples/messaging/delete-provider.md | 23 + docs/examples/messaging/delete-subscriber.md | 24 + docs/examples/messaging/delete-topic.md | 23 + docs/examples/messaging/delete.md | 23 + docs/examples/messaging/get-message.md | 23 + docs/examples/messaging/get-provider.md | 23 + docs/examples/messaging/get-subscriber.md | 24 + docs/examples/messaging/get-topic.md | 23 + docs/examples/messaging/list-message-logs.md | 23 + docs/examples/messaging/list-messages.md | 22 + docs/examples/messaging/list-provider-logs.md | 23 + docs/examples/messaging/list-providers.md | 22 + .../messaging/list-subscriber-logs.md | 23 + docs/examples/messaging/list-subscribers.md | 23 + docs/examples/messaging/list-targets.md | 23 + docs/examples/messaging/list-topic-logs.md | 23 + docs/examples/messaging/list-topics.md | 22 + .../messaging/update-a-p-n-s-provider.md | 23 + docs/examples/messaging/update-email.md | 23 + .../messaging/update-f-c-m-provider.md | 23 + .../messaging/update-mailgun-provider.md | 23 + .../messaging/update-msg91provider.md | 23 + docs/examples/messaging/update-push.md | 23 + docs/examples/messaging/update-s-m-s.md | 23 + .../messaging/update-s-m-t-p-provider.md | 23 + .../messaging/update-sendgrid-provider.md | 23 + .../messaging/update-telesign-provider.md | 23 + .../messaging/update-textmagic-provider.md | 23 + docs/examples/messaging/update-topic.md | 23 + .../messaging/update-twilio-provider.md | 23 + .../messaging/update-vonage-provider.md | 23 + docs/examples/storage/create-bucket.md | 6 +- docs/examples/storage/create-file.md | 10 +- docs/examples/storage/delete-bucket.md | 4 +- docs/examples/storage/delete-file.md | 8 +- docs/examples/storage/get-bucket.md | 4 +- docs/examples/storage/get-file-download.md | 8 +- docs/examples/storage/get-file-preview.md | 8 +- docs/examples/storage/get-file-view.md | 8 +- docs/examples/storage/get-file.md | 8 +- docs/examples/storage/list-buckets.md | 2 +- docs/examples/storage/list-files.md | 6 +- docs/examples/storage/update-bucket.md | 6 +- docs/examples/storage/update-file.md | 8 +- docs/examples/teams/create-membership.md | 8 +- docs/examples/teams/create.md | 8 +- docs/examples/teams/delete-membership.md | 8 +- docs/examples/teams/delete.md | 6 +- docs/examples/teams/get-membership.md | 8 +- docs/examples/teams/get-prefs.md | 6 +- docs/examples/teams/get.md | 6 +- docs/examples/teams/list-memberships.md | 6 +- docs/examples/teams/list.md | 4 +- .../teams/update-membership-status.md | 12 +- docs/examples/teams/update-membership.md | 10 +- docs/examples/teams/update-name.md | 8 +- docs/examples/teams/update-prefs.md | 8 +- docs/examples/users/create-argon2user.md | 8 +- docs/examples/users/create-bcrypt-user.md | 8 +- docs/examples/users/create-m-d5user.md | 8 +- docs/examples/users/create-p-h-pass-user.md | 8 +- docs/examples/users/create-s-h-a-user.md | 8 +- .../users/create-scrypt-modified-user.md | 14 +- docs/examples/users/create-scrypt-user.md | 18 +- docs/examples/users/create-session.md | 23 + docs/examples/users/create-target.md | 26 + docs/examples/users/create-token.md | 23 + docs/examples/users/create.md | 4 +- docs/examples/users/delete-authenticator.md | 25 + docs/examples/users/delete-identity.md | 4 +- docs/examples/users/delete-session.md | 6 +- docs/examples/users/delete-sessions.md | 4 +- docs/examples/users/delete-target.md | 24 + docs/examples/users/delete.md | 4 +- docs/examples/users/get-prefs.md | 4 +- docs/examples/users/get-target.md | 24 + docs/examples/users/get.md | 4 +- docs/examples/users/list-factors.md | 23 + docs/examples/users/list-identities.md | 2 +- docs/examples/users/list-logs.md | 4 +- docs/examples/users/list-memberships.md | 4 +- docs/examples/users/list-sessions.md | 4 +- docs/examples/users/list-targets.md | 23 + docs/examples/users/list.md | 2 +- .../users/update-email-verification.md | 6 +- docs/examples/users/update-email.md | 6 +- docs/examples/users/update-labels.md | 6 +- docs/examples/users/update-mfa.md | 24 + docs/examples/users/update-name.md | 6 +- docs/examples/users/update-password.md | 6 +- .../users/update-phone-verification.md | 6 +- docs/examples/users/update-phone.md | 6 +- docs/examples/users/update-prefs.md | 6 +- docs/examples/users/update-status.md | 6 +- docs/examples/users/update-target.md | 24 + lib/dart_appwrite.dart | 3 + lib/enums.dart | 22 + lib/models.dart | 15 + lib/query.dart | 86 +- lib/services/account.dart | 483 ++++++- lib/services/avatars.dart | 20 +- lib/services/databases.dart | 6 +- lib/services/functions.dart | 6 +- lib/services/health.dart | 47 + lib/services/messaging.dart | 1193 +++++++++++++++++ lib/services/storage.dart | 12 +- lib/services/users.dart | 240 +++- lib/src/client.dart | 17 +- lib/src/client_base.dart | 9 + lib/src/client_browser.dart | 25 +- lib/src/client_io.dart | 27 +- lib/src/enums/browser.dart | 26 + lib/src/enums/compression.dart | 15 + lib/src/enums/credit_card.dart | 28 + lib/src/enums/execution_method.dart | 18 + lib/src/enums/factor.dart | 15 + lib/src/enums/flag.dart | 206 +++ lib/src/enums/image_format.dart | 17 + lib/src/enums/image_gravity.dart | 21 + lib/src/enums/index_type.dart | 16 + lib/src/enums/message_status.dart | 15 + lib/src/enums/messaging_provider_type.dart | 15 + lib/src/enums/name.dart | 24 + lib/src/enums/o_auth_provider.dart | 51 + lib/src/enums/password_hash.dart | 23 + lib/src/enums/relation_mutate.dart | 15 + lib/src/enums/relationship_type.dart | 16 + lib/src/enums/runtime.dart | 16 + lib/src/enums/smtp_encryption.dart | 15 + lib/src/enums/type.dart | 13 + lib/src/models/health_certificate.dart | 48 + lib/src/models/jwt.dart | 23 + lib/src/models/membership.dart | 5 + lib/src/models/message.dart | 83 ++ lib/src/models/message_list.dart | 28 + lib/src/models/mfa_challenge.dart | 38 + lib/src/models/mfa_factors.dart | 33 + lib/src/models/mfa_type.dart | 33 + lib/src/models/provider.dart | 63 + lib/src/models/provider_list.dart | 28 + lib/src/models/session.dart | 10 + lib/src/models/subscriber.dart | 63 + lib/src/models/subscriber_list.dart | 28 + lib/src/models/target.dart | 58 + lib/src/models/target_list.dart | 28 + lib/src/models/token.dart | 5 + lib/src/models/topic.dart | 58 + lib/src/models/topic_list.dart | 28 + lib/src/models/user.dart | 15 + pubspec.yaml | 2 +- test/query_test.dart | 165 ++- test/services/account_test.dart | 528 +++++++- test/services/health_test.dart | 38 + test/services/messaging_test.dart | 1098 +++++++++++++++ test/services/teams_test.dart | 4 + test/services/users_test.dart | 310 +++++ test/src/models/health_certificate_test.dart | 28 + test/src/models/jwt_test.dart | 18 + test/src/models/membership_test.dart | 2 + test/src/models/message_list_test.dart | 20 + test/src/models/message_test.dart | 36 + test/src/models/mfa_challenge_test.dart | 24 + test/src/models/mfa_factors_test.dart | 22 + test/src/models/mfa_type_test.dart | 22 + test/src/models/provider_list_test.dart | 20 + test/src/models/provider_test.dart | 32 + test/src/models/session_test.dart | 4 + test/src/models/subscriber_list_test.dart | 20 + test/src/models/subscriber_test.dart | 34 + test/src/models/target_list_test.dart | 20 + test/src/models/target_test.dart | 30 + test/src/models/token_test.dart | 2 + test/src/models/topic_list_test.dart | 20 + test/src/models/topic_test.dart | 32 + test/src/models/user_test.dart | 6 + 330 files changed, 8138 insertions(+), 714 deletions(-) create mode 100644 docs/examples/account/add-authenticator.md create mode 100644 docs/examples/account/create-anonymous-session.md create mode 100644 docs/examples/account/create-email-password-session.md create mode 100644 docs/examples/account/create-email-token.md create mode 100644 docs/examples/account/create-j-w-t.md create mode 100644 docs/examples/account/create-magic-u-r-l-token.md create mode 100644 docs/examples/account/create-o-auth2session.md create mode 100644 docs/examples/account/create-phone-token.md create mode 100644 docs/examples/account/create-session.md create mode 100644 docs/examples/account/create.md create mode 100644 docs/examples/account/create2f-a-challenge.md create mode 100644 docs/examples/account/delete-authenticator.md create mode 100644 docs/examples/account/list-factors.md create mode 100644 docs/examples/account/update-challenge.md create mode 100644 docs/examples/account/update-m-f-a.md create mode 100644 docs/examples/account/update-magic-u-r-l-session.md create mode 100644 docs/examples/account/verify-authenticator.md create mode 100644 docs/examples/health/get-certificate.md create mode 100644 docs/examples/health/get-failed-jobs.md create mode 100644 docs/examples/messaging/create-a-p-n-s-provider.md create mode 100644 docs/examples/messaging/create-email.md create mode 100644 docs/examples/messaging/create-f-c-m-provider.md create mode 100644 docs/examples/messaging/create-mailgun-provider.md create mode 100644 docs/examples/messaging/create-msg91provider.md create mode 100644 docs/examples/messaging/create-push.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/create-sendgrid-provider.md create mode 100644 docs/examples/messaging/create-subscriber.md create mode 100644 docs/examples/messaging/create-telesign-provider.md create mode 100644 docs/examples/messaging/create-textmagic-provider.md create mode 100644 docs/examples/messaging/create-topic.md create mode 100644 docs/examples/messaging/create-twilio-provider.md create mode 100644 docs/examples/messaging/create-vonage-provider.md create mode 100644 docs/examples/messaging/delete-provider.md create mode 100644 docs/examples/messaging/delete-subscriber.md create mode 100644 docs/examples/messaging/delete-topic.md create mode 100644 docs/examples/messaging/delete.md create mode 100644 docs/examples/messaging/get-message.md create mode 100644 docs/examples/messaging/get-provider.md create mode 100644 docs/examples/messaging/get-subscriber.md create mode 100644 docs/examples/messaging/get-topic.md create mode 100644 docs/examples/messaging/list-message-logs.md create mode 100644 docs/examples/messaging/list-messages.md create mode 100644 docs/examples/messaging/list-provider-logs.md create mode 100644 docs/examples/messaging/list-providers.md create mode 100644 docs/examples/messaging/list-subscriber-logs.md create mode 100644 docs/examples/messaging/list-subscribers.md create mode 100644 docs/examples/messaging/list-targets.md create mode 100644 docs/examples/messaging/list-topic-logs.md create mode 100644 docs/examples/messaging/list-topics.md create mode 100644 docs/examples/messaging/update-a-p-n-s-provider.md create mode 100644 docs/examples/messaging/update-email.md create mode 100644 docs/examples/messaging/update-f-c-m-provider.md create mode 100644 docs/examples/messaging/update-mailgun-provider.md create mode 100644 docs/examples/messaging/update-msg91provider.md create mode 100644 docs/examples/messaging/update-push.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/messaging/update-sendgrid-provider.md create mode 100644 docs/examples/messaging/update-telesign-provider.md create mode 100644 docs/examples/messaging/update-textmagic-provider.md create mode 100644 docs/examples/messaging/update-topic.md create mode 100644 docs/examples/messaging/update-twilio-provider.md create mode 100644 docs/examples/messaging/update-vonage-provider.md create mode 100644 docs/examples/users/create-session.md create mode 100644 docs/examples/users/create-target.md create mode 100644 docs/examples/users/create-token.md create mode 100644 docs/examples/users/delete-authenticator.md create mode 100644 docs/examples/users/delete-target.md create mode 100644 docs/examples/users/get-target.md create mode 100644 docs/examples/users/list-factors.md create mode 100644 docs/examples/users/list-targets.md create mode 100644 docs/examples/users/update-mfa.md create mode 100644 docs/examples/users/update-target.md create mode 100644 lib/enums.dart create mode 100644 lib/services/messaging.dart create mode 100644 lib/src/enums/browser.dart create mode 100644 lib/src/enums/compression.dart create mode 100644 lib/src/enums/credit_card.dart create mode 100644 lib/src/enums/execution_method.dart create mode 100644 lib/src/enums/factor.dart create mode 100644 lib/src/enums/flag.dart create mode 100644 lib/src/enums/image_format.dart create mode 100644 lib/src/enums/image_gravity.dart create mode 100644 lib/src/enums/index_type.dart create mode 100644 lib/src/enums/message_status.dart create mode 100644 lib/src/enums/messaging_provider_type.dart create mode 100644 lib/src/enums/name.dart create mode 100644 lib/src/enums/o_auth_provider.dart create mode 100644 lib/src/enums/password_hash.dart create mode 100644 lib/src/enums/relation_mutate.dart create mode 100644 lib/src/enums/relationship_type.dart create mode 100644 lib/src/enums/runtime.dart create mode 100644 lib/src/enums/smtp_encryption.dart create mode 100644 lib/src/enums/type.dart create mode 100644 lib/src/models/health_certificate.dart create mode 100644 lib/src/models/jwt.dart create mode 100644 lib/src/models/message.dart create mode 100644 lib/src/models/message_list.dart create mode 100644 lib/src/models/mfa_challenge.dart create mode 100644 lib/src/models/mfa_factors.dart create mode 100644 lib/src/models/mfa_type.dart create mode 100644 lib/src/models/provider.dart create mode 100644 lib/src/models/provider_list.dart create mode 100644 lib/src/models/subscriber.dart create mode 100644 lib/src/models/subscriber_list.dart create mode 100644 lib/src/models/target.dart create mode 100644 lib/src/models/target_list.dart create mode 100644 lib/src/models/topic.dart create mode 100644 lib/src/models/topic_list.dart create mode 100644 test/services/messaging_test.dart create mode 100644 test/src/models/health_certificate_test.dart create mode 100644 test/src/models/jwt_test.dart create mode 100644 test/src/models/message_list_test.dart create mode 100644 test/src/models/message_test.dart create mode 100644 test/src/models/mfa_challenge_test.dart create mode 100644 test/src/models/mfa_factors_test.dart create mode 100644 test/src/models/mfa_type_test.dart create mode 100644 test/src/models/provider_list_test.dart create mode 100644 test/src/models/provider_test.dart create mode 100644 test/src/models/subscriber_list_test.dart create mode 100644 test/src/models/subscriber_test.dart create mode 100644 test/src/models/target_list_test.dart create mode 100644 test/src/models/target_test.dart create mode 100644 test/src/models/topic_list_test.dart create mode 100644 test/src/models/topic_test.dart diff --git a/README.md b/README.md index 97573fc9..3bf03f5d 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.4.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.5.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: ^10.1.1 + dart_appwrite: ^11.0.0-rc.2 ``` You can install packages from the command line: diff --git a/docs/examples/account/add-authenticator.md b/docs/examples/account/add-authenticator.md new file mode 100644 index 00000000..a410f093 --- /dev/null +++ b/docs/examples/account/add-authenticator.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession('') // The user session to authenticate with + ; + + Future result = account.addAuthenticator( + type: .totp, + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md new file mode 100644 index 00000000..f711916d --- /dev/null +++ b/docs/examples/account/create-anonymous-session.md @@ -0,0 +1,20 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + ; + + Future result = account.createAnonymousSession(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md new file mode 100644 index 00000000..0fef819c --- /dev/null +++ b/docs/examples/account/create-email-password-session.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + ; + + Future result = account.createEmailPasswordSession( + email:'email@example.com' , + password:'password' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md new file mode 100644 index 00000000..f80f8a7c --- /dev/null +++ b/docs/examples/account/create-email-token.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + ; + + Future result = account.createEmailToken( + userId:'[USER_ID]' , + email:'email@example.com' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-j-w-t.md new file mode 100644 index 00000000..eda97f3d --- /dev/null +++ b/docs/examples/account/create-j-w-t.md @@ -0,0 +1,20 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + ; + + Future result = account.createJWT(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/account/create-magic-u-r-l-token.md b/docs/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 00000000..1372ae26 --- /dev/null +++ b/docs/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + ; + + Future result = account.createMagicURLToken( + userId:'[USER_ID]' , + email:'email@example.com' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/account/create-o-auth2session.md b/docs/examples/account/create-o-auth2session.md new file mode 100644 index 00000000..dca64592 --- /dev/null +++ b/docs/examples/account/create-o-auth2session.md @@ -0,0 +1,22 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + ; + + Future result = account.createOAuth2Session( + provider: OAuthProvider.amazon, + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md new file mode 100644 index 00000000..715d4d51 --- /dev/null +++ b/docs/examples/account/create-phone-token.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + ; + + Future result = account.createPhoneToken( + userId:'[USER_ID]' , + phone:'+12065550100' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index 912f8c3b..8cfa2003 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.createPhoneVerification(); @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index d9f13957..e13b82e7 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.createRecovery( - email: 'email@example.com', - url: 'https://example.com', + email:'email@example.com' , + url:'https://example.com' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md new file mode 100644 index 00000000..988aa82d --- /dev/null +++ b/docs/examples/account/create-session.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + ; + + Future result = account.createSession( + userId:'[USER_ID]' , + secret:'[SECRET]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index cca3c7b7..0bf09404 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.createVerification( - url: 'https://example.com', + url:'https://example.com' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md new file mode 100644 index 00000000..fe87c194 --- /dev/null +++ b/docs/examples/account/create.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + ; + + Future result = account.create( + userId:'[USER_ID]' , + email:'email@example.com' , + password:'' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/account/create2f-a-challenge.md b/docs/examples/account/create2f-a-challenge.md new file mode 100644 index 00000000..98cdaef1 --- /dev/null +++ b/docs/examples/account/create2f-a-challenge.md @@ -0,0 +1,22 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + ; + + Future result = account.create2FAChallenge( + factor: .totp, + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/account/delete-authenticator.md b/docs/examples/account/delete-authenticator.md new file mode 100644 index 00000000..9b7a4c03 --- /dev/null +++ b/docs/examples/account/delete-authenticator.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession('') // The user session to authenticate with + ; + + Future result = account.deleteAuthenticator( + type: .totp, + otp:'[OTP]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index 7b8f09a3..583dc732 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.deleteIdentity( - identityId: '[IDENTITY_ID]', + identityId:'[IDENTITY_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index 9486ec9b..7f0fbd07 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.deleteSession( - sessionId: '[SESSION_ID]', + sessionId:'[SESSION_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index a5732cb6..269adb1c 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.deleteSessions(); @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index 527a71f3..62689693 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.getPrefs(); @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index 6eb711ab..b0163af9 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.getSession( - sessionId: '[SESSION_ID]', + sessionId:'[SESSION_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index c72fdddb..2bc68791 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.get(); @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/list-factors.md b/docs/examples/account/list-factors.md new file mode 100644 index 00000000..98b7282b --- /dev/null +++ b/docs/examples/account/list-factors.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession('') // The user session to authenticate with + ; + + Future result = account.listFactors(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index 63789e52..110fe062 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.listIdentities( @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index 68d2c49f..daaca540 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.listLogs( @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index 0d6567b5..e6428415 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.listSessions(); @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/update-challenge.md b/docs/examples/account/update-challenge.md new file mode 100644 index 00000000..8b93325e --- /dev/null +++ b/docs/examples/account/update-challenge.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession('') // The user session to authenticate with + ; + + Future result = account.updateChallenge( + challengeId:'[CHALLENGE_ID]' , + otp:'[OTP]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index b83f7d86..e05c0199 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.updateEmail( - email: 'email@example.com', - password: 'password', + email:'email@example.com' , + password:'password' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/update-m-f-a.md b/docs/examples/account/update-m-f-a.md new file mode 100644 index 00000000..b096d41e --- /dev/null +++ b/docs/examples/account/update-m-f-a.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession('') // The user session to authenticate with + ; + + Future result = account.updateMFA( + mfa:false , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 00000000..063d027f --- /dev/null +++ b/docs/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + ; + + Future result = account.updateMagicURLSession( + userId:'[USER_ID]' , + secret:'[SECRET]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index 0bd27cf2..66dc884e 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.updateName( - name: '[NAME]', + name:'[NAME]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index d5e27a75..f5af12d1 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.updatePassword( - password: '', + password:'' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index f2995b9b..de28fcce 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.updatePhoneVerification( - userId: '[USER_ID]', - secret: '[SECRET]', + userId:'[USER_ID]' , + secret:'[SECRET]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index 5848da5d..ae9e41c3 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.updatePhone( - phone: '+12065550100', - password: 'password', + phone:'+12065550100' , + password:'password' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index ffbe7002..ad7f7ee4 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.updatePrefs( - prefs: {}, + prefs:{} , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index c2cf9d23..87f6d2ec 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -7,14 +7,13 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.updateRecovery( - userId: '[USER_ID]', - secret: '[SECRET]', - password: 'password', - passwordAgain: 'password', + userId:'[USER_ID]' , + secret:'[SECRET]' , + password:'' , ); result @@ -23,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index 61e11e27..2b3fe184 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.updateSession( - sessionId: '[SESSION_ID]', + sessionId:'[SESSION_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index 12f73333..e22efe80 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.updateStatus(); @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index 40e36426..c25ac9bd 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = account.updateVerification( - userId: '[USER_ID]', - secret: '[SECRET]', + userId:'[USER_ID]' , + secret:'[SECRET]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/account/verify-authenticator.md b/docs/examples/account/verify-authenticator.md new file mode 100644 index 00000000..b6744cd8 --- /dev/null +++ b/docs/examples/account/verify-authenticator.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Account account = Account(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession('') // The user session to authenticate with + ; + + Future result = account.verifyAuthenticator( + type: .totp, + otp:'[OTP]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index 0bac9df4..4b2baccd 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = avatars.getBrowser( - code: 'aa', + code: Browser.avantBrowser, ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index b9a8166e..bbbe431b 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = avatars.getCreditCard( - code: 'amex', + code: CreditCard.americanExpress, ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index 6a728e77..95386975 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = avatars.getFavicon( - url: 'https://example.com', + url:'https://example.com' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index 02e48809..615ec2e4 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = avatars.getFlag( - code: 'af', + code: Flag.afghanistan, ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index b1d5e338..d8879002 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = avatars.getImage( - url: 'https://example.com', + url:'https://example.com' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 5a68caf1..379e892f 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = avatars.getInitials( @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md index 8283b9bd..8a0a0e6e 100644 --- a/docs/examples/avatars/get-q-r.md +++ b/docs/examples/avatars/get-q-r.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = avatars.getQR( - text: '[TEXT]', + text:'[TEXT]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index 22471968..16a4b33b 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -11,10 +11,10 @@ void main() { // Init SDK ; Future result = databases.createBooleanAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - xrequired: false, + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + xrequired:false , ); result @@ -23,4 +23,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index c90183de..dc51b916 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = databases.createCollection( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - name: '[NAME]', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + name:'[NAME]' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index 24c44088..f0c4cd0a 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -11,10 +11,10 @@ void main() { // Init SDK ; Future result = databases.createDatetimeAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - xrequired: false, + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + xrequired:false , ); result @@ -23,4 +23,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 00d844da..2060fc26 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -7,14 +7,14 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = databases.createDocument( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - documentId: '[DOCUMENT_ID]', - data: {}, + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + documentId:'[DOCUMENT_ID]' , + data:{} , ); result @@ -23,4 +23,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index 92fd3203..e8b2f87d 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -11,10 +11,10 @@ void main() { // Init SDK ; Future result = databases.createEmailAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - xrequired: false, + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + xrequired:false , ); result @@ -23,4 +23,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index fa8ad920..c8ee7e42 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -11,11 +11,11 @@ void main() { // Init SDK ; Future result = databases.createEnumAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - elements: [], - xrequired: false, + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + elements:[] , + xrequired:false , ); result @@ -24,4 +24,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index 96047bf2..64c379fa 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -11,10 +11,10 @@ void main() { // Init SDK ; Future result = databases.createFloatAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - xrequired: false, + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + xrequired:false , ); result @@ -23,4 +23,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index c16a0271..457cb93f 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -11,11 +11,11 @@ void main() { // Init SDK ; Future result = databases.createIndex( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - type: 'key', - attributes: [], + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + type: IndexType.key, + attributes:[] , ); result @@ -24,4 +24,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index bc4f12f0..2e9ce298 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -11,10 +11,10 @@ void main() { // Init SDK ; Future result = databases.createIntegerAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - xrequired: false, + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + xrequired:false , ); result @@ -23,4 +23,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index ef3e985a..0cc76c04 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -11,10 +11,10 @@ void main() { // Init SDK ; Future result = databases.createIpAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - xrequired: false, + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + xrequired:false , ); result @@ -23,4 +23,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index 01f2b42f..9a46ae78 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -11,10 +11,10 @@ void main() { // Init SDK ; Future result = databases.createRelationshipAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - relatedCollectionId: '[RELATED_COLLECTION_ID]', - type: 'oneToOne', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + relatedCollectionId:'[RELATED_COLLECTION_ID]' , + type: RelationshipType.oneToOne, ); result @@ -23,4 +23,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index 14f2769d..30c125c1 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -11,11 +11,11 @@ void main() { // Init SDK ; Future result = databases.createStringAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - size: 1, - xrequired: false, + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + size:1 , + xrequired:false , ); result @@ -24,4 +24,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index 4cf3e99a..e6707e6d 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -11,10 +11,10 @@ void main() { // Init SDK ; Future result = databases.createUrlAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - xrequired: false, + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + xrequired:false , ); result @@ -23,4 +23,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index cbaf3b74..522c5648 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = databases.create( - databaseId: '[DATABASE_ID]', - name: '[NAME]', + databaseId:'[DATABASE_ID]' , + name:'[NAME]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index e9865bfe..b23f0f72 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = databases.deleteAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md index 58869201..f72125e1 100644 --- a/docs/examples/databases/delete-collection.md +++ b/docs/examples/databases/delete-collection.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = databases.deleteCollection( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index 0d298f3b..bd4adc7c 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -7,13 +7,13 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = databases.deleteDocument( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - documentId: '[DOCUMENT_ID]', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + documentId:'[DOCUMENT_ID]' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index be5b2a5c..3bcd726b 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = databases.deleteIndex( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md index ff19beea..c46befdb 100644 --- a/docs/examples/databases/delete.md +++ b/docs/examples/databases/delete.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = databases.delete( - databaseId: '[DATABASE_ID]', + databaseId:'[DATABASE_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index c27ddb64..9a5e9e68 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = databases.getAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md index 359f0df8..41977e87 100644 --- a/docs/examples/databases/get-collection.md +++ b/docs/examples/databases/get-collection.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = databases.getCollection( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index 2141abf4..8e5faaaf 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -7,13 +7,13 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = databases.getDocument( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - documentId: '[DOCUMENT_ID]', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + documentId:'[DOCUMENT_ID]' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index 2b8a9031..63add609 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = databases.getIndex( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md index f0cc118b..b8eb7749 100644 --- a/docs/examples/databases/get.md +++ b/docs/examples/databases/get.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = databases.get( - databaseId: '[DATABASE_ID]', + databaseId:'[DATABASE_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index 60ca58f3..a4755433 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = databases.listAttributes( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index a10038db..f1b9c80f 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = databases.listCollections( - databaseId: '[DATABASE_ID]', + databaseId:'[DATABASE_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 70299774..2b1c27b5 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = databases.listDocuments( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index 6703ebf3..ed2e1585 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = databases.listIndexes( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index d9bd06ad..772d5181 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index 94853d28..f62cabc1 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -11,11 +11,11 @@ void main() { // Init SDK ; Future result = databases.updateBooleanAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - xrequired: false, - xdefault: false, + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + xrequired:false , + xdefault:false , ); result @@ -24,4 +24,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index a5f32dea..7341232e 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = databases.updateCollection( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - name: '[NAME]', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + name:'[NAME]' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index f93aa815..a217cb1c 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -11,11 +11,11 @@ void main() { // Init SDK ; Future result = databases.updateDatetimeAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - xrequired: false, - xdefault: '', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + xrequired:false , + xdefault:'' , ); result @@ -24,4 +24,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index fb08413f..c21a4daf 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -7,13 +7,13 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = databases.updateDocument( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - documentId: '[DOCUMENT_ID]', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + documentId:'[DOCUMENT_ID]' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index 8fd104db..a6385c13 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -11,11 +11,11 @@ void main() { // Init SDK ; Future result = databases.updateEmailAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - xrequired: false, - xdefault: 'email@example.com', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + xrequired:false , + xdefault:'email@example.com' , ); result @@ -24,4 +24,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index 20c44817..04515351 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -11,12 +11,12 @@ void main() { // Init SDK ; Future result = databases.updateEnumAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - elements: [], - xrequired: false, - xdefault: '[DEFAULT]', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + elements:[] , + xrequired:false , + xdefault:'[DEFAULT]' , ); result @@ -25,4 +25,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index 50432542..d8eeb67a 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -11,13 +11,13 @@ void main() { // Init SDK ; Future result = databases.updateFloatAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - xrequired: false, - min: 0, - max: 0, - xdefault: 0, + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + xrequired:false , + min:0 , + max:0 , + xdefault:0 , ); result @@ -26,4 +26,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 2d3da6ce..432f13cf 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -11,13 +11,13 @@ void main() { // Init SDK ; Future result = databases.updateIntegerAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - xrequired: false, - min: 0, - max: 0, - xdefault: 0, + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + xrequired:false , + min:0 , + max:0 , + xdefault:0 , ); result @@ -26,4 +26,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index 8c4cf4f3..7680e756 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -11,11 +11,11 @@ void main() { // Init SDK ; Future result = databases.updateIpAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - xrequired: false, - xdefault: '', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + xrequired:false , + xdefault:'' , ); result @@ -24,4 +24,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index 239e23da..b4c07a60 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = databases.updateRelationshipAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index 7f24507a..fec6f0de 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -11,11 +11,11 @@ void main() { // Init SDK ; Future result = databases.updateStringAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - xrequired: false, - xdefault: '[DEFAULT]', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + xrequired:false , + xdefault:'[DEFAULT]' , ); result @@ -24,4 +24,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index d7dd6758..b5712281 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -11,11 +11,11 @@ void main() { // Init SDK ; Future result = databases.updateUrlAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - key: '', - xrequired: false, - xdefault: 'https://example.com', + databaseId:'[DATABASE_ID]' , + collectionId:'[COLLECTION_ID]' , + key:'' , + xrequired:false , + xdefault:'https://example.com' , ); result @@ -24,4 +24,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index 59070cef..4d8f27bd 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = databases.update( - databaseId: '[DATABASE_ID]', - name: '[NAME]', + databaseId:'[DATABASE_ID]' , + name:'[NAME]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/create-build.md b/docs/examples/functions/create-build.md index 530ba6de..0b19e4b3 100644 --- a/docs/examples/functions/create-build.md +++ b/docs/examples/functions/create-build.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = functions.createBuild( - functionId: '[FUNCTION_ID]', - deploymentId: '[DEPLOYMENT_ID]', - buildId: '[BUILD_ID]', + functionId:'[FUNCTION_ID]' , + deploymentId:'[DEPLOYMENT_ID]' , + buildId:'[BUILD_ID]' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index 8be0f1a7..8f2cc223 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = functions.createDeployment( - functionId: '[FUNCTION_ID]', - code: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'), - activate: false, + functionId:'[FUNCTION_ID]' , + code:InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg') , + activate:false , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index f5de49f7..f35c4948 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = functions.createExecution( - functionId: '[FUNCTION_ID]', + functionId:'[FUNCTION_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index 50cd063c..565d4c0f 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = functions.createVariable( - functionId: '[FUNCTION_ID]', - key: '[KEY]', - value: '[VALUE]', + functionId:'[FUNCTION_ID]' , + key:'[KEY]' , + value:'[VALUE]' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 73d84fcf..ff8bb454 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = functions.create( - functionId: '[FUNCTION_ID]', - name: '[NAME]', - runtime: 'node-18.0', + functionId:'[FUNCTION_ID]' , + name:'[NAME]' , + runtime: .node180, ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md index e65380c5..8e920bf6 100644 --- a/docs/examples/functions/delete-deployment.md +++ b/docs/examples/functions/delete-deployment.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = functions.deleteDeployment( - functionId: '[FUNCTION_ID]', - deploymentId: '[DEPLOYMENT_ID]', + functionId:'[FUNCTION_ID]' , + deploymentId:'[DEPLOYMENT_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md index 87c7f407..747ad8b6 100644 --- a/docs/examples/functions/delete-variable.md +++ b/docs/examples/functions/delete-variable.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = functions.deleteVariable( - functionId: '[FUNCTION_ID]', - variableId: '[VARIABLE_ID]', + functionId:'[FUNCTION_ID]' , + variableId:'[VARIABLE_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md index 51633669..d49b56f6 100644 --- a/docs/examples/functions/delete.md +++ b/docs/examples/functions/delete.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = functions.delete( - functionId: '[FUNCTION_ID]', + functionId:'[FUNCTION_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/download-deployment.md b/docs/examples/functions/download-deployment.md index d77d3aaf..ab219700 100644 --- a/docs/examples/functions/download-deployment.md +++ b/docs/examples/functions/download-deployment.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = functions.downloadDeployment( - functionId: '[FUNCTION_ID]', - deploymentId: '[DEPLOYMENT_ID]', + functionId:'[FUNCTION_ID]' , + deploymentId:'[DEPLOYMENT_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md index 9cab571e..708731b2 100644 --- a/docs/examples/functions/get-deployment.md +++ b/docs/examples/functions/get-deployment.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = functions.getDeployment( - functionId: '[FUNCTION_ID]', - deploymentId: '[DEPLOYMENT_ID]', + functionId:'[FUNCTION_ID]' , + deploymentId:'[DEPLOYMENT_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index 6cadde64..7c27e4f6 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = functions.getExecution( - functionId: '[FUNCTION_ID]', - executionId: '[EXECUTION_ID]', + functionId:'[FUNCTION_ID]' , + executionId:'[EXECUTION_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md index 924bee2b..203c78c4 100644 --- a/docs/examples/functions/get-variable.md +++ b/docs/examples/functions/get-variable.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = functions.getVariable( - functionId: '[FUNCTION_ID]', - variableId: '[VARIABLE_ID]', + functionId:'[FUNCTION_ID]' , + variableId:'[VARIABLE_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md index 503ab207..d8d8bd0a 100644 --- a/docs/examples/functions/get.md +++ b/docs/examples/functions/get.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = functions.get( - functionId: '[FUNCTION_ID]', + functionId:'[FUNCTION_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index b12f9eba..f3fe9ef4 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = functions.listDeployments( - functionId: '[FUNCTION_ID]', + functionId:'[FUNCTION_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 3d66a449..464b3bd0 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = functions.listExecutions( - functionId: '[FUNCTION_ID]', + functionId:'[FUNCTION_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md index 091a1116..c1e22f4b 100644 --- a/docs/examples/functions/list-runtimes.md +++ b/docs/examples/functions/list-runtimes.md @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index f3c6655b..ef998bca 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = functions.listVariables( - functionId: '[FUNCTION_ID]', + functionId:'[FUNCTION_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index 4f2b1140..9dfb828d 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/update-deployment.md b/docs/examples/functions/update-deployment.md index d503aecb..edf052b5 100644 --- a/docs/examples/functions/update-deployment.md +++ b/docs/examples/functions/update-deployment.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = functions.updateDeployment( - functionId: '[FUNCTION_ID]', - deploymentId: '[DEPLOYMENT_ID]', + functionId:'[FUNCTION_ID]' , + deploymentId:'[DEPLOYMENT_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index 126d2644..e5681fff 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = functions.updateVariable( - functionId: '[FUNCTION_ID]', - variableId: '[VARIABLE_ID]', - key: '[KEY]', + functionId:'[FUNCTION_ID]' , + variableId:'[VARIABLE_ID]' , + key:'[KEY]' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 2b92f553..1a390a98 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = functions.update( - functionId: '[FUNCTION_ID]', - name: '[NAME]', + functionId:'[FUNCTION_ID]' , + name:'[NAME]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index 780ee09f..b207aabf 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = graphql.mutation( - query: {}, + query:{} , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index 7f22f536..08f45777 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = graphql.query( - query: {}, + query:{} , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md index 922dcfa1..869bed29 100644 --- a/docs/examples/health/get-antivirus.md +++ b/docs/examples/health/get-antivirus.md @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md index 4b63edee..0ac99e02 100644 --- a/docs/examples/health/get-cache.md +++ b/docs/examples/health/get-cache.md @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md new file mode 100644 index 00000000..c47b621f --- /dev/null +++ b/docs/examples/health/get-certificate.md @@ -0,0 +1,22 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Health health = Health(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = health.getCertificate( + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/health/get-d-b.md b/docs/examples/health/get-d-b.md index 65188c09..f6c90880 100644 --- a/docs/examples/health/get-d-b.md +++ b/docs/examples/health/get-d-b.md @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md new file mode 100644 index 00000000..a1c24fee --- /dev/null +++ b/docs/examples/health/get-failed-jobs.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Health health = Health(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = health.getFailedJobs( + name: .v1Database, + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md index ef20bed8..4e577ffa 100644 --- a/docs/examples/health/get-pub-sub.md +++ b/docs/examples/health/get-pub-sub.md @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md index 9a21d45c..0d14d5a3 100644 --- a/docs/examples/health/get-queue-builds.md +++ b/docs/examples/health/get-queue-builds.md @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md index e70f772f..231433dc 100644 --- a/docs/examples/health/get-queue-certificates.md +++ b/docs/examples/health/get-queue-certificates.md @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md index a1540fbb..64e5a960 100644 --- a/docs/examples/health/get-queue-databases.md +++ b/docs/examples/health/get-queue-databases.md @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md index bdcb85cc..cccca883 100644 --- a/docs/examples/health/get-queue-deletes.md +++ b/docs/examples/health/get-queue-deletes.md @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md index 4121cb56..df8de720 100644 --- a/docs/examples/health/get-queue-functions.md +++ b/docs/examples/health/get-queue-functions.md @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md index 310a1a3c..f89d966d 100644 --- a/docs/examples/health/get-queue-logs.md +++ b/docs/examples/health/get-queue-logs.md @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md index fcd67bb5..e4462b28 100644 --- a/docs/examples/health/get-queue-mails.md +++ b/docs/examples/health/get-queue-mails.md @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md index 30b5c8e9..ad79f2dc 100644 --- a/docs/examples/health/get-queue-messaging.md +++ b/docs/examples/health/get-queue-messaging.md @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md index 375989cf..9ec18507 100644 --- a/docs/examples/health/get-queue-migrations.md +++ b/docs/examples/health/get-queue-migrations.md @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md index ffb7acd8..363d900f 100644 --- a/docs/examples/health/get-queue-webhooks.md +++ b/docs/examples/health/get-queue-webhooks.md @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-queue.md b/docs/examples/health/get-queue.md index 8b7c823d..48b60ba2 100644 --- a/docs/examples/health/get-queue.md +++ b/docs/examples/health/get-queue.md @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md index 4a586690..0e54a6df 100644 --- a/docs/examples/health/get-storage-local.md +++ b/docs/examples/health/get-storage-local.md @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md index d8166dd3..668fe608 100644 --- a/docs/examples/health/get-time.md +++ b/docs/examples/health/get-time.md @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md index 1be37e5a..10d1addb 100644 --- a/docs/examples/health/get.md +++ b/docs/examples/health/get.md @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index 9ecb18c5..e0fe8a10 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = locale.get(); @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index abc4528c..f0f9a670 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = locale.listCodes(); @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index e6849303..c92a6bb7 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = locale.listContinents(); @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-e-u.md index 2d1ddcf8..7965dab7 100644 --- a/docs/examples/locale/list-countries-e-u.md +++ b/docs/examples/locale/list-countries-e-u.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = locale.listCountriesEU(); @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index 23057013..f3ef0685 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = locale.listCountriesPhones(); @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index ef115833..7d4d8b4b 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = locale.listCountries(); @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index 0810f3da..9acad5c1 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = locale.listCurrencies(); @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index f3d642cc..7a636681 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = locale.listLanguages(); @@ -18,4 +18,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file 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..792cd997 --- /dev/null +++ b/docs/examples/messaging/create-a-p-n-s-provider.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.createAPNSProvider( + providerId:'[PROVIDER_ID]' , + name:'[NAME]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md new file mode 100644 index 00000000..670d2431 --- /dev/null +++ b/docs/examples/messaging/create-email.md @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.createEmail( + messageId:'[MESSAGE_ID]' , + subject:'[SUBJECT]' , + content:'[CONTENT]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file 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..595feb7f --- /dev/null +++ b/docs/examples/messaging/create-f-c-m-provider.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.createFCMProvider( + providerId:'[PROVIDER_ID]' , + name:'[NAME]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md new file mode 100644 index 00000000..5e9b4e7a --- /dev/null +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.createMailgunProvider( + providerId:'[PROVIDER_ID]' , + name:'[NAME]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/create-msg91provider.md b/docs/examples/messaging/create-msg91provider.md new file mode 100644 index 00000000..2754ef16 --- /dev/null +++ b/docs/examples/messaging/create-msg91provider.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.createMsg91Provider( + providerId:'[PROVIDER_ID]' , + name:'[NAME]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md new file mode 100644 index 00000000..79f68709 --- /dev/null +++ b/docs/examples/messaging/create-push.md @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.createPush( + messageId:'[MESSAGE_ID]' , + title:'[TITLE]' , + body:'[BODY]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file 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..82bbaab2 --- /dev/null +++ b/docs/examples/messaging/create-s-m-s.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.createSMS( + messageId:'[MESSAGE_ID]' , + content:'[CONTENT]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file 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..c22c27c0 --- /dev/null +++ b/docs/examples/messaging/create-s-m-t-p-provider.md @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.createSMTPProvider( + providerId:'[PROVIDER_ID]' , + name:'[NAME]' , + host:'[HOST]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md new file mode 100644 index 00000000..61f80a28 --- /dev/null +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.createSendgridProvider( + providerId:'[PROVIDER_ID]' , + name:'[NAME]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md new file mode 100644 index 00000000..2cb79dd0 --- /dev/null +++ b/docs/examples/messaging/create-subscriber.md @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + ; + + Future result = messaging.createSubscriber( + topicId:'[TOPIC_ID]' , + subscriberId:'[SUBSCRIBER_ID]' , + targetId:'[TARGET_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md new file mode 100644 index 00000000..f1693170 --- /dev/null +++ b/docs/examples/messaging/create-telesign-provider.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.createTelesignProvider( + providerId:'[PROVIDER_ID]' , + name:'[NAME]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md new file mode 100644 index 00000000..d6b248f4 --- /dev/null +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.createTextmagicProvider( + providerId:'[PROVIDER_ID]' , + name:'[NAME]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md new file mode 100644 index 00000000..0dfafc16 --- /dev/null +++ b/docs/examples/messaging/create-topic.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.createTopic( + topicId:'[TOPIC_ID]' , + name:'[NAME]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md new file mode 100644 index 00000000..88e77590 --- /dev/null +++ b/docs/examples/messaging/create-twilio-provider.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.createTwilioProvider( + providerId:'[PROVIDER_ID]' , + name:'[NAME]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md new file mode 100644 index 00000000..e51ab437 --- /dev/null +++ b/docs/examples/messaging/create-vonage-provider.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.createVonageProvider( + providerId:'[PROVIDER_ID]' , + name:'[NAME]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md new file mode 100644 index 00000000..2f53a4d4 --- /dev/null +++ b/docs/examples/messaging/delete-provider.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.deleteProvider( + providerId:'[PROVIDER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md new file mode 100644 index 00000000..0a24dfc0 --- /dev/null +++ b/docs/examples/messaging/delete-subscriber.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + ; + + Future result = messaging.deleteSubscriber( + topicId:'[TOPIC_ID]' , + subscriberId:'[SUBSCRIBER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md new file mode 100644 index 00000000..343a5321 --- /dev/null +++ b/docs/examples/messaging/delete-topic.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.deleteTopic( + topicId:'[TOPIC_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md new file mode 100644 index 00000000..bf466d20 --- /dev/null +++ b/docs/examples/messaging/delete.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.delete( + messageId:'[MESSAGE_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md new file mode 100644 index 00000000..25876c6c --- /dev/null +++ b/docs/examples/messaging/get-message.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.getMessage( + messageId:'[MESSAGE_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md new file mode 100644 index 00000000..73a46154 --- /dev/null +++ b/docs/examples/messaging/get-provider.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.getProvider( + providerId:'[PROVIDER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md new file mode 100644 index 00000000..7ac072b6 --- /dev/null +++ b/docs/examples/messaging/get-subscriber.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.getSubscriber( + topicId:'[TOPIC_ID]' , + subscriberId:'[SUBSCRIBER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md new file mode 100644 index 00000000..4473566b --- /dev/null +++ b/docs/examples/messaging/get-topic.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.getTopic( + topicId:'[TOPIC_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md new file mode 100644 index 00000000..5bda8a1e --- /dev/null +++ b/docs/examples/messaging/list-message-logs.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.listMessageLogs( + messageId:'[MESSAGE_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md new file mode 100644 index 00000000..ff78bb35 --- /dev/null +++ b/docs/examples/messaging/list-messages.md @@ -0,0 +1,22 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.listMessages( + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md new file mode 100644 index 00000000..fb23a313 --- /dev/null +++ b/docs/examples/messaging/list-provider-logs.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.listProviderLogs( + providerId:'[PROVIDER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md new file mode 100644 index 00000000..9770b835 --- /dev/null +++ b/docs/examples/messaging/list-providers.md @@ -0,0 +1,22 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.listProviders( + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md new file mode 100644 index 00000000..bed33f03 --- /dev/null +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.listSubscriberLogs( + subscriberId:'[SUBSCRIBER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md new file mode 100644 index 00000000..ccfda580 --- /dev/null +++ b/docs/examples/messaging/list-subscribers.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.listSubscribers( + topicId:'[TOPIC_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md new file mode 100644 index 00000000..d51d200d --- /dev/null +++ b/docs/examples/messaging/list-targets.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.listTargets( + messageId:'[MESSAGE_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md new file mode 100644 index 00000000..4827c450 --- /dev/null +++ b/docs/examples/messaging/list-topic-logs.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.listTopicLogs( + topicId:'[TOPIC_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md new file mode 100644 index 00000000..3b653496 --- /dev/null +++ b/docs/examples/messaging/list-topics.md @@ -0,0 +1,22 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.listTopics( + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file 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..0fb41a2f --- /dev/null +++ b/docs/examples/messaging/update-a-p-n-s-provider.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.updateAPNSProvider( + providerId:'[PROVIDER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md new file mode 100644 index 00000000..aa4cbddc --- /dev/null +++ b/docs/examples/messaging/update-email.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.updateEmail( + messageId:'[MESSAGE_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file 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..868f2a2a --- /dev/null +++ b/docs/examples/messaging/update-f-c-m-provider.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.updateFCMProvider( + providerId:'[PROVIDER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md new file mode 100644 index 00000000..1d494c3f --- /dev/null +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.updateMailgunProvider( + providerId:'[PROVIDER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/update-msg91provider.md b/docs/examples/messaging/update-msg91provider.md new file mode 100644 index 00000000..73a03d2a --- /dev/null +++ b/docs/examples/messaging/update-msg91provider.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.updateMsg91Provider( + providerId:'[PROVIDER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md new file mode 100644 index 00000000..92bf2127 --- /dev/null +++ b/docs/examples/messaging/update-push.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.updatePush( + messageId:'[MESSAGE_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file 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..f091ba6f --- /dev/null +++ b/docs/examples/messaging/update-s-m-s.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.updateSMS( + messageId:'[MESSAGE_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file 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..d74bbcd2 --- /dev/null +++ b/docs/examples/messaging/update-s-m-t-p-provider.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.updateSMTPProvider( + providerId:'[PROVIDER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md new file mode 100644 index 00000000..89c60247 --- /dev/null +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.updateSendgridProvider( + providerId:'[PROVIDER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md new file mode 100644 index 00000000..fa6b5a20 --- /dev/null +++ b/docs/examples/messaging/update-telesign-provider.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.updateTelesignProvider( + providerId:'[PROVIDER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md new file mode 100644 index 00000000..971f8850 --- /dev/null +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.updateTextmagicProvider( + providerId:'[PROVIDER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md new file mode 100644 index 00000000..1fa9cc25 --- /dev/null +++ b/docs/examples/messaging/update-topic.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.updateTopic( + topicId:'[TOPIC_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md new file mode 100644 index 00000000..1ad3697c --- /dev/null +++ b/docs/examples/messaging/update-twilio-provider.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.updateTwilioProvider( + providerId:'[PROVIDER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md new file mode 100644 index 00000000..c185c1f3 --- /dev/null +++ b/docs/examples/messaging/update-vonage-provider.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Messaging messaging = Messaging(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = messaging.updateVonageProvider( + providerId:'[PROVIDER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index 745a6b50..3ad7a0d4 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = storage.createBucket( - bucketId: '[BUCKET_ID]', - name: '[NAME]', + bucketId:'[BUCKET_ID]' , + name:'[NAME]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index ab4c661a..f1efad6b 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -8,13 +8,13 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = storage.createFile( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', - file: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'), + bucketId:'[BUCKET_ID]' , + fileId:'[FILE_ID]' , + file:InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg') , ); result @@ -23,4 +23,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md index de516561..2cf8cb51 100644 --- a/docs/examples/storage/delete-bucket.md +++ b/docs/examples/storage/delete-bucket.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = storage.deleteBucket( - bucketId: '[BUCKET_ID]', + bucketId:'[BUCKET_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index 8e4460bb..622f498e 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = storage.deleteFile( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId:'[BUCKET_ID]' , + fileId:'[FILE_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md index 9e39076e..e0ec232e 100644 --- a/docs/examples/storage/get-bucket.md +++ b/docs/examples/storage/get-bucket.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = storage.getBucket( - bucketId: '[BUCKET_ID]', + bucketId:'[BUCKET_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index 6534fe33..ef00b0d2 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = storage.getFileDownload( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId:'[BUCKET_ID]' , + fileId:'[FILE_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index ca16d635..2091e7b2 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = storage.getFilePreview( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId:'[BUCKET_ID]' , + fileId:'[FILE_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index 5c3d69dc..01959e51 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = storage.getFileView( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId:'[BUCKET_ID]' , + fileId:'[FILE_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index bc45c3f1..e532682f 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = storage.getFile( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId:'[BUCKET_ID]' , + fileId:'[FILE_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index 6a35febb..3aa7b99b 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index 40b8d3bc..f17658f0 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = storage.listFiles( - bucketId: '[BUCKET_ID]', + bucketId:'[BUCKET_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index 064d2f2e..2ea2a8ae 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = storage.updateBucket( - bucketId: '[BUCKET_ID]', - name: '[NAME]', + bucketId:'[BUCKET_ID]' , + name:'[NAME]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index 2fa999a5..bd340862 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = storage.updateFile( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId:'[BUCKET_ID]' , + fileId:'[FILE_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index cc861181..44a7daa6 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = teams.createMembership( - teamId: '[TEAM_ID]', - roles: [], + teamId:'[TEAM_ID]' , + roles:[] , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index 74895b23..adc0480b 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = teams.create( - teamId: '[TEAM_ID]', - name: '[NAME]', + teamId:'[TEAM_ID]' , + name:'[NAME]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index 8c135994..cc3246d1 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = teams.deleteMembership( - teamId: '[TEAM_ID]', - membershipId: '[MEMBERSHIP_ID]', + teamId:'[TEAM_ID]' , + membershipId:'[MEMBERSHIP_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index a5fee4d0..8286949d 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = teams.delete( - teamId: '[TEAM_ID]', + teamId:'[TEAM_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index 4193b245..afca18a8 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = teams.getMembership( - teamId: '[TEAM_ID]', - membershipId: '[MEMBERSHIP_ID]', + teamId:'[TEAM_ID]' , + membershipId:'[MEMBERSHIP_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index 27f2ef15..46457abd 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = teams.getPrefs( - teamId: '[TEAM_ID]', + teamId:'[TEAM_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index daa67c4e..adec734d 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = teams.get( - teamId: '[TEAM_ID]', + teamId:'[TEAM_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 74c66c03..709de974 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -7,11 +7,11 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = teams.listMemberships( - teamId: '[TEAM_ID]', + teamId:'[TEAM_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index 11033f33..9370bd92 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -7,7 +7,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = teams.list( @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index ca704e0f..550679ca 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -7,14 +7,14 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = teams.updateMembershipStatus( - teamId: '[TEAM_ID]', - membershipId: '[MEMBERSHIP_ID]', - userId: '[USER_ID]', - secret: '[SECRET]', + teamId:'[TEAM_ID]' , + membershipId:'[MEMBERSHIP_ID]' , + userId:'[USER_ID]' , + secret:'[SECRET]' , ); result @@ -23,4 +23,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index 85b126c1..91b82d4c 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -7,13 +7,13 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = teams.updateMembership( - teamId: '[TEAM_ID]', - membershipId: '[MEMBERSHIP_ID]', - roles: [], + teamId:'[TEAM_ID]' , + membershipId:'[MEMBERSHIP_ID]' , + roles:[] , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index 088a5cfb..835d2c83 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSession('') // The user session to authenticate with ; Future result = teams.updateName( - teamId: '[TEAM_ID]', - name: '[NAME]', + teamId:'[TEAM_ID]' , + name:'[NAME]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index d99e8217..2acaed5e 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -7,12 +7,12 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token + .setSession('') // The user session to authenticate with ; Future result = teams.updatePrefs( - teamId: '[TEAM_ID]', - prefs: {}, + teamId:'[TEAM_ID]' , + prefs:{} , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/create-argon2user.md b/docs/examples/users/create-argon2user.md index a40b3afd..bb013e1a 100644 --- a/docs/examples/users/create-argon2user.md +++ b/docs/examples/users/create-argon2user.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = users.createArgon2User( - userId: '[USER_ID]', - email: 'email@example.com', - password: 'password', + userId:'[USER_ID]' , + email:'email@example.com' , + password:'password' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md index 8b55d656..fc6f26d2 100644 --- a/docs/examples/users/create-bcrypt-user.md +++ b/docs/examples/users/create-bcrypt-user.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = users.createBcryptUser( - userId: '[USER_ID]', - email: 'email@example.com', - password: 'password', + userId:'[USER_ID]' , + email:'email@example.com' , + password:'password' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/create-m-d5user.md b/docs/examples/users/create-m-d5user.md index 3ab8901f..201dc9f6 100644 --- a/docs/examples/users/create-m-d5user.md +++ b/docs/examples/users/create-m-d5user.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = users.createMD5User( - userId: '[USER_ID]', - email: 'email@example.com', - password: 'password', + userId:'[USER_ID]' , + email:'email@example.com' , + password:'password' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/create-p-h-pass-user.md b/docs/examples/users/create-p-h-pass-user.md index bedb44f4..b6a52cd3 100644 --- a/docs/examples/users/create-p-h-pass-user.md +++ b/docs/examples/users/create-p-h-pass-user.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = users.createPHPassUser( - userId: '[USER_ID]', - email: 'email@example.com', - password: 'password', + userId:'[USER_ID]' , + email:'email@example.com' , + password:'password' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/create-s-h-a-user.md b/docs/examples/users/create-s-h-a-user.md index 361f309a..9dcc1c6c 100644 --- a/docs/examples/users/create-s-h-a-user.md +++ b/docs/examples/users/create-s-h-a-user.md @@ -11,9 +11,9 @@ void main() { // Init SDK ; Future result = users.createSHAUser( - userId: '[USER_ID]', - email: 'email@example.com', - password: 'password', + userId:'[USER_ID]' , + email:'email@example.com' , + password:'password' , ); result @@ -22,4 +22,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md index fa5b8051..1e007641 100644 --- a/docs/examples/users/create-scrypt-modified-user.md +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -11,12 +11,12 @@ void main() { // Init SDK ; Future result = users.createScryptModifiedUser( - userId: '[USER_ID]', - email: 'email@example.com', - password: 'password', - passwordSalt: '[PASSWORD_SALT]', - passwordSaltSeparator: '[PASSWORD_SALT_SEPARATOR]', - passwordSignerKey: '[PASSWORD_SIGNER_KEY]', + userId:'[USER_ID]' , + email:'email@example.com' , + password:'password' , + passwordSalt:'[PASSWORD_SALT]' , + passwordSaltSeparator:'[PASSWORD_SALT_SEPARATOR]' , + passwordSignerKey:'[PASSWORD_SIGNER_KEY]' , ); result @@ -25,4 +25,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index 91e1f7dc..2f58c7ca 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -11,14 +11,14 @@ void main() { // Init SDK ; Future result = users.createScryptUser( - userId: '[USER_ID]', - email: 'email@example.com', - password: 'password', - passwordSalt: '[PASSWORD_SALT]', - passwordCpu: 0, - passwordMemory: 0, - passwordParallel: 0, - passwordLength: 0, + userId:'[USER_ID]' , + email:'email@example.com' , + password:'password' , + passwordSalt:'[PASSWORD_SALT]' , + passwordCpu:0 , + passwordMemory:0 , + passwordParallel:0 , + passwordLength:0 , ); result @@ -27,4 +27,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md new file mode 100644 index 00000000..ad791ae3 --- /dev/null +++ b/docs/examples/users/create-session.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.createSession( + userId:'[USER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md new file mode 100644 index 00000000..1bd30dd0 --- /dev/null +++ b/docs/examples/users/create-target.md @@ -0,0 +1,26 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.createTarget( + userId:'[USER_ID]' , + targetId:'[TARGET_ID]' , + providerType: MessagingProviderType.email, + identifier:'[IDENTIFIER]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md new file mode 100644 index 00000000..c832b6fe --- /dev/null +++ b/docs/examples/users/create-token.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.createToken( + userId:'[USER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index 517cd22f..382ed190 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = users.create( - userId: '[USER_ID]', + userId:'[USER_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/delete-authenticator.md b/docs/examples/users/delete-authenticator.md new file mode 100644 index 00000000..5689790e --- /dev/null +++ b/docs/examples/users/delete-authenticator.md @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.deleteAuthenticator( + userId:'[USER_ID]' , + type: .totp, + otp:'[OTP]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md index 4bcfd6d4..3e276d2e 100644 --- a/docs/examples/users/delete-identity.md +++ b/docs/examples/users/delete-identity.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = users.deleteIdentity( - identityId: '[IDENTITY_ID]', + identityId:'[IDENTITY_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md index 3f761187..b916944f 100644 --- a/docs/examples/users/delete-session.md +++ b/docs/examples/users/delete-session.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = users.deleteSession( - userId: '[USER_ID]', - sessionId: '[SESSION_ID]', + userId:'[USER_ID]' , + sessionId:'[SESSION_ID]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md index 69cbc5e8..6b0d23e1 100644 --- a/docs/examples/users/delete-sessions.md +++ b/docs/examples/users/delete-sessions.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = users.deleteSessions( - userId: '[USER_ID]', + userId:'[USER_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md new file mode 100644 index 00000000..293f83f6 --- /dev/null +++ b/docs/examples/users/delete-target.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.deleteTarget( + userId:'[USER_ID]' , + targetId:'[TARGET_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md index 1e1311d5..32e3bbee 100644 --- a/docs/examples/users/delete.md +++ b/docs/examples/users/delete.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = users.delete( - userId: '[USER_ID]', + userId:'[USER_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md index eb33ae65..5b325aa9 100644 --- a/docs/examples/users/get-prefs.md +++ b/docs/examples/users/get-prefs.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = users.getPrefs( - userId: '[USER_ID]', + userId:'[USER_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md new file mode 100644 index 00000000..3ba2166a --- /dev/null +++ b/docs/examples/users/get-target.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.getTarget( + userId:'[USER_ID]' , + targetId:'[TARGET_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md index c5685293..b1f6b2b3 100644 --- a/docs/examples/users/get.md +++ b/docs/examples/users/get.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = users.get( - userId: '[USER_ID]', + userId:'[USER_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/list-factors.md b/docs/examples/users/list-factors.md new file mode 100644 index 00000000..339a01f5 --- /dev/null +++ b/docs/examples/users/list-factors.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.listFactors( + userId:'[USER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index b19fed01..5d0dafb5 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index 0d2143ad..e0f18152 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = users.listLogs( - userId: '[USER_ID]', + userId:'[USER_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index 36a83ede..294dab07 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = users.listMemberships( - userId: '[USER_ID]', + userId:'[USER_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index 5f77fdbf..74dfe67a 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = users.listSessions( - userId: '[USER_ID]', + userId:'[USER_ID]' , ); result @@ -20,4 +20,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md new file mode 100644 index 00000000..e394846b --- /dev/null +++ b/docs/examples/users/list-targets.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.listTargets( + userId:'[USER_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 34498c00..5d947f9e 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -19,4 +19,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md index 8853f865..21a9a450 100644 --- a/docs/examples/users/update-email-verification.md +++ b/docs/examples/users/update-email-verification.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = users.updateEmailVerification( - userId: '[USER_ID]', - emailVerification: false, + userId:'[USER_ID]' , + emailVerification:false , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md index 8813e110..0cab9402 100644 --- a/docs/examples/users/update-email.md +++ b/docs/examples/users/update-email.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = users.updateEmail( - userId: '[USER_ID]', - email: 'email@example.com', + userId:'[USER_ID]' , + email:'email@example.com' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md index ecd06e76..467ad388 100644 --- a/docs/examples/users/update-labels.md +++ b/docs/examples/users/update-labels.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = users.updateLabels( - userId: '[USER_ID]', - labels: [], + userId:'[USER_ID]' , + labels:[] , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md new file mode 100644 index 00000000..01bab89a --- /dev/null +++ b/docs/examples/users/update-mfa.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.updateMfa( + userId:'[USER_ID]' , + mfa:false , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md index 56797d58..91bb04b3 100644 --- a/docs/examples/users/update-name.md +++ b/docs/examples/users/update-name.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = users.updateName( - userId: '[USER_ID]', - name: '[NAME]', + userId:'[USER_ID]' , + name:'[NAME]' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index 3dfedb4d..d7d24d9b 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = users.updatePassword( - userId: '[USER_ID]', - password: '', + userId:'[USER_ID]' , + password:'' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md index 37c3ced6..7c4d57a2 100644 --- a/docs/examples/users/update-phone-verification.md +++ b/docs/examples/users/update-phone-verification.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = users.updatePhoneVerification( - userId: '[USER_ID]', - phoneVerification: false, + userId:'[USER_ID]' , + phoneVerification:false , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md index 4d5e3110..adad1c95 100644 --- a/docs/examples/users/update-phone.md +++ b/docs/examples/users/update-phone.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = users.updatePhone( - userId: '[USER_ID]', - number: '+12065550100', + userId:'[USER_ID]' , + number:'+12065550100' , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md index c6c1bbed..f5fadbc7 100644 --- a/docs/examples/users/update-prefs.md +++ b/docs/examples/users/update-prefs.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = users.updatePrefs( - userId: '[USER_ID]', - prefs: {}, + userId:'[USER_ID]' , + prefs:{} , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md index 6f80745a..dacac6f4 100644 --- a/docs/examples/users/update-status.md +++ b/docs/examples/users/update-status.md @@ -11,8 +11,8 @@ void main() { // Init SDK ; Future result = users.updateStatus( - userId: '[USER_ID]', - status: false, + userId:'[USER_ID]' , + status:false , ); result @@ -21,4 +21,4 @@ void main() { // Init SDK }).catchError((error) { print(error.response); }); -} \ No newline at end of file +}} \ No newline at end of file diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md new file mode 100644 index 00000000..64a3effc --- /dev/null +++ b/docs/examples/users/update-target.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.updateTarget( + userId:'[USER_ID]' , + targetId:'[TARGET_ID]' , + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +}} \ No newline at end of file diff --git a/lib/dart_appwrite.dart b/lib/dart_appwrite.dart index 2d5becc5..8c88df56 100644 --- a/lib/dart_appwrite.dart +++ b/lib/dart_appwrite.dart @@ -7,12 +7,14 @@ library dart_appwrite; import 'dart:async'; import 'dart:typed_data'; +import 'dart:convert'; import 'src/enums.dart'; import 'src/service.dart'; import 'src/input_file.dart'; import 'src/upload_progress.dart'; import 'models.dart' as models; +import 'enums.dart' as enums; export 'src/response.dart'; export 'src/client.dart'; @@ -31,6 +33,7 @@ part 'services/functions.dart'; part 'services/graphql.dart'; part 'services/health.dart'; part 'services/locale.dart'; +part 'services/messaging.dart'; part 'services/storage.dart'; part 'services/teams.dart'; part 'services/users.dart'; diff --git a/lib/enums.dart b/lib/enums.dart new file mode 100644 index 00000000..c5c04330 --- /dev/null +++ b/lib/enums.dart @@ -0,0 +1,22 @@ +/// Appwrite Enums +library dart_appwrite.enums; + +part 'src/enums/factor.dart'; +part 'src/enums/type.dart'; +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/relationship_type.dart'; +part 'src/enums/relation_mutate.dart'; +part 'src/enums/index_type.dart'; +part 'src/enums/runtime.dart'; +part 'src/enums/execution_method.dart'; +part 'src/enums/name.dart'; +part 'src/enums/message_status.dart'; +part 'src/enums/smtp_encryption.dart'; +part 'src/enums/compression.dart'; +part 'src/enums/image_gravity.dart'; +part 'src/enums/image_format.dart'; +part 'src/enums/password_hash.dart'; +part 'src/enums/messaging_provider_type.dart'; diff --git a/lib/models.dart b/lib/models.dart index b3b2c7d2..578b4d04 100644 --- a/lib/models.dart +++ b/lib/models.dart @@ -25,6 +25,11 @@ part 'src/models/currency_list.dart'; part 'src/models/phone_list.dart'; part 'src/models/variable_list.dart'; part 'src/models/locale_code_list.dart'; +part 'src/models/provider_list.dart'; +part 'src/models/message_list.dart'; +part 'src/models/topic_list.dart'; +part 'src/models/subscriber_list.dart'; +part 'src/models/target_list.dart'; part 'src/models/database.dart'; part 'src/models/collection.dart'; part 'src/models/attribute_list.dart'; @@ -53,6 +58,7 @@ part 'src/models/preferences.dart'; part 'src/models/session.dart'; part 'src/models/identity.dart'; part 'src/models/token.dart'; +part 'src/models/jwt.dart'; part 'src/models/locale.dart'; part 'src/models/locale_code.dart'; part 'src/models/file.dart'; @@ -72,5 +78,14 @@ part 'src/models/phone.dart'; part 'src/models/health_antivirus.dart'; part 'src/models/health_queue.dart'; part 'src/models/health_status.dart'; +part 'src/models/health_certificate.dart'; part 'src/models/health_time.dart'; part 'src/models/headers.dart'; +part 'src/models/mfa_challenge.dart'; +part 'src/models/mfa_type.dart'; +part 'src/models/mfa_factors.dart'; +part 'src/models/provider.dart'; +part 'src/models/message.dart'; +part 'src/models/topic.dart'; +part 'src/models/subscriber.dart'; +part 'src/models/target.dart'; diff --git a/lib/query.dart b/lib/query.dart index 5e16445b..6fc8003a 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -1,8 +1,32 @@ part of dart_appwrite; + /// Helper class to generate query strings. class Query { - Query._(); + final String method; + final String? attribute; + final dynamic values; + + Query._(this.method, [this.attribute = null, this.values = null]); + + Map toJson() { + final map = { + 'method': method, + }; + + if(attribute != null) { + map['attribute'] = attribute; + } + + if(values != null) { + map['values'] = values is List ? values : [values]; + } + + return map; + } + + @override + String toString() => jsonEncode(toJson()); /// Filter resources where [attribute] is equal to [value]. /// @@ -10,90 +34,90 @@ class Query { /// the query will return resources where [attribute] is equal /// to any of the values in the list. static String equal(String attribute, dynamic value) => - _addQuery(attribute, 'equal', value); + Query._('equal', attribute, value).toString(); /// Filter resources where [attribute] is not 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. static String notEqual(String attribute, dynamic value) => - _addQuery(attribute, 'notEqual', value); + Query._('notEqual', attribute, [value]).toString(); /// Filter resources where [attribute] is less than [value]. static String lessThan(String attribute, dynamic value) => - _addQuery(attribute, 'lessThan', value); + Query._('lessThan', attribute, value).toString(); /// Filter resources where [attribute] is less than or equal to [value]. static String lessThanEqual(String attribute, dynamic value) => - _addQuery(attribute, 'lessThanEqual', value); + Query._('lessThanEqual', attribute, value).toString(); /// Filter resources where [attribute] is greater than [value]. static String greaterThan(String attribute, dynamic value) => - _addQuery(attribute, 'greaterThan', value); + Query._('greaterThan', attribute, value).toString(); /// Filter resources where [attribute] is greater than or equal to [value]. static String greaterThanEqual(String attribute, dynamic value) => - _addQuery(attribute, 'greaterThanEqual', value); + Query._('greaterThanEqual', attribute, value).toString(); /// Filter resources where by searching [attribute] for [value]. static String search(String attribute, String value) => - _addQuery(attribute, 'search', value); + Query._('search', attribute, value).toString(); /// Filter resources where [attribute] is null. - static String isNull(String attribute) => 'isNull("$attribute")'; + static String isNull(String attribute) => Query._('isNull', attribute).toString(); /// Filter resources where [attribute] is not null. - static String isNotNull(String attribute) => 'isNotNull("$attribute")'; + 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) => - 'between("$attribute", ${_parseValues(start)}, ${_parseValues(end)})'; + Query._('between', attribute, [start, end]).toString(); /// Filter resources where [attribute] starts with [value]. static String startsWith(String attribute, String value) => - _addQuery(attribute, 'startsWith', value); + Query._('startsWith', attribute, value).toString(); /// Filter resources where [attribute] ends with [value]. static String endsWith(String attribute, String value) => - _addQuery(attribute, 'endsWith', value); + Query._('endsWith', attribute, value).toString(); + + /// Filter resources where [attribute] contains [value] + /// [value] can be a single value or a list. + 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(); + + 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) => - 'select([${attributes.map((attr) => "\"$attr\"").join(",")}])'; + Query._('select', null, attributes).toString(); /// Sort results by [attribute] ascending. - static String orderAsc(String attribute) => 'orderAsc("$attribute")'; + static String orderAsc(String attribute) => Query._('orderAsc', attribute).toString(); /// Sort results by [attribute] descending. - static String orderDesc(String attribute) => 'orderDesc("$attribute")'; + 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) => 'cursorBefore("$id")'; + 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) => 'cursorAfter("$id")'; + static String cursorAfter(String id) => Query._('cursorAfter', null, id).toString(); /// Return only [limit] results. - static String limit(int limit) => 'limit($limit)'; + 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) => 'offset($offset)'; - - static String _addQuery(String attribute, String method, dynamic value) => (value - is List) - ? '$method("$attribute", [${value.map((item) => _parseValues(item)).join(",")}])' - : '$method("$attribute", [${_parseValues(value)}])'; + static String offset(int offset) => Query._('offset', null, offset).toString(); - static String _parseValues(dynamic value) => - (value is String) ? '"$value"' : '$value'; } \ No newline at end of file diff --git a/lib/services/account.dart b/lib/services/account.dart index bf763098..ed6a0802 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -26,6 +26,38 @@ class Account extends Service { } + /// Create account + /// + /// 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 email /// /// Update currently logged in user account email address. After changing user @@ -60,7 +92,7 @@ class Account extends Service { /// List Identities /// /// Get the list of identities for the currently logged in user. - Future listIdentities({String? queries}) async { + Future listIdentities({List? queries}) async { final String apiPath = '/account/identities'; final Map apiParams = { @@ -80,7 +112,7 @@ class Account extends Service { } - /// Delete Identity + /// Delete identity /// /// Delete an identity by its unique ID. Future deleteIdentity({required String identityId}) async { @@ -102,6 +134,32 @@ class Account extends Service { } + /// Create JWT + /// + /// 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/jwt'; + + 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); + + } + /// List logs /// /// Get the list of latest security activity logs for the currently logged in @@ -126,6 +184,159 @@ class Account extends Service { } + /// Update MFA + /// + Future updateMFA({required bool mfa}) async { + final String apiPath = '/account/mfa'; + + final Map apiParams = { + + 'mfa': mfa, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.User.fromMap(res.data); + + } + + /// Create 2FA Challenge + /// + Future create2FAChallenge({required enums.Factor factor}) async { + final String apiPath = '/account/mfa/challenge'; + + final Map apiParams = { + + 'factor': factor, + + }; + + 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); + + } + + /// Create MFA Challenge (confirmation) + /// + Future updateChallenge({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 res.data; + + } + + /// List Factors + /// + Future listFactors() async { + final String apiPath = '/account/mfa/factors'; + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.MfaFactors.fromMap(res.data); + + } + + /// Add Authenticator + /// + Future addAuthenticator({required enums.Type type}) async { + final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type); + + 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 Authenticator + /// + Future verifyAuthenticator({required enums.Type type, required String otp}) async { + final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type); + + 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 Authenticator + /// + Future deleteAuthenticator({required enums.Type type, required String otp}) async { + final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type); + + final Map apiParams = { + + 'otp': otp, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.User.fromMap(res.data); + + } + /// Update name /// /// Update currently logged in user account name. @@ -293,7 +504,7 @@ class Account extends Service { /// 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, required String passwordAgain}) async { + Future updateRecovery({required String userId, required String secret, required String password}) async { final String apiPath = '/account/recovery'; final Map apiParams = { @@ -301,7 +512,6 @@ class Account extends Service { 'userId': userId, 'secret': secret, 'password': password, -'passwordAgain': passwordAgain, }; @@ -362,6 +572,156 @@ class Account extends Service { } + /// Create anonymous session + /// + /// 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); + + } + + /// Create email password session + /// + /// 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); + + } + + /// Create session (deprecated) + /// + /// 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); + + } + + /// Create OAuth2 session + /// + /// 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 there is already an active session, the new session will be attached to + /// the logged-in account. If there are no active sessions, the server will + /// attempt to look for a user with the same email address as the email + /// received from the OAuth2 provider and attach the new session to the + /// existing user. If no matching user is found - the server will create a new + /// 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 createOAuth2Session({required enums.OAuthProvider provider, String? success, String? failure, bool? token, List? scopes}) async { + final String apiPath = '/account/sessions/oauth2/{provider}'.replaceAll('{provider}', provider); + + final Map apiParams = { + 'success': success, +'failure': failure, +'token': token, +'scopes': scopes, + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } + + /// Create session + /// + /// 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); + + } + /// Get session /// /// Use this endpoint to get a logged in user's session using a Session ID. @@ -385,11 +745,10 @@ class Account extends Service { } - /// Update OAuth session (refresh tokens) + /// Update (or renew) a session /// - /// Access tokens have limited lifespan and expire to mitigate security risks. - /// If session was created using an OAuth provider, this route can be used to - /// "refresh" the access token. + /// Extend session's expiry to increase it's lifespan. Extending a session is + /// useful when session length is short such as 5 minutes. Future updateSession({required String sessionId}) async { final String apiPath = '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); @@ -459,6 +818,114 @@ class Account extends Service { } + /// Create email token (OTP) + /// + /// 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); + + } + + /// Create magic URL token + /// + /// 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. If you are on a mobile device you can leave + /// the URL parameter empty, so that the login completion will be handled by + /// your Appwrite instance by default. + /// + /// 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); + + } + + /// Create phone token + /// + /// 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); + + } + /// Create email verification /// /// Use this endpoint to send a verification message to your user email address diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index d8004197..a9a5881d 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -17,7 +17,7 @@ class Avatars extends Service { /// 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 String code, int? width, int? height, int? quality}) async { + Future getBrowser({required enums.Browser code, int? width, int? height, int? quality}) async { final String apiPath = '/avatars/browsers/{code}'.replaceAll('{code}', code); final Map params = { @@ -27,7 +27,7 @@ class Avatars extends Service { 'project': client.config['project'], - 'key': client.config['key'], + 'session': client.config['session'], }; final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); @@ -45,7 +45,7 @@ class Avatars extends Service { /// image at source quality. If dimensions are not specified, the default size /// of image returned is 100x100px. /// - Future getCreditCard({required String code, int? width, int? height, int? quality}) async { + Future getCreditCard({required enums.CreditCard code, int? width, int? height, int? quality}) async { final String apiPath = '/avatars/credit-cards/{code}'.replaceAll('{code}', code); final Map params = { @@ -55,7 +55,7 @@ class Avatars extends Service { 'project': client.config['project'], - 'key': client.config['key'], + 'session': client.config['session'], }; final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); @@ -75,7 +75,7 @@ class Avatars extends Service { 'project': client.config['project'], - 'key': client.config['key'], + 'session': client.config['session'], }; final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); @@ -94,7 +94,7 @@ class Avatars extends Service { /// image at source quality. If dimensions are not specified, the default size /// of image returned is 100x100px. /// - Future getFlag({required String code, int? width, int? height, int? quality}) async { + Future getFlag({required enums.Flag code, int? width, int? height, int? quality}) async { final String apiPath = '/avatars/flags/{code}'.replaceAll('{code}', code); final Map params = { @@ -104,7 +104,7 @@ class Avatars extends Service { 'project': client.config['project'], - 'key': client.config['key'], + 'session': client.config['session'], }; final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); @@ -133,7 +133,7 @@ class Avatars extends Service { 'project': client.config['project'], - 'key': client.config['key'], + 'session': client.config['session'], }; final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); @@ -169,7 +169,7 @@ class Avatars extends Service { 'project': client.config['project'], - 'key': client.config['key'], + 'session': client.config['session'], }; final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); @@ -192,7 +192,7 @@ class Avatars extends Service { 'project': client.config['project'], - 'key': client.config['key'], + 'session': client.config['session'], }; final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 360a8d3f..ebcd3399 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -653,7 +653,7 @@ class Databases extends Service { /// 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 String type, bool? twoWay, String? key, String? twoWayKey, String? onDelete}) async { + 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 = { @@ -833,7 +833,7 @@ class Databases extends Service { /// 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, String? onDelete}) async { + Future updateRelationshipAttribute({required String databaseId, required String collectionId, required String key, enums.RelationMutate? onDelete}) async { final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { @@ -1000,7 +1000,7 @@ class Databases extends Service { /// Create index /// - Future createIndex({required String databaseId, required String collectionId, required String key, required String type, required List attributes, List? orders}) async { + Future createIndex({required String databaseId, required String collectionId, required String key, required enums.IndexType type, required List attributes, List? orders}) async { final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { diff --git a/lib/services/functions.dart b/lib/services/functions.dart index 93356cfd..78dccbd9 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -36,7 +36,7 @@ class Functions extends Service { /// [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 String runtime, List? execute, List? events, String? schedule, int? timeout, bool? enabled, bool? logging, String? entrypoint, String? commands, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? templateRepository, String? templateOwner, String? templateRootDirectory, String? templateBranch}) async { + 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, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? templateRepository, String? templateOwner, String? templateRootDirectory, String? templateBranch}) async { final String apiPath = '/functions'; final Map apiParams = { @@ -122,7 +122,7 @@ class Functions extends Service { /// Update function /// /// Update function by its unique ID. - Future update({required String functionId, required String name, String? runtime, List? execute, List? events, String? schedule, int? timeout, bool? enabled, bool? logging, String? entrypoint, String? commands, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory}) async { + 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, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory}) async { final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); final Map apiParams = { @@ -387,7 +387,7 @@ class Functions extends Service { /// 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, String? method, Map? headers}) async { + Future createExecution({required String functionId, String? body, bool? xasync, String? path, enums.ExecutionMethod? method, Map? headers}) async { final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); final Map apiParams = { diff --git a/lib/services/health.dart b/lib/services/health.dart index 6681b50c..b1c6cdf6 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -72,6 +72,29 @@ class Health extends Service { } + /// Get the SSL certificate for a domain + /// + /// Get the SSL certificate for a domain + Future getCertificate({String? domain}) async { + final String apiPath = '/health/certificate'; + + final Map apiParams = { + 'domain': domain, + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.HealthCertificate.fromMap(res.data); + + } + /// Get DB /// /// Check the Appwrite database servers are up and connection is successful. @@ -237,6 +260,30 @@ class Health extends Service { } + /// Get number of failed queue jobs + /// + /// 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); + + final Map apiParams = { + 'threshold': threshold, + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.HealthQueue.fromMap(res.data); + + } + /// Get functions queue /// Future getQueueFunctions({int? threshold}) async { diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart new file mode 100644 index 00000000..359e1ca1 --- /dev/null +++ b/lib/services/messaging.dart @@ -0,0 +1,1193 @@ +part of dart_appwrite; + +/// The Messaging service allows you to send messages to any provider type +/// (SMTP, push notification, SMS, etc.). +class Messaging extends Service { + Messaging(super.client); + + /// List messages + /// + Future listMessages({List? queries, String? search}) async { + final String apiPath = '/messaging/messages'; + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.MessageList.fromMap(res.data); + + } + + /// Create an email. + /// + Future createEmail({required String messageId, required String subject, required String content, List? topics, List? users, List? targets, List? cc, List? bcc, enums.MessageStatus? status, 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, +'status': status, +'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. + /// + Future updateEmail({required String messageId, List? topics, List? users, List? targets, String? subject, String? content, enums.MessageStatus? status, bool? html, List? cc, List? bcc, String? scheduledAt}) async { + final String apiPath = '/messaging/messages/email/{messageId}'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + + 'topics': topics, +'users': users, +'targets': targets, +'subject': subject, +'content': content, +'status': status, +'html': html, +'cc': cc, +'bcc': bcc, +'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); + + } + + /// Create a push notification. + /// + Future createPush({required String messageId, required String title, required String body, List? topics, List? users, List? targets, Map? data, String? action, String? icon, String? sound, String? color, String? tag, String? badge, enums.MessageStatus? status, String? scheduledAt}) 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, +'icon': icon, +'sound': sound, +'color': color, +'tag': tag, +'badge': badge, +'status': status, +'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 a push notification. + /// + Future updatePush({required String messageId, List? topics, List? users, List? targets, String? title, String? body, Map? data, String? action, String? icon, String? sound, String? color, String? tag, int? badge, enums.MessageStatus? status, String? scheduledAt}) 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, +'icon': icon, +'sound': sound, +'color': color, +'tag': tag, +'badge': badge, +'status': status, +'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); + + } + + /// Create an SMS. + /// + Future createSMS({required String messageId, required String content, List? topics, List? users, List? targets, enums.MessageStatus? status, String? scheduledAt}) async { + final String apiPath = '/messaging/messages/sms'; + + final Map apiParams = { + + 'messageId': messageId, +'content': content, +'topics': topics, +'users': users, +'targets': targets, +'status': status, +'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. + /// + Future updateSMS({required String messageId, List? topics, List? users, List? targets, String? content, enums.MessageStatus? status, String? scheduledAt}) async { + final String apiPath = '/messaging/messages/sms/{messageId}'.replaceAll('{messageId}', messageId); + + final Map apiParams = { + + 'topics': topics, +'users': users, +'targets': targets, +'content': content, +'status': status, +'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 + /// + Future getMessage({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.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Message.fromMap(res.data); + + } + + /// Delete a 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; + + } + + /// List message logs + /// + 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 = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.LogList.fromMap(res.data); + + } + + /// List message targets + /// + /// List the targets associated with a message as set via the targets + /// attribute. + 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 = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.TargetList.fromMap(res.data); + + } + + /// List providers + /// + Future listProviders({List? queries, String? search}) async { + final String apiPath = '/messaging/providers'; + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ProviderList.fromMap(res.data); + + } + + /// Create APNS provider + /// + Future createAPNSProvider({required String providerId, required String name, String? authKey, String? authKeyId, String? teamId, String? bundleId, bool? enabled}) async { + final String apiPath = '/messaging/providers/apns'; + + final Map apiParams = { + + 'providerId': providerId, +'name': name, +'authKey': authKey, +'authKeyId': authKeyId, +'teamId': teamId, +'bundleId': bundleId, +'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 APNS provider + /// + Future updateAPNSProvider({required String providerId, String? name, bool? enabled, String? authKey, String? authKeyId, String? teamId, String? bundleId}) 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, + + }; + + 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 FCM 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 FCM provider + /// + 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 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 Mailgun provider + /// + 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 Msg91 provider + /// + Future createMsg91Provider({required String providerId, required String name, String? from, String? senderId, String? authKey, bool? enabled}) async { + final String apiPath = '/messaging/providers/msg91'; + + final Map apiParams = { + + 'providerId': providerId, +'name': name, +'from': from, +'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 Msg91 provider + /// + Future updateMsg91Provider({required String providerId, String? name, bool? enabled, String? senderId, String? authKey, String? from}) async { + final String apiPath = '/messaging/providers/msg91/{providerId}'.replaceAll('{providerId}', providerId); + + final Map apiParams = { + + 'name': name, +'enabled': enabled, +'senderId': senderId, +'authKey': authKey, +'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 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 Sendgrid provider + /// + 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 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, +'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 SMTP provider + /// + 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, +'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 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 Telesign provider + /// + 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 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 Textmagic provider + /// + 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 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 Twilio provider + /// + 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 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 Vonage provider + /// + 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 provider + /// + Future getProvider({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.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Provider.fromMap(res.data); + + } + + /// Delete provider + /// + 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; + + } + + /// List provider logs + /// + 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 = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.LogList.fromMap(res.data); + + } + + /// List subscriber logs + /// + 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 = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.LogList.fromMap(res.data); + + } + + /// List topics. + /// + Future listTopics({List? queries, String? search}) async { + final String apiPath = '/messaging/topics'; + + final Map apiParams = { + 'queries': queries, +'search': search, + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.TopicList.fromMap(res.data); + + } + + /// Create a 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. + /// + Future getTopic({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.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Topic.fromMap(res.data); + + } + + /// Update a topic. + /// + Future updateTopic({required String topicId, String? name}) async { + final String apiPath = '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); + + 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.Topic.fromMap(res.data); + + } + + /// Delete a topic. + /// + 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; + + } + + /// List topic logs + /// + 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 = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.LogList.fromMap(res.data); + + } + + /// List subscribers. + /// + 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 = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.SubscriberList.fromMap(res.data); + + } + + /// Create a 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. + /// + 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 = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Subscriber.fromMap(res.data); + + } + + /// Delete a subscriber. + /// + 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/storage.dart b/lib/services/storage.dart index c7ffda5a..018d5592 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -32,7 +32,7 @@ class Storage extends Service { /// Create bucket /// /// Create a new storage bucket. - Future createBucket({required String bucketId, required String name, List? permissions, bool? fileSecurity, bool? enabled, int? maximumFileSize, List? allowedFileExtensions, String? compression, bool? encryption, bool? antivirus}) async { + 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 = { @@ -87,7 +87,7 @@ class Storage extends Service { /// Update bucket /// /// 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, String? compression, bool? encryption, bool? antivirus}) async { + 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 = { @@ -297,7 +297,7 @@ class Storage extends Service { 'project': client.config['project'], - 'key': client.config['key'], + 'session': client.config['session'], }; final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); @@ -311,7 +311,7 @@ class Storage extends Service { /// 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, String? gravity, int? quality, int? borderWidth, String? borderColor, int? borderRadius, double? opacity, int? rotation, String? background, String? output}) async { + 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}) async { final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); final Map params = { @@ -329,7 +329,7 @@ class Storage extends Service { 'project': client.config['project'], - 'key': client.config['key'], + 'session': client.config['session'], }; final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); @@ -348,7 +348,7 @@ class Storage extends Service { 'project': client.config['project'], - 'key': client.config['key'], + 'session': client.config['session'], }; final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); diff --git a/lib/services/users.dart b/lib/services/users.dart index 397b1677..9f47e763 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -117,7 +117,7 @@ class Users extends Service { /// List Identities /// /// Get identities for all users. - Future listIdentities({String? queries, String? search}) async { + Future listIdentities({List? queries, String? search}) async { final String apiPath = '/users/identities'; final Map apiParams = { @@ -138,7 +138,7 @@ class Users extends Service { } - /// Delete Identity + /// Delete identity /// /// Delete an identity by its unique ID. Future deleteIdentity({required String identityId}) async { @@ -291,7 +291,7 @@ class Users extends Service { /// [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, String? passwordVersion, String? name}) async { + 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 = { @@ -460,6 +460,71 @@ class Users extends Service { } + /// Update MFA + /// + 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); + + } + + /// List Factors + /// + Future listFactors({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/factors'.replaceAll('{userId}', userId); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.MfaFactors.fromMap(res.data); + + } + + /// Delete Authenticator + /// + Future deleteAuthenticator({required String userId, required enums.Type type, required String otp}) async { + final String apiPath = '/users/{userId}/mfa/{type}'.replaceAll('{userId}', userId).replaceAll('{type}', type); + + final Map apiParams = { + + 'otp': otp, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.User.fromMap(res.data); + + } + /// Update name /// /// Update the user name by its unique ID. @@ -598,6 +663,33 @@ class Users extends Service { } + /// Create session + /// + /// 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 user sessions /// /// Delete all user's sessions by using the user's unique ID. @@ -666,6 +758,148 @@ class Users extends Service { } + /// List User Targets + /// + 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 = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.TargetList.fromMap(res.data); + + } + + /// Create User 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, +'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 User Target + /// + 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 = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Target.fromMap(res.data); + + } + + /// Update User 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 user 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; + + } + + /// Create token + /// + /// Returns a token 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 [PUT + /// /account/sessions/custom](https://appwrite.io/docs/references/cloud/client-web/account#updateCustomSession) + /// 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 email verification /// /// Update the user email verification status by its unique ID. diff --git a/lib/src/client.dart b/lib/src/client.dart index 474654d5..d3ce7f65 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -19,7 +19,7 @@ abstract class Client { /// Initializes a [Client]. factory Client( - {String endPoint = 'https://HOSTNAME/v1', + {String endPoint = 'https://cloud.appwrite.io/v1', bool selfSigned = false}) => createClient(endPoint: endPoint, selfSigned: selfSigned); @@ -51,6 +51,21 @@ abstract class Client { /// Set Locale Client setLocale(value); + /// Set Session + /// + /// The user session to authenticate with + Client setSession(value); + + /// Set ForwardedFor + /// + /// The IP address of the client that made the request + Client setForwardedFor(value); + + /// Set ForwardedUserAgent + /// + /// The user agent string of the client that made the request + Client setForwardedUserAgent(value); + /// Add headers that should be sent with all API calls. Client addHeader(String key, String value); diff --git a/lib/src/client_base.dart b/lib/src/client_base.dart index 8cfb3d83..a03d2adb 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -14,6 +14,15 @@ abstract class ClientBase implements Client { ClientBase setJWT(value); @override ClientBase setLocale(value); + /// The user session to authenticate with + @override + ClientBase setSession(value); + /// The IP address of the client that made the request + @override + ClientBase setForwardedFor(value); + /// The user agent string of the client that made the request + @override + ClientBase setForwardedUserAgent(value); @override ClientBase setSelfSigned({bool status = true}); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index 0bd487c6..59a629b0 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -24,7 +24,7 @@ class ClientBrowser extends ClientBase with ClientMixin { late BrowserClient _httpClient; ClientBrowser({ - String endPoint = 'https://HOSTNAME/v1', + String endPoint = 'https://cloud.appwrite.io/v1', bool selfSigned = false, }) : _endPoint = endPoint { _httpClient = BrowserClient(); @@ -33,7 +33,7 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '10.1.1', + 'x-sdk-version': '11.0.0-rc.2', 'X-Appwrite-Response-Format' : '1.4.0', }; @@ -73,6 +73,27 @@ class ClientBrowser extends ClientBase with ClientMixin { 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 IP address of the client that made the request + @override + ClientBrowser setForwardedFor(value) { + config['forwardedFor'] = value; + addHeader('X-Forwarded-For', 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}) { diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 05583fbf..817be27d 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -29,7 +29,7 @@ class ClientIO extends ClientBase with ClientMixin { late HttpClient _nativeClient; ClientIO({ - String endPoint = 'https://HOSTNAME/v1', + String endPoint = 'https://cloud.appwrite.io/v1', bool selfSigned = false, }) : _endPoint = endPoint { _nativeClient = HttpClient() @@ -42,8 +42,8 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '10.1.1', - 'user-agent' : 'AppwriteDartSDK/10.1.1 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'x-sdk-version': '11.0.0-rc.2', + 'user-agent' : 'AppwriteDartSDK/11.0.0-rc.2 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', 'X-Appwrite-Response-Format' : '1.4.0', }; @@ -83,6 +83,27 @@ class ClientIO extends ClientBase with ClientMixin { 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 IP address of the client that made the request + @override + ClientIO setForwardedFor(value) { + config['forwardedFor'] = value; + addHeader('X-Forwarded-For', 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}) { diff --git a/lib/src/enums/browser.dart b/lib/src/enums/browser.dart new file mode 100644 index 00000000..92d8c5ad --- /dev/null +++ b/lib/src/enums/browser.dart @@ -0,0 +1,26 @@ +part of dart_appwrite.enums; + +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'); + + const Browser({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/compression.dart b/lib/src/enums/compression.dart new file mode 100644 index 00000000..2f510155 --- /dev/null +++ b/lib/src/enums/compression.dart @@ -0,0 +1,15 @@ +part of dart_appwrite.enums; + +enum Compression { + none(value: 'none'), + gzip(value: 'gzip'), + zstd(value: 'zstd'); + + const Compression({ + required this.value + }); + + final String 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 new file mode 100644 index 00000000..9f3523d2 --- /dev/null +++ b/lib/src/enums/credit_card.dart @@ -0,0 +1,28 @@ +part of dart_appwrite.enums; + +enum CreditCard { + americanExpress(value: 'amex'), + argencard(value: 'argencard'), + cabal(value: 'cabal'), + consosud(value: 'censosud'), + 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'); + + const CreditCard({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/execution_method.dart b/lib/src/enums/execution_method.dart new file mode 100644 index 00000000..2a67eea2 --- /dev/null +++ b/lib/src/enums/execution_method.dart @@ -0,0 +1,18 @@ +part of dart_appwrite.enums; + +enum ExecutionMethod { + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'); + + const ExecutionMethod({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/factor.dart b/lib/src/enums/factor.dart new file mode 100644 index 00000000..774d549b --- /dev/null +++ b/lib/src/enums/factor.dart @@ -0,0 +1,15 @@ +part of dart_appwrite.enums; + +enum Factor { + totp(value: 'totp'), + phone(value: 'phone'), + email(value: 'email'); + + const Factor({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/flag.dart b/lib/src/enums/flag.dart new file mode 100644 index 00000000..d32ac9d5 --- /dev/null +++ b/lib/src/enums/flag.dart @@ -0,0 +1,206 @@ +part of dart_appwrite.enums; + +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'), + cTeDIvoire(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'), + 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 + }); + + final String 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 new file mode 100644 index 00000000..3110d9e7 --- /dev/null +++ b/lib/src/enums/image_format.dart @@ -0,0 +1,17 @@ +part of dart_appwrite.enums; + +enum ImageFormat { + jpg(value: 'jpg'), + jpeg(value: 'jpeg'), + gif(value: 'gif'), + png(value: 'png'), + webp(value: 'webp'); + + const ImageFormat({ + required this.value + }); + + final String 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 new file mode 100644 index 00000000..2913f708 --- /dev/null +++ b/lib/src/enums/image_gravity.dart @@ -0,0 +1,21 @@ +part of dart_appwrite.enums; + +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'); + + const ImageGravity({ + required this.value + }); + + final String 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 new file mode 100644 index 00000000..8a9e6436 --- /dev/null +++ b/lib/src/enums/index_type.dart @@ -0,0 +1,16 @@ +part of dart_appwrite.enums; + +enum IndexType { + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'), + spatial(value: 'spatial'); + + const IndexType({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/message_status.dart b/lib/src/enums/message_status.dart new file mode 100644 index 00000000..6be52ace --- /dev/null +++ b/lib/src/enums/message_status.dart @@ -0,0 +1,15 @@ +part of dart_appwrite.enums; + +enum MessageStatus { + draft(value: 'draft'), + scheduled(value: 'scheduled'), + processing(value: 'processing'); + + const MessageStatus({ + required this.value + }); + + final String 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 new file mode 100644 index 00000000..a50c21b3 --- /dev/null +++ b/lib/src/enums/messaging_provider_type.dart @@ -0,0 +1,15 @@ +part of dart_appwrite.enums; + +enum MessagingProviderType { + email(value: 'email'), + sms(value: 'sms'), + push(value: 'push'); + + const MessagingProviderType({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/name.dart b/lib/src/enums/name.dart new file mode 100644 index 00000000..637b837e --- /dev/null +++ b/lib/src/enums/name.dart @@ -0,0 +1,24 @@ +part of dart_appwrite.enums; + +enum Name { + v1Database(value: 'v1-database'), + v1Deletes(value: 'v1-deletes'), + v1Audits(value: 'v1-audits'), + v1Mails(value: 'v1-mails'), + v1Functions(value: 'v1-functions'), + v1Usage(value: 'v1-usage'), + webhooksv1(value: 'webhooksv1'), + v1Certificates(value: 'v1-certificates'), + v1Builds(value: 'v1-builds'), + v1Messaging(value: 'v1-messaging'), + v1Migrations(value: 'v1-migrations'), + hamsterv1(value: 'hamsterv1'); + + const Name({ + required this.value + }); + + final String 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 new file mode 100644 index 00000000..cf4aa544 --- /dev/null +++ b/lib/src/enums/o_auth_provider.dart @@ -0,0 +1,51 @@ +part of dart_appwrite.enums; + +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'), + 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 + }); + + final String 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 new file mode 100644 index 00000000..ed2f0f54 --- /dev/null +++ b/lib/src/enums/password_hash.dart @@ -0,0 +1,23 @@ +part of dart_appwrite.enums; + +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'); + + const PasswordHash({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/relation_mutate.dart b/lib/src/enums/relation_mutate.dart new file mode 100644 index 00000000..c3a4fb91 --- /dev/null +++ b/lib/src/enums/relation_mutate.dart @@ -0,0 +1,15 @@ +part of dart_appwrite.enums; + +enum RelationMutate { + cascade(value: 'cascade'), + restrict(value: 'restrict'), + setNull(value: 'setNull'); + + const RelationMutate({ + required this.value + }); + + final String 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 new file mode 100644 index 00000000..9b281ed5 --- /dev/null +++ b/lib/src/enums/relationship_type.dart @@ -0,0 +1,16 @@ +part of dart_appwrite.enums; + +enum RelationshipType { + oneToOne(value: 'oneToOne'), + manyToOne(value: 'manyToOne'), + manyToMany(value: 'manyToMany'), + oneToMany(value: 'oneToMany'); + + const RelationshipType({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/runtime.dart b/lib/src/enums/runtime.dart new file mode 100644 index 00000000..4a39a081 --- /dev/null +++ b/lib/src/enums/runtime.dart @@ -0,0 +1,16 @@ +part of dart_appwrite.enums; + +enum Runtime { + node180(value: 'node-18.0'), + php80(value: 'php-8.0'), + ruby31(value: 'ruby-3.1'), + python39(value: 'python-3.9'); + + const Runtime({ + required this.value + }); + + final String 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 new file mode 100644 index 00000000..b86387e5 --- /dev/null +++ b/lib/src/enums/smtp_encryption.dart @@ -0,0 +1,15 @@ +part of dart_appwrite.enums; + +enum SMTPEncryption { + none(value: 'none'), + ssl(value: 'ssl'), + tls(value: 'tls'); + + const SMTPEncryption({ + required this.value + }); + + final String 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..2811888e --- /dev/null +++ b/lib/src/enums/type.dart @@ -0,0 +1,13 @@ +part of dart_appwrite.enums; + +enum Type { + totp(value: 'totp'); + + const Type({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart new file mode 100644 index 00000000..b5781027 --- /dev/null +++ b/lib/src/models/health_certificate.dart @@ -0,0 +1,48 @@ +part of dart_appwrite.models; + +/// 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, + }; + } +} diff --git a/lib/src/models/jwt.dart b/lib/src/models/jwt.dart new file mode 100644 index 00000000..f187a741 --- /dev/null +++ b/lib/src/models/jwt.dart @@ -0,0 +1,23 @@ +part of dart_appwrite.models; + +/// JWT +class Jwt implements Model { + /// JWT encoded string. + final String jwt; + + Jwt({ + required this.jwt, + }); + + factory Jwt.fromMap(Map map) { + return Jwt( + jwt: map['jwt'].toString(), + ); + } + + Map toMap() { + return { + "jwt": jwt, + }; + } +} diff --git a/lib/src/models/membership.dart b/lib/src/models/membership.dart index d83bd12f..1388e2e0 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -24,6 +24,8 @@ class Membership implements Model { 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. + final bool mfa; /// User list of roles final List roles; @@ -39,6 +41,7 @@ class Membership implements Model { required this.invited, required this.joined, required this.confirm, + required this.mfa, required this.roles, }); @@ -55,6 +58,7 @@ class Membership implements Model { invited: map['invited'].toString(), joined: map['joined'].toString(), confirm: map['confirm'], + mfa: map['mfa'], roles: map['roles'] ?? [], ); } @@ -72,6 +76,7 @@ class Membership implements Model { "invited": invited, "joined": joined, "confirm": confirm, + "mfa": mfa, "roles": roles, }; } diff --git a/lib/src/models/message.dart b/lib/src/models/message.dart new file mode 100644 index 00000000..9b63cfd3 --- /dev/null +++ b/lib/src/models/message.dart @@ -0,0 +1,83 @@ +part of dart_appwrite.models; + +/// 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: map['topics'] ?? [], + users: map['users'] ?? [], + targets: map['targets'] ?? [], + scheduledAt: map['scheduledAt']?.toString(), + deliveredAt: map['deliveredAt']?.toString(), + deliveryErrors: 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 new file mode 100644 index 00000000..b4c503ca --- /dev/null +++ b/lib/src/models/message_list.dart @@ -0,0 +1,28 @@ +part of dart_appwrite.models; + +/// Message list +class MessageList implements Model { + /// Total number of messages documents that matched your query. + final int total; + /// List of messages. + final List 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))), + ); + } + + 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 new file mode 100644 index 00000000..621dcda8 --- /dev/null +++ b/lib/src/models/mfa_challenge.dart @@ -0,0 +1,38 @@ +part of dart_appwrite.models; + +/// MFA Challenge +class MfaChallenge implements Model { + /// Token ID. + final String $id; + /// Token creation date in ISO 8601 format. + final String $createdAt; + /// User ID. + final String userId; + /// Token expiration date in ISO 8601 format. + final String 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(), + ); + } + + 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 new file mode 100644 index 00000000..485b7675 --- /dev/null +++ b/lib/src/models/mfa_factors.dart @@ -0,0 +1,33 @@ +part of dart_appwrite.models; + +/// MFAFactors +class MfaFactors implements Model { + /// TOTP + final bool totp; + /// Phone + final bool phone; + /// Email + final bool email; + + MfaFactors({ + required this.totp, + required this.phone, + required this.email, + }); + + factory MfaFactors.fromMap(Map map) { + return MfaFactors( + totp: map['totp'], + phone: map['phone'], + email: map['email'], + ); + } + + Map toMap() { + return { + "totp": totp, + "phone": phone, + "email": email, + }; + } +} diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart new file mode 100644 index 00000000..1f84b90f --- /dev/null +++ b/lib/src/models/mfa_type.dart @@ -0,0 +1,33 @@ +part of dart_appwrite.models; + +/// MFAType +class MfaType implements Model { + /// Backup codes. + final List backups; + /// Secret token used for TOTP factor. + final String secret; + /// URI for authenticator apps. + final String uri; + + MfaType({ + required this.backups, + required this.secret, + required this.uri, + }); + + factory MfaType.fromMap(Map map) { + return MfaType( + backups: map['backups'] ?? [], + secret: map['secret'].toString(), + uri: map['uri'].toString(), + ); + } + + Map toMap() { + return { + "backups": backups, + "secret": secret, + "uri": uri, + }; + } +} diff --git a/lib/src/models/provider.dart b/lib/src/models/provider.dart new file mode 100644 index 00000000..57c76c23 --- /dev/null +++ b/lib/src/models/provider.dart @@ -0,0 +1,63 @@ +part of dart_appwrite.models; + +/// Provider +class Provider implements Model { + /// Provider ID. + final String $id; + /// Provider creation time in ISO 8601 format. + final String $createdAt; + /// Provider update date in ISO 8601 format. + final String $updatedAt; + /// The name for the provider instance. + final String name; + /// The name of the provider service. + final String provider; + /// Is provider enabled? + final bool enabled; + /// Type of provider. + final String type; + /// Provider credentials. + final Map credentials; + /// 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, + }); + + 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, + }; + } +} diff --git a/lib/src/models/provider_list.dart b/lib/src/models/provider_list.dart new file mode 100644 index 00000000..9384dd33 --- /dev/null +++ b/lib/src/models/provider_list.dart @@ -0,0 +1,28 @@ +part of dart_appwrite.models; + +/// Provider list +class ProviderList implements Model { + /// Total number of providers documents that matched your query. + final int total; + /// List of providers. + final List 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))), + ); + } + + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } +} diff --git a/lib/src/models/session.dart b/lib/src/models/session.dart index e264530f..dfbe02d6 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -52,6 +52,10 @@ class Session implements Model { 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; Session({ required this.$id, @@ -79,6 +83,8 @@ class Session implements Model { required this.countryCode, required this.countryName, required this.current, + required this.factors, + required this.secret, }); factory Session.fromMap(Map map) { @@ -108,6 +114,8 @@ class Session implements Model { countryCode: map['countryCode'].toString(), countryName: map['countryName'].toString(), current: map['current'], + factors: map['factors'] ?? [], + secret: map['secret'].toString(), ); } @@ -138,6 +146,8 @@ class Session implements Model { "countryCode": countryCode, "countryName": countryName, "current": current, + "factors": factors, + "secret": secret, }; } } diff --git a/lib/src/models/subscriber.dart b/lib/src/models/subscriber.dart new file mode 100644 index 00000000..e4e8cde4 --- /dev/null +++ b/lib/src/models/subscriber.dart @@ -0,0 +1,63 @@ +part of dart_appwrite.models; + +/// Subscriber +class Subscriber implements Model { + /// Subscriber ID. + final String $id; + /// Subscriber creation time in ISO 8601 format. + final String $createdAt; + /// Subscriber update date in ISO 8601 format. + final String $updatedAt; + /// Target ID. + final String targetId; + /// Target. + final Target target; + /// Topic ID. + final String userId; + /// User Name. + final String userName; + /// Topic ID. + final String topicId; + /// 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, + }); + + 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, + }; + } +} diff --git a/lib/src/models/subscriber_list.dart b/lib/src/models/subscriber_list.dart new file mode 100644 index 00000000..8441475c --- /dev/null +++ b/lib/src/models/subscriber_list.dart @@ -0,0 +1,28 @@ +part of dart_appwrite.models; + +/// Subscriber list +class SubscriberList implements Model { + /// Total number of subscribers documents that matched your query. + final int total; + /// List of subscribers. + final List 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))), + ); + } + + Map toMap() { + return { + "total": total, + "subscribers": subscribers.map((p) => p.toMap()).toList(), + }; + } +} diff --git a/lib/src/models/target.dart b/lib/src/models/target.dart new file mode 100644 index 00000000..67a1f45a --- /dev/null +++ b/lib/src/models/target.dart @@ -0,0 +1,58 @@ +part of dart_appwrite.models; + +/// Target +class Target implements Model { + /// Target ID. + final String $id; + /// Target creation time in ISO 8601 format. + final String $createdAt; + /// Target update date in ISO 8601 format. + final String $updatedAt; + /// Target Name. + final String name; + /// User ID. + final String userId; + /// Provider ID. + final String? providerId; + /// The target provider type. Can be one of the following: `email`, `sms` or `push`. + final String providerType; + /// The target identifier. + final String identifier; + + Target({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.userId, + this.providerId, + required this.providerType, + required this.identifier, + }); + + 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(), + ); + } + + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "userId": userId, + "providerId": providerId, + "providerType": providerType, + "identifier": identifier, + }; + } +} diff --git a/lib/src/models/target_list.dart b/lib/src/models/target_list.dart new file mode 100644 index 00000000..4c2e953c --- /dev/null +++ b/lib/src/models/target_list.dart @@ -0,0 +1,28 @@ +part of dart_appwrite.models; + +/// Target list +class TargetList implements Model { + /// Total number of targets documents that matched your query. + final int total; + /// List of targets. + final List 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))), + ); + } + + Map toMap() { + return { + "total": total, + "targets": targets.map((p) => p.toMap()).toList(), + }; + } +} diff --git a/lib/src/models/token.dart b/lib/src/models/token.dart index cb5c59a6..83ef0fbf 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -12,6 +12,8 @@ class Token implements Model { 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, @@ -19,6 +21,7 @@ class Token implements Model { required this.userId, required this.secret, required this.expire, + required this.phrase, }); factory Token.fromMap(Map map) { @@ -28,6 +31,7 @@ class Token implements Model { userId: map['userId'].toString(), secret: map['secret'].toString(), expire: map['expire'].toString(), + phrase: map['phrase'].toString(), ); } @@ -38,6 +42,7 @@ class Token implements Model { "userId": userId, "secret": secret, "expire": expire, + "phrase": phrase, }; } } diff --git a/lib/src/models/topic.dart b/lib/src/models/topic.dart new file mode 100644 index 00000000..28e8154a --- /dev/null +++ b/lib/src/models/topic.dart @@ -0,0 +1,58 @@ +part of dart_appwrite.models; + +/// Topic +class Topic implements Model { + /// Topic ID. + final String $id; + /// Topic creation time in ISO 8601 format. + final String $createdAt; + /// Topic update date in ISO 8601 format. + final String $updatedAt; + /// The name of the topic. + final String name; + /// 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 push subscribers subscribed to the topic. + final int pushTotal; + /// 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, + }); + + 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: map['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 new file mode 100644 index 00000000..9368946c --- /dev/null +++ b/lib/src/models/topic_list.dart @@ -0,0 +1,28 @@ +part of dart_appwrite.models; + +/// Topic list +class TopicList implements Model { + /// Total number of topics documents that matched your query. + final int total; + /// List of topics. + final List 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))), + ); + } + + 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 32aa59a8..e30b9e90 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -32,8 +32,14 @@ class User implements Model { final bool emailVerification; /// Phone verification status. final bool phoneVerification; + /// Multi factor authentication status. + final bool mfa; + /// TOTP status. + final bool totp; /// 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; @@ -53,7 +59,10 @@ class User implements Model { required this.phone, required this.emailVerification, required this.phoneVerification, + required this.mfa, + required this.totp, required this.prefs, + required this.targets, required this.accessedAt, }); @@ -74,7 +83,10 @@ class User implements Model { phone: map['phone'].toString(), emailVerification: map['emailVerification'], phoneVerification: map['phoneVerification'], + mfa: map['mfa'], + totp: map['totp'], prefs: Preferences.fromMap(map['prefs']), + targets: List.from(map['targets'].map((p) => Target.fromMap(p))), accessedAt: map['accessedAt'].toString(), ); } @@ -96,7 +108,10 @@ class User implements Model { "phone": phone, "emailVerification": emailVerification, "phoneVerification": phoneVerification, + "mfa": mfa, + "totp": totp, "prefs": prefs.toMap(), + "targets": targets.map((p) => p.toMap()).toList(), "accessedAt": accessedAt, }; } diff --git a/pubspec.yaml b/pubspec.yaml index b5842f82..c5770739 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: dart_appwrite -version: 10.1.1 +version: 11.0.0-rc.2 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 diff --git a/test/query_test.dart b/test/query_test.dart index 1939b4ff..71d1cf23 100644 --- a/test/query_test.dart +++ b/test/query_test.dart @@ -19,42 +19,42 @@ void main() { BasicFilterQueryTest( description: 'with a string', value: 's', - expectedValues: '["s"]', + expectedValues: ["s"], ), BasicFilterQueryTest( description: 'with an integer', value: 1, - expectedValues: '[1]', + expectedValues: [1], ), BasicFilterQueryTest( description: 'with a double', value: 1.2, - expectedValues: '[1.2]', + expectedValues: [1.2], ), BasicFilterQueryTest( description: 'with a whole number double', value: 1.0, - expectedValues: '[1.0]', + expectedValues: [1.0], ), BasicFilterQueryTest( description: 'with a bool', value: false, - expectedValues: '[false]', + expectedValues: [false], ), 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, () { - expect( - Query.equal('attr', t.value), - 'equal("attr", ${t.expectedValues})', - ); + final query = Query.equal('attr', t.value).toJson(); + expect(query['attribute'], 'attr'); + expect(query['values'], t.expectedValues); + expect(query['method'], 'equal'); }); } }); @@ -62,10 +62,10 @@ void main() { group('notEqual()', () { for (var t in tests) { test(t.description, () { - expect( - Query.notEqual('attr', t.value), - 'notEqual("attr", ${t.expectedValues})', - ); + final query = Query.notEqual('attr', t.value).toJson(); + expect(query['attribute'], 'attr'); + expect(query['values'], t.expectedValues); + expect(query['method'], 'notEqual'); }); } }); @@ -73,10 +73,10 @@ void main() { group('lessThan()', () { for (var t in tests) { test(t.description, () { - expect( - Query.lessThan('attr', t.value), - 'lessThan("attr", ${t.expectedValues})', - ); + final query = Query.lessThan('attr', t.value).toJson(); + expect(query['attribute'], 'attr'); + expect(query['values'], t.expectedValues); + expect(query['method'], 'lessThan'); }); } }); @@ -84,10 +84,10 @@ void main() { group('lessThanEqual()', () { for (var t in tests) { test(t.description, () { - expect( - Query.lessThanEqual('attr', t.value), - 'lessThanEqual("attr", ${t.expectedValues})', - ); + final query = Query.lessThanEqual('attr', t.value).toJson(); + expect(query['attribute'], 'attr'); + expect(query['values'], t.expectedValues); + expect(query['method'], 'lessThanEqual'); }); } }); @@ -95,10 +95,10 @@ void main() { group('greaterThan()', () { for (var t in tests) { test(t.description, () { - expect( - Query.greaterThan('attr', t.value), - 'greaterThan("attr", ${t.expectedValues})', - ); + final query = Query.greaterThan('attr', t.value).toJson(); + expect(query['attribute'], 'attr'); + expect(query['values'], t.expectedValues); + expect(query['method'], 'greaterThan'); }); } }); @@ -106,87 +106,106 @@ void main() { group('greaterThanEqual()', () { for (var t in tests) { test(t.description, () { - expect( - Query.greaterThanEqual('attr', t.value), - 'greaterThanEqual("attr", ${t.expectedValues})', - ); + final query = Query.greaterThanEqual('attr', t.value).toJson(); + expect(query['attribute'], 'attr'); + expect(query['values'], t.expectedValues); + expect(query['method'], 'greaterThanEqual'); }); } }); }); - group('search()', () { - test('returns search', () { - expect(Query.search('attr', 'keyword1 keyword2'), 'search("attr", ["keyword1 keyword2"])'); - }); + test('returns search', () { + final query = Query.search('attr', 'keyword1 keyword2').toJson(); + expect(query['attribute'], 'attr'); + expect(query['values'], ['keyword1 keyword2']); + expect(query['method'], 'search'); }); - group('isNull()', () { - test('returns isNull', () { - expect(Query.isNull('attr'), 'isNull("attr")'); - }); + test('returns isNull', () { + final query = Query.isNull('attr').toJson(); + expect(query['attribute'], 'attr'); + expect(query['values'], null); + expect(query['method'], 'isNull'); }); - group('isNotNull()', () { - test('returns isNotNull', () { - expect(Query.isNotNull('attr'), 'isNotNull("attr")'); - }); + test('returns isNotNull', () { + final query = Query.isNotNull('attr', 'keyword1 keyword2').toJson(); + expect(query['attribute'], 'attr'); + expect(query['values'], null); + expect(query['method'], 'isNotNull'); }); group('between()', () { test('with integers', () { - expect(Query.between('attr', 1, 2), 'between("attr", [1,2])'); + final query = Query.between('attr', 1, 2).toJson(); + expect(query['attribute'], 'attr'); + expect(query['values'], [1, 2]); + expect(query['method'], 'between'); }); test('with doubles', () { - expect(Query.between('attr', 1.0, 2.0), 'between("attr", [1.0,2.0])'); + final query = Query.between('attr', 1.0, 2.0).toJson(); + expect(query['attribute'], 'attr'); + expect(query['values'], [1.0, 2.0]); + expect(query['method'], 'between'); }); test('with strings', () { - expect(Query.between('attr', "a", "z"), 'between("attr", ["a","z"])'); + final query = Query.between('attr', 'a', 'z').toJson(); + expect(query['attribute'], 'attr'); + expect(query['values'], ['a', 'z']); + expect(query['method'], 'between'); }); }); - group('select()', () { - test('returns select', () { - expect(Query.select(['attr1', 'attr2']), 'select(["attr1","attr2"])'); - }); + test('returns select', () { + final query = Query.select(['attr1', 'attr2']).toJson(); + expect(query['attribute'], null); + expect(query['values'], ['attr1', 'attr2']); + expect(query['method'], 'select'); }); - group('orderAsc()', () { - test('returns orderAsc', () { - expect(Query.orderAsc('attr'), 'orderAsc("attr")'); - }); + test('returns orderAsc', () { + final query = Query.orderAsc('attr').toJson(); + expect(query['attribute'], 'attr'); + expect(query['values'], null); + expect(query['method'], 'orderAsc'); }); - group('orderDesc()', () { - test('returns orderDesc', () { - expect(Query.orderDesc('attr'), 'orderDesc("attr")'); - }); + test('returns orderDesc', () { + final query = Query.orderDesc('attr').toJson(); + expect(query['attribute'], 'attr'); + expect(query['values'], null); + expect(query['method'], 'orderDesc'); }); - group('cursorBefore()', () { - test('returns cursorBefore', () { - expect(Query.cursorBefore(ID.custom('custom')), 'cursorBefore("custom")'); - }); + test('returns cursorBefore', () { + final query = Query.cursorBefore('custom').toJson(); + expect(query['attribute'], null); + expect(query['values'], 'custom'); + expect(query['method'], 'cursorBefore'); }); - group('cursorAfter()', () { - test('returns cursorAfter', () { - expect(Query.cursorAfter(ID.custom('custom')), 'cursorAfter("custom")'); - }); + test('returns cursorAfter', () { + final query = Query.cursorAfter('custom').toJson(); + expect(query['attribute'], null); + expect(query['values'], 'custom'); + expect(query['method'], 'cursorAfter'); }); - group('limit()', () { - test('returns limit', () { - expect(Query.limit(1), 'limit(1)'); - }); + test('returns limit', () { + final query = Query.limit(1).toJson(); + expect(query['attribute'], null); + expect(query['values'], 1); + expect(query['method'], 'limit'); }); - group('offset()', () { - test('returns offset', () { - expect(Query.offset(1), 'offset(1)'); - }); + test('returns offset', () { + final query = Query.offset(1).toJson(); + expect(query['attribute'], null); + expect(query['values'], 1); + expect(query['method'], 'offset'); }); } diff --git a/test/services/account_test.dart b/test/services/account_test.dart index de0434cf..a3d245cd 100644 --- a/test/services/account_test.dart +++ b/test/services/account_test.dart @@ -68,7 +68,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -83,6 +86,41 @@ void main() { }); + test('test method create()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'totp': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.create( + userId: '[USER_ID]', + email: 'email@example.com', + password: '', + ); + expect(response, isA()); + + }); + test('test method updateEmail()', () async { final Map data = { '\$id': '5e5ea5c16897e', @@ -97,7 +135,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -144,6 +185,22 @@ void main() { ); }); + test('test method createJWT()', () async { + final Map data = { + 'jwt': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createJWT( + ); + expect(response, isA()); + + }); + test('test method listLogs()', () async { final Map data = { 'total': 5, @@ -161,6 +218,178 @@ 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, + 'totp': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updateMFA( + mfa: true, + ); + expect(response, isA()); + + }); + + test('test method create2FAChallenge()', () 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.create2FAChallenge( + factor: 'totp', + ); + expect(response, isA()); + + }); + + test('test method updateChallenge()', () async { + final data = ''; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updateChallenge( + challengeId: '[CHALLENGE_ID]', + otp: '[OTP]', + ); + }); + + test('test method listFactors()', () async { + final Map data = { + 'totp': true, + 'phone': true, + 'email': true,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.listFactors( + ); + expect(response, isA()); + + }); + + test('test method addAuthenticator()', () async { + final Map data = { + 'backups': [], + 'secret': '1', + 'uri': '1',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.addAuthenticator( + type: 'totp', + ); + expect(response, isA()); + + }); + + test('test method verifyAuthenticator()', () async { + 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, + 'totp': 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.verifyAuthenticator( + type: 'totp', + otp: '[OTP]', + ); + expect(response, isA()); + + }); + + test('test method deleteAuthenticator()', () async { + 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, + 'totp': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.deleteAuthenticator( + type: 'totp', + otp: '[OTP]', + ); + expect(response, isA()); + + }); + test('test method updateName()', () async { final Map data = { '\$id': '5e5ea5c16897e', @@ -175,7 +404,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -205,7 +437,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -235,7 +470,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -281,7 +519,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -303,7 +544,8 @@ void main() { '\$createdAt': '2020-10-15T06:38:00.000+00:00', 'userId': '5e5ea5c168bb8', 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00',}; + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; when(client.call( @@ -325,7 +567,8 @@ void main() { '\$createdAt': '2020-10-15T06:38:00.000+00:00', 'userId': '5e5ea5c168bb8', 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00',}; + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; when(client.call( @@ -336,8 +579,7 @@ void main() { final response = await account.updateRecovery( userId: '[USER_ID]', secret: '[SECRET]', - password: 'password', - passwordAgain: 'password', + password: '', ); expect(response, isA()); @@ -372,6 +614,192 @@ void main() { ); }); + test('test method createAnonymousSession()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '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',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createAnonymousSession( + ); + expect(response, isA()); + + }); + + test('test method createEmailPasswordSession()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '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',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createEmailPasswordSession( + email: 'email@example.com', + password: 'password', + ); + expect(response, isA()); + + }); + + test('test method updateMagicURLSession()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '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',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updateMagicURLSession( + userId: '[USER_ID]', + secret: '[SECRET]', + ); + expect(response, isA()); + + }); + + test('test method createOAuth2Session()', () async { + + when(client.webAuth( + Uri(), + )).thenAnswer((_) async => 'done'); + + + final response = await account.createOAuth2Session( + provider: 'amazon', + ); + }); + + test('test method createSession()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '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',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createSession( + userId: '[USER_ID]', + secret: '[SECRET]', + ); + expect(response, isA()); + + }); + test('test method getSession()', () async { final Map data = { '\$id': '5e5ea5c16897e', @@ -398,7 +826,9 @@ void main() { 'deviceModel': 'Nexus 5', 'countryCode': 'US', 'countryName': 'United States', - 'current': true,}; + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e',}; when(client.call( @@ -439,7 +869,9 @@ void main() { 'deviceModel': 'Nexus 5', 'countryCode': 'US', 'countryName': 'United States', - 'current': true,}; + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e',}; when(client.call( @@ -481,7 +913,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -496,13 +931,83 @@ void main() { }); + test('test method createEmailToken()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createEmailToken( + userId: '[USER_ID]', + email: 'email@example.com', + ); + expect(response, isA()); + + }); + + test('test method createMagicURLToken()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createMagicURLToken( + userId: '[USER_ID]', + email: 'email@example.com', + ); + expect(response, isA()); + + }); + + test('test method createPhoneToken()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createPhoneToken( + userId: '[USER_ID]', + phone: '+12065550100', + ); + expect(response, isA()); + + }); + test('test method createVerification()', () async { final Map data = { '\$id': 'bb8ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', 'userId': '5e5ea5c168bb8', 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00',}; + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; when(client.call( @@ -523,7 +1028,8 @@ void main() { '\$createdAt': '2020-10-15T06:38:00.000+00:00', 'userId': '5e5ea5c168bb8', 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00',}; + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; when(client.call( @@ -545,7 +1051,8 @@ void main() { '\$createdAt': '2020-10-15T06:38:00.000+00:00', 'userId': '5e5ea5c168bb8', 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00',}; + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; when(client.call( @@ -565,7 +1072,8 @@ void main() { '\$createdAt': '2020-10-15T06:38:00.000+00:00', 'userId': '5e5ea5c168bb8', 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00',}; + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; when(client.call( diff --git a/test/services/health_test.dart b/test/services/health_test.dart index f73e5363..f6503a1b 100644 --- a/test/services/health_test.dart +++ b/test/services/health_test.dart @@ -107,6 +107,27 @@ void main() { }); + test('test method getCertificate()', () async { + final Map data = { + 'name': '/CN=www.google.com', + 'subjectSN': '', + 'issuerOrganisation': '', + 'validFrom': '1704200998', + 'validTo': '1711458597', + 'signatureTypeSN': 'RSA-SHA256',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getCertificate( + ); + expect(response, isA()); + + }); + test('test method getDB()', () async { final Map data = { 'name': 'database', @@ -225,6 +246,23 @@ void main() { }); + test('test method getFailedJobs()', () async { + final Map data = { + 'size': 8,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getFailedJobs( + name: 'v1-database', + ); + expect(response, isA()); + + }); + test('test method getQueueFunctions()', () async { final Map data = { 'size': 8,}; diff --git a/test/services/messaging_test.dart b/test/services/messaging_test.dart new file mode 100644 index 00000000..0062c2ad --- /dev/null +++ b/test/services/messaging_test.dart @@ -0,0 +1,1098 @@ +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('Messaging test', () { + late MockClient client; + late Messaging messaging; + + setUp(() { + client = MockClient(); + messaging = Messaging(client); + }); + + test('test method listMessages()', () async { + final Map data = { + 'total': 5, + 'messages': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.listMessages( + ); + expect(response, isA()); + + }); + + test('test method createEmail()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'Message status can be one of the following: processing, sent, cancelled, failed.',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createEmail( + messageId: '[MESSAGE_ID]', + subject: '[SUBJECT]', + content: '[CONTENT]', + ); + expect(response, isA()); + + }); + + test('test method updateEmail()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'Message status can be one of the following: processing, sent, cancelled, failed.',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateEmail( + messageId: '[MESSAGE_ID]', + ); + expect(response, isA()); + + }); + + test('test method createPush()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'Message status can be one of the following: processing, sent, cancelled, failed.',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createPush( + messageId: '[MESSAGE_ID]', + title: '[TITLE]', + body: '[BODY]', + ); + expect(response, isA()); + + }); + + test('test method updatePush()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'Message status can be one of the following: processing, sent, cancelled, failed.',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updatePush( + messageId: '[MESSAGE_ID]', + ); + expect(response, isA()); + + }); + + test('test method createSMS()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'Message status can be one of the following: processing, sent, cancelled, failed.',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createSMS( + messageId: '[MESSAGE_ID]', + content: '[CONTENT]', + ); + expect(response, isA()); + + }); + + test('test method updateSMS()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'Message status can be one of the following: processing, sent, cancelled, failed.',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateSMS( + messageId: '[MESSAGE_ID]', + ); + expect(response, isA()); + + }); + + test('test method getMessage()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'Message status can be one of the following: processing, sent, cancelled, failed.',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.getMessage( + messageId: '[MESSAGE_ID]', + ); + expect(response, isA()); + + }); + + test('test method delete()', () async { + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.delete( + messageId: '[MESSAGE_ID]', + ); + }); + + test('test method listMessageLogs()', () async { + final Map data = { + 'total': 5, + 'logs': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.listMessageLogs( + messageId: '[MESSAGE_ID]', + ); + expect(response, isA()); + + }); + + test('test method listTargets()', () async { + final Map data = { + 'total': 5, + 'targets': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.listTargets( + messageId: '[MESSAGE_ID]', + ); + expect(response, isA()); + + }); + + test('test method listProviders()', () async { + final Map data = { + 'total': 5, + 'providers': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.listProviders( + ); + expect(response, isA()); + + }); + + test('test method createAPNSProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createAPNSProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + ); + expect(response, isA()); + + }); + + test('test method updateAPNSProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateAPNSProvider( + providerId: '[PROVIDER_ID]', + ); + expect(response, isA()); + + }); + + test('test method createFCMProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createFCMProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + ); + expect(response, isA()); + + }); + + test('test method updateFCMProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateFCMProvider( + providerId: '[PROVIDER_ID]', + ); + expect(response, isA()); + + }); + + test('test method createMailgunProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createMailgunProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + ); + expect(response, isA()); + + }); + + test('test method updateMailgunProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateMailgunProvider( + providerId: '[PROVIDER_ID]', + ); + expect(response, isA()); + + }); + + test('test method createMsg91Provider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createMsg91Provider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + ); + expect(response, isA()); + + }); + + test('test method updateMsg91Provider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateMsg91Provider( + providerId: '[PROVIDER_ID]', + ); + expect(response, isA()); + + }); + + test('test method createSendgridProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createSendgridProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + ); + expect(response, isA()); + + }); + + test('test method updateSendgridProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateSendgridProvider( + providerId: '[PROVIDER_ID]', + ); + expect(response, isA()); + + }); + + test('test method createSMTPProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createSMTPProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + host: '[HOST]', + ); + expect(response, isA()); + + }); + + test('test method updateSMTPProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateSMTPProvider( + providerId: '[PROVIDER_ID]', + ); + expect(response, isA()); + + }); + + test('test method createTelesignProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createTelesignProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + ); + expect(response, isA()); + + }); + + test('test method updateTelesignProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateTelesignProvider( + providerId: '[PROVIDER_ID]', + ); + expect(response, isA()); + + }); + + test('test method createTextmagicProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createTextmagicProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + ); + expect(response, isA()); + + }); + + test('test method updateTextmagicProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateTextmagicProvider( + providerId: '[PROVIDER_ID]', + ); + expect(response, isA()); + + }); + + test('test method createTwilioProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createTwilioProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + ); + expect(response, isA()); + + }); + + test('test method updateTwilioProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateTwilioProvider( + providerId: '[PROVIDER_ID]', + ); + expect(response, isA()); + + }); + + test('test method createVonageProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createVonageProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + ); + expect(response, isA()); + + }); + + test('test method updateVonageProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateVonageProvider( + providerId: '[PROVIDER_ID]', + ); + expect(response, isA()); + + }); + + test('test method getProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.getProvider( + providerId: '[PROVIDER_ID]', + ); + expect(response, isA()); + + }); + + test('test method deleteProvider()', () async { + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.deleteProvider( + providerId: '[PROVIDER_ID]', + ); + }); + + test('test method listProviderLogs()', () async { + final Map data = { + 'total': 5, + 'logs': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.listProviderLogs( + providerId: '[PROVIDER_ID]', + ); + expect(response, isA()); + + }); + + test('test method listSubscriberLogs()', () async { + final Map data = { + 'total': 5, + 'logs': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.listSubscriberLogs( + subscriberId: '[SUBSCRIBER_ID]', + ); + expect(response, isA()); + + }); + + test('test method listTopics()', () async { + final Map data = { + 'total': 5, + 'topics': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.listTopics( + ); + expect(response, isA()); + + }); + + test('test method createTopic()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'events', + 'emailTotal': 100, + 'smsTotal': 100, + 'pushTotal': 100, + 'subscribe': [],}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createTopic( + topicId: '[TOPIC_ID]', + name: '[NAME]', + ); + expect(response, isA()); + + }); + + test('test method getTopic()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'events', + 'emailTotal': 100, + 'smsTotal': 100, + 'pushTotal': 100, + 'subscribe': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.getTopic( + topicId: '[TOPIC_ID]', + ); + expect(response, isA()); + + }); + + test('test method updateTopic()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'events', + 'emailTotal': 100, + 'smsTotal': 100, + 'pushTotal': 100, + 'subscribe': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateTopic( + topicId: '[TOPIC_ID]', + ); + expect(response, isA()); + + }); + + test('test method deleteTopic()', () async { + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.deleteTopic( + topicId: '[TOPIC_ID]', + ); + }); + + test('test method listTopicLogs()', () async { + final Map data = { + 'total': 5, + 'logs': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.listTopicLogs( + topicId: '[TOPIC_ID]', + ); + expect(response, isA()); + + }); + + test('test method listSubscribers()', () async { + final Map data = { + 'total': 5, + 'subscribers': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.listSubscribers( + topicId: '[TOPIC_ID]', + ); + expect(response, isA()); + + }); + + test('test method createSubscriber()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'targetId': '259125845563242502', + 'target': {}, + 'userId': '5e5ea5c16897e', + 'userName': 'Aegon Targaryen', + 'topicId': '259125845563242502', + 'providerType': 'email',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createSubscriber( + topicId: '[TOPIC_ID]', + subscriberId: '[SUBSCRIBER_ID]', + targetId: '[TARGET_ID]', + ); + expect(response, isA()); + + }); + + test('test method getSubscriber()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'targetId': '259125845563242502', + 'target': {}, + 'userId': '5e5ea5c16897e', + 'userName': 'Aegon Targaryen', + 'topicId': '259125845563242502', + 'providerType': 'email',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.getSubscriber( + topicId: '[TOPIC_ID]', + subscriberId: '[SUBSCRIBER_ID]', + ); + expect(response, isA()); + + }); + + test('test method deleteSubscriber()', () async { + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.deleteSubscriber( + topicId: '[TOPIC_ID]', + subscriberId: '[SUBSCRIBER_ID]', + ); + }); + + }); +} \ No newline at end of file diff --git a/test/services/teams_test.dart b/test/services/teams_test.dart index 2ffec715..b84981f5 100644 --- a/test/services/teams_test.dart +++ b/test/services/teams_test.dart @@ -183,6 +183,7 @@ void main() { 'invited': '2020-10-15T06:38:00.000+00:00', 'joined': '2020-10-15T06:38:00.000+00:00', 'confirm': true, + 'mfa': true, 'roles': [],}; @@ -212,6 +213,7 @@ void main() { 'invited': '2020-10-15T06:38:00.000+00:00', 'joined': '2020-10-15T06:38:00.000+00:00', 'confirm': true, + 'mfa': true, 'roles': [],}; @@ -241,6 +243,7 @@ void main() { 'invited': '2020-10-15T06:38:00.000+00:00', 'joined': '2020-10-15T06:38:00.000+00:00', 'confirm': true, + 'mfa': true, 'roles': [],}; @@ -285,6 +288,7 @@ void main() { 'invited': '2020-10-15T06:38:00.000+00:00', 'joined': '2020-10-15T06:38:00.000+00:00', 'confirm': true, + 'mfa': true, 'roles': [],}; diff --git a/test/services/users_test.dart b/test/services/users_test.dart index bb923ab0..99d2f50f 100644 --- a/test/services/users_test.dart +++ b/test/services/users_test.dart @@ -85,7 +85,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -115,7 +118,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -147,7 +153,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -209,7 +218,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -241,7 +253,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -273,7 +288,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -310,7 +328,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -345,7 +366,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -377,7 +401,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -420,7 +447,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -451,7 +481,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -504,6 +537,94 @@ 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, + 'totp': 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: '[USER_ID]', + mfa: true, + ); + expect(response, isA()); + + }); + + test('test method listFactors()', () async { + final Map data = { + 'totp': true, + 'phone': true, + 'email': true,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.listFactors( + userId: '[USER_ID]', + ); + expect(response, isA()); + + }); + + test('test method deleteAuthenticator()', () async { + 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, + 'totp': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.deleteAuthenticator( + userId: '[USER_ID]', + type: 'totp', + otp: '[OTP]', + ); + expect(response, isA()); + + }); + test('test method updateName()', () async { final Map data = { '\$id': '5e5ea5c16897e', @@ -518,7 +639,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -549,7 +673,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -580,7 +707,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -648,6 +778,49 @@ void main() { }); + test('test method createSession()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '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',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.createSession( + userId: '[USER_ID]', + ); + expect(response, isA()); + + }); + test('test method deleteSessions()', () async { final data = ''; @@ -689,7 +862,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -706,6 +882,134 @@ void main() { }); + test('test method listTargets()', () async { + final Map data = { + 'total': 5, + 'targets': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.listTargets( + userId: '[USER_ID]', + ); + expect(response, isA()); + + }); + + test('test method createTarget()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Aegon apple token', + 'userId': '259125845563242502', + 'providerType': 'email', + 'identifier': 'token',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.createTarget( + userId: '[USER_ID]', + targetId: '[TARGET_ID]', + providerType: 'email', + identifier: '[IDENTIFIER]', + ); + expect(response, isA()); + + }); + + test('test method getTarget()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Aegon apple token', + 'userId': '259125845563242502', + 'providerType': 'email', + 'identifier': 'token',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.getTarget( + userId: '[USER_ID]', + targetId: '[TARGET_ID]', + ); + expect(response, isA()); + + }); + + test('test method updateTarget()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Aegon apple token', + 'userId': '259125845563242502', + 'providerType': 'email', + 'identifier': 'token',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.updateTarget( + userId: '[USER_ID]', + targetId: '[TARGET_ID]', + ); + expect(response, isA()); + + }); + + test('test method deleteTarget()', () async { + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.deleteTarget( + userId: '[USER_ID]', + targetId: '[TARGET_ID]', + ); + }); + + test('test method createToken()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.createToken( + userId: '[USER_ID]', + ); + expect(response, isA()); + + }); + test('test method updateEmailVerification()', () async { final Map data = { '\$id': '5e5ea5c16897e', @@ -720,7 +1024,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -751,7 +1058,10 @@ void main() { 'phone': '+4930901820', 'emailVerification': true, 'phoneVerification': true, + 'mfa': true, + 'totp': true, 'prefs': {}, + 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; diff --git a/test/src/models/health_certificate_test.dart b/test/src/models/health_certificate_test.dart new file mode 100644 index 00000000..2277d92f --- /dev/null +++ b/test/src/models/health_certificate_test.dart @@ -0,0 +1,28 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('HealthCertificate', () { + + test('model', () { + final model = HealthCertificate( + name: '/CN=www.google.com', + subjectSN: '', + issuerOrganisation: '', + validFrom: '1704200998', + validTo: '1711458597', + signatureTypeSN: 'RSA-SHA256', + ); + + 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'); + }); + }); +} diff --git a/test/src/models/jwt_test.dart b/test/src/models/jwt_test.dart new file mode 100644 index 00000000..db56a032 --- /dev/null +++ b/test/src/models/jwt_test.dart @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('Jwt', () { + + test('model', () { + final model = Jwt( + jwt: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + ); + + final map = model.toMap(); + final result = Jwt.fromMap(map); + + expect(result.jwt, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'); + }); + }); +} diff --git a/test/src/models/membership_test.dart b/test/src/models/membership_test.dart index 6a6f8201..23cfbd6c 100644 --- a/test/src/models/membership_test.dart +++ b/test/src/models/membership_test.dart @@ -17,6 +17,7 @@ void main() { invited: '2020-10-15T06:38:00.000+00:00', joined: '2020-10-15T06:38:00.000+00:00', confirm: true, + mfa: true, roles: [], ); @@ -34,6 +35,7 @@ void main() { 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 new file mode 100644 index 00000000..73cbf14f --- /dev/null +++ b/test/src/models/message_list_test.dart @@ -0,0 +1,20 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('MessageList', () { + + test('model', () { + final model = MessageList( + total: 5, + messages: [], + ); + + final map = model.toMap(); + final result = MessageList.fromMap(map); + + expect(result.total, 5); + expect(result.messages, []); + }); + }); +} diff --git a/test/src/models/message_test.dart b/test/src/models/message_test.dart new file mode 100644 index 00000000..1658f8d3 --- /dev/null +++ b/test/src/models/message_test.dart @@ -0,0 +1,36 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('Message', () { + + test('model', () { + final model = Message( + $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: processing, sent, cancelled, failed.', + ); + + 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: processing, sent, cancelled, failed.'); + }); + }); +} diff --git a/test/src/models/mfa_challenge_test.dart b/test/src/models/mfa_challenge_test.dart new file mode 100644 index 00000000..fff934ef --- /dev/null +++ b/test/src/models/mfa_challenge_test.dart @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('MfaChallenge', () { + + test('model', () { + final model = MfaChallenge( + $id: 'bb8ea5c16897e', + $createdAt: '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c168bb8', + expire: '2020-10-15T06:38:00.000+00:00', + ); + + 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'); + }); + }); +} diff --git a/test/src/models/mfa_factors_test.dart b/test/src/models/mfa_factors_test.dart new file mode 100644 index 00000000..e27138e1 --- /dev/null +++ b/test/src/models/mfa_factors_test.dart @@ -0,0 +1,22 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('MfaFactors', () { + + test('model', () { + final model = MfaFactors( + totp: true, + phone: true, + email: true, + ); + + final map = model.toMap(); + final result = MfaFactors.fromMap(map); + + expect(result.totp, true); + expect(result.phone, true); + expect(result.email, true); + }); + }); +} diff --git a/test/src/models/mfa_type_test.dart b/test/src/models/mfa_type_test.dart new file mode 100644 index 00000000..1e3e7488 --- /dev/null +++ b/test/src/models/mfa_type_test.dart @@ -0,0 +1,22 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('MfaType', () { + + test('model', () { + final model = MfaType( + backups: [], + secret: '1', + uri: '1', + ); + + final map = model.toMap(); + final result = MfaType.fromMap(map); + + expect(result.backups, []); + expect(result.secret, '1'); + expect(result.uri, '1'); + }); + }); +} diff --git a/test/src/models/provider_list_test.dart b/test/src/models/provider_list_test.dart new file mode 100644 index 00000000..954c442d --- /dev/null +++ b/test/src/models/provider_list_test.dart @@ -0,0 +1,20 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('ProviderList', () { + + test('model', () { + final model = ProviderList( + total: 5, + providers: [], + ); + + final map = model.toMap(); + final result = ProviderList.fromMap(map); + + expect(result.total, 5); + expect(result.providers, []); + }); + }); +} diff --git a/test/src/models/provider_test.dart b/test/src/models/provider_test.dart new file mode 100644 index 00000000..a1ecd414 --- /dev/null +++ b/test/src/models/provider_test.dart @@ -0,0 +1,32 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('Provider', () { + + test('model', () { + final model = Provider( + $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: {}, + ); + + 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, {}); + }); + }); +} diff --git a/test/src/models/session_test.dart b/test/src/models/session_test.dart index 991fa90f..7f5126bf 100644 --- a/test/src/models/session_test.dart +++ b/test/src/models/session_test.dart @@ -31,6 +31,8 @@ void main() { countryCode: 'US', countryName: 'United States', current: true, + factors: [], + secret: '5e5bb8c16897e', ); final map = model.toMap(); @@ -61,6 +63,8 @@ void main() { expect(result.countryCode, 'US'); expect(result.countryName, 'United States'); expect(result.current, true); + expect(result.factors, []); + expect(result.secret, '5e5bb8c16897e'); }); }); } diff --git a/test/src/models/subscriber_list_test.dart b/test/src/models/subscriber_list_test.dart new file mode 100644 index 00000000..d46f0559 --- /dev/null +++ b/test/src/models/subscriber_list_test.dart @@ -0,0 +1,20 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('SubscriberList', () { + + test('model', () { + final model = SubscriberList( + total: 5, + subscribers: [], + ); + + final map = model.toMap(); + final result = SubscriberList.fromMap(map); + + expect(result.total, 5); + expect(result.subscribers, []); + }); + }); +} diff --git a/test/src/models/subscriber_test.dart b/test/src/models/subscriber_test.dart new file mode 100644 index 00000000..ed906512 --- /dev/null +++ b/test/src/models/subscriber_test.dart @@ -0,0 +1,34 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('Subscriber', () { + + test('model', () { + final model = Subscriber( + $id: '259125845563242502', + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + targetId: '259125845563242502', + target: {}, + userId: '5e5ea5c16897e', + userName: 'Aegon Targaryen', + topicId: '259125845563242502', + providerType: 'email', + ); + + 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'); + }); + }); +} diff --git a/test/src/models/target_list_test.dart b/test/src/models/target_list_test.dart new file mode 100644 index 00000000..5f96366d --- /dev/null +++ b/test/src/models/target_list_test.dart @@ -0,0 +1,20 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('TargetList', () { + + test('model', () { + final model = TargetList( + total: 5, + targets: [], + ); + + final map = model.toMap(); + final result = TargetList.fromMap(map); + + expect(result.total, 5); + expect(result.targets, []); + }); + }); +} diff --git a/test/src/models/target_test.dart b/test/src/models/target_test.dart new file mode 100644 index 00000000..2d664691 --- /dev/null +++ b/test/src/models/target_test.dart @@ -0,0 +1,30 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('Target', () { + + test('model', () { + final model = Target( + $id: '259125845563242502', + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + name: 'Aegon apple token', + userId: '259125845563242502', + providerType: 'email', + identifier: 'token', + ); + + 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, 'Aegon apple token'); + expect(result.userId, '259125845563242502'); + expect(result.providerType, 'email'); + expect(result.identifier, 'token'); + }); + }); +} diff --git a/test/src/models/token_test.dart b/test/src/models/token_test.dart index 1668da70..9e6cdb54 100644 --- a/test/src/models/token_test.dart +++ b/test/src/models/token_test.dart @@ -11,6 +11,7 @@ void main() { userId: '5e5ea5c168bb8', secret: '', expire: '2020-10-15T06:38:00.000+00:00', + phrase: 'Golden Fox', ); final map = model.toMap(); @@ -21,6 +22,7 @@ void main() { 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 new file mode 100644 index 00000000..4d4fc12d --- /dev/null +++ b/test/src/models/topic_list_test.dart @@ -0,0 +1,20 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('TopicList', () { + + test('model', () { + final model = TopicList( + total: 5, + topics: [], + ); + + final map = model.toMap(); + final result = TopicList.fromMap(map); + + expect(result.total, 5); + expect(result.topics, []); + }); + }); +} diff --git a/test/src/models/topic_test.dart b/test/src/models/topic_test.dart new file mode 100644 index 00000000..666097f3 --- /dev/null +++ b/test/src/models/topic_test.dart @@ -0,0 +1,32 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('Topic', () { + + test('model', () { + final model = Topic( + $id: '259125845563242502', + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + name: 'events', + emailTotal: 100, + smsTotal: 100, + pushTotal: 100, + subscribe: [], + ); + + final 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, []); + }); + }); +} diff --git a/test/src/models/user_test.dart b/test/src/models/user_test.dart index 9cd8adfe..f2a68f40 100644 --- a/test/src/models/user_test.dart +++ b/test/src/models/user_test.dart @@ -18,7 +18,10 @@ void main() { phone: '+4930901820', emailVerification: true, phoneVerification: true, + mfa: true, + totp: true, prefs: Preferences(data: {}), + targets: [], accessedAt: '2020-10-15T06:38:00.000+00:00', ); @@ -37,7 +40,10 @@ void main() { expect(result.phone, '+4930901820'); expect(result.emailVerification, true); expect(result.phoneVerification, true); + expect(result.mfa, true); + expect(result.totp, true); expect(result.prefs.data, {"data": {}}); + expect(result.targets, []); expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); }); }); From 43a77624afdf3e3a16a3b4070900f23a43795baa Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 19 Feb 2024 17:05:16 +1300 Subject: [PATCH 2/7] Release candidate for 1.5.x --- README.md | 2 +- docs/examples/account/add-authenticator.md | 2 +- docs/examples/account/create2f-a-challenge.md | 2 +- docs/examples/account/delete-authenticator.md | 2 +- docs/examples/account/verify-authenticator.md | 2 +- docs/examples/users/delete-authenticator.md | 2 +- lib/enums.dart | 4 ++-- lib/services/account.dart | 8 ++++---- lib/services/users.dart | 2 +- lib/src/client_browser.dart | 4 ++-- lib/src/client_io.dart | 6 +++--- lib/src/enums/{factor.dart => authentication_factor.dart} | 4 ++-- lib/src/enums/{type.dart => authenticator_type.dart} | 4 ++-- pubspec.yaml | 2 +- 14 files changed, 23 insertions(+), 23 deletions(-) rename lib/src/enums/{factor.dart => authentication_factor.dart} (76%) rename lib/src/enums/{type.dart => authenticator_type.dart} (73%) diff --git a/README.md b/README.md index 3bf03f5d..237df9e2 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - dart_appwrite: ^11.0.0-rc.2 + dart_appwrite: ^11.0.0-rc.3 ``` You can install packages from the command line: diff --git a/docs/examples/account/add-authenticator.md b/docs/examples/account/add-authenticator.md index a410f093..22071146 100644 --- a/docs/examples/account/add-authenticator.md +++ b/docs/examples/account/add-authenticator.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = account.addAuthenticator( - type: .totp, + type: AuthenticatorType.totp, ); result diff --git a/docs/examples/account/create2f-a-challenge.md b/docs/examples/account/create2f-a-challenge.md index 98cdaef1..1f4fd217 100644 --- a/docs/examples/account/create2f-a-challenge.md +++ b/docs/examples/account/create2f-a-challenge.md @@ -10,7 +10,7 @@ void main() { // Init SDK ; Future result = account.create2FAChallenge( - factor: .totp, + factor: AuthenticationFactor.totp, ); result diff --git a/docs/examples/account/delete-authenticator.md b/docs/examples/account/delete-authenticator.md index 9b7a4c03..9edee3f6 100644 --- a/docs/examples/account/delete-authenticator.md +++ b/docs/examples/account/delete-authenticator.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = account.deleteAuthenticator( - type: .totp, + type: AuthenticatorType.totp, otp:'[OTP]' , ); diff --git a/docs/examples/account/verify-authenticator.md b/docs/examples/account/verify-authenticator.md index b6744cd8..f2c904c0 100644 --- a/docs/examples/account/verify-authenticator.md +++ b/docs/examples/account/verify-authenticator.md @@ -11,7 +11,7 @@ void main() { // Init SDK ; Future result = account.verifyAuthenticator( - type: .totp, + type: AuthenticatorType.totp, otp:'[OTP]' , ); diff --git a/docs/examples/users/delete-authenticator.md b/docs/examples/users/delete-authenticator.md index 5689790e..04b18e99 100644 --- a/docs/examples/users/delete-authenticator.md +++ b/docs/examples/users/delete-authenticator.md @@ -12,7 +12,7 @@ void main() { // Init SDK Future result = users.deleteAuthenticator( userId:'[USER_ID]' , - type: .totp, + type: AuthenticatorType.totp, otp:'[OTP]' , ); diff --git a/lib/enums.dart b/lib/enums.dart index c5c04330..5c06f8a5 100644 --- a/lib/enums.dart +++ b/lib/enums.dart @@ -1,8 +1,8 @@ /// Appwrite Enums library dart_appwrite.enums; -part 'src/enums/factor.dart'; -part 'src/enums/type.dart'; +part 'src/enums/authentication_factor.dart'; +part 'src/enums/authenticator_type.dart'; part 'src/enums/o_auth_provider.dart'; part 'src/enums/browser.dart'; part 'src/enums/credit_card.dart'; diff --git a/lib/services/account.dart b/lib/services/account.dart index ed6a0802..8ce052c7 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -208,7 +208,7 @@ class Account extends Service { /// Create 2FA Challenge /// - Future create2FAChallenge({required enums.Factor factor}) async { + Future create2FAChallenge({required enums.AuthenticationFactor factor}) async { final String apiPath = '/account/mfa/challenge'; final Map apiParams = { @@ -274,7 +274,7 @@ class Account extends Service { /// Add Authenticator /// - Future addAuthenticator({required enums.Type type}) async { + Future addAuthenticator({required enums.AuthenticatorType type}) async { final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type); final Map apiParams = { @@ -295,7 +295,7 @@ class Account extends Service { /// Verify Authenticator /// - Future verifyAuthenticator({required enums.Type type, required String otp}) async { + Future verifyAuthenticator({required enums.AuthenticatorType type, required String otp}) async { final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type); final Map apiParams = { @@ -317,7 +317,7 @@ class Account extends Service { /// Delete Authenticator /// - Future deleteAuthenticator({required enums.Type type, required String otp}) async { + Future deleteAuthenticator({required enums.AuthenticatorType type, required String otp}) async { final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type); final Map apiParams = { diff --git a/lib/services/users.dart b/lib/services/users.dart index 9f47e763..e2e00a22 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -505,7 +505,7 @@ class Users extends Service { /// Delete Authenticator /// - Future deleteAuthenticator({required String userId, required enums.Type type, required String otp}) async { + Future deleteAuthenticator({required String userId, required enums.AuthenticatorType type, required String otp}) async { final String apiPath = '/users/{userId}/mfa/{type}'.replaceAll('{userId}', userId).replaceAll('{type}', type); final Map apiParams = { diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index 59a629b0..1de049cd 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -33,8 +33,8 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '11.0.0-rc.2', - 'X-Appwrite-Response-Format' : '1.4.0', + 'x-sdk-version': '11.0.0-rc.3', + 'X-Appwrite-Response-Format' : '1.5.0', }; config = {}; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 817be27d..3e5eea31 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -42,9 +42,9 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '11.0.0-rc.2', - 'user-agent' : 'AppwriteDartSDK/11.0.0-rc.2 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format' : '1.4.0', + 'x-sdk-version': '11.0.0-rc.3', + 'user-agent' : 'AppwriteDartSDK/11.0.0-rc.3 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format' : '1.5.0', }; config = {}; diff --git a/lib/src/enums/factor.dart b/lib/src/enums/authentication_factor.dart similarity index 76% rename from lib/src/enums/factor.dart rename to lib/src/enums/authentication_factor.dart index 774d549b..efc9b7af 100644 --- a/lib/src/enums/factor.dart +++ b/lib/src/enums/authentication_factor.dart @@ -1,11 +1,11 @@ part of dart_appwrite.enums; -enum Factor { +enum AuthenticationFactor { totp(value: 'totp'), phone(value: 'phone'), email(value: 'email'); - const Factor({ + const AuthenticationFactor({ required this.value }); diff --git a/lib/src/enums/type.dart b/lib/src/enums/authenticator_type.dart similarity index 73% rename from lib/src/enums/type.dart rename to lib/src/enums/authenticator_type.dart index 2811888e..034ee05d 100644 --- a/lib/src/enums/type.dart +++ b/lib/src/enums/authenticator_type.dart @@ -1,9 +1,9 @@ part of dart_appwrite.enums; -enum Type { +enum AuthenticatorType { totp(value: 'totp'); - const Type({ + const AuthenticatorType({ required this.value }); diff --git a/pubspec.yaml b/pubspec.yaml index c5770739..7134e5b7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: dart_appwrite -version: 11.0.0-rc.2 +version: 11.0.0-rc.3 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 From 729f4ab4748cdaa983dada93e5d6c3fa99077fcc Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 21 Feb 2024 23:37:58 +1300 Subject: [PATCH 3/7] Release candidate 4 for 1.5.x --- README.md | 4 +- docs/examples/account/add-authenticator.md | 31 +++--- .../account/create-anonymous-session.md | 25 ++--- .../account/create-email-password-session.md | 31 +++--- docs/examples/account/create-email-token.md | 32 +++--- docs/examples/account/create-j-w-t.md | 25 ++--- .../account/create-magic-u-r-l-token.md | 33 +++--- .../examples/account/create-o-auth2session.md | 33 +++--- docs/examples/account/create-phone-token.md | 31 +++--- .../account/create-phone-verification.md | 27 ++--- docs/examples/account/create-recovery.md | 33 +++--- docs/examples/account/create-session.md | 31 +++--- docs/examples/account/create-verification.md | 31 +++--- docs/examples/account/create.md | 34 +++--- docs/examples/account/create2f-a-challenge.md | 29 ++--- docs/examples/account/delete-authenticator.md | 33 +++--- docs/examples/account/delete-identity.md | 31 +++--- docs/examples/account/delete-session.md | 31 +++--- docs/examples/account/delete-sessions.md | 27 ++--- docs/examples/account/get-prefs.md | 27 ++--- docs/examples/account/get-session.md | 31 +++--- docs/examples/account/get.md | 27 ++--- docs/examples/account/list-factors.md | 27 ++--- docs/examples/account/list-identities.md | 30 +++-- docs/examples/account/list-logs.md | 30 +++-- docs/examples/account/list-sessions.md | 27 ++--- docs/examples/account/update-challenge.md | 33 +++--- docs/examples/account/update-email.md | 33 +++--- docs/examples/account/update-m-f-a.md | 31 +++--- .../account/update-magic-u-r-l-session.md | 31 +++--- docs/examples/account/update-name.md | 31 +++--- docs/examples/account/update-password.md | 32 +++--- .../account/update-phone-verification.md | 33 +++--- docs/examples/account/update-phone.md | 33 +++--- docs/examples/account/update-prefs.md | 31 +++--- docs/examples/account/update-recovery.md | 35 +++--- docs/examples/account/update-session.md | 31 +++--- docs/examples/account/update-status.md | 27 ++--- docs/examples/account/update-verification.md | 33 +++--- docs/examples/account/verify-authenticator.md | 33 +++--- docs/examples/avatars/get-browser.md | 34 +++--- docs/examples/avatars/get-credit-card.md | 34 +++--- docs/examples/avatars/get-favicon.md | 31 +++--- docs/examples/avatars/get-flag.md | 34 +++--- docs/examples/avatars/get-image.md | 33 +++--- docs/examples/avatars/get-initials.md | 33 +++--- docs/examples/avatars/get-q-r.md | 34 +++--- .../databases/create-boolean-attribute.md | 39 +++---- docs/examples/databases/create-collection.md | 38 +++---- .../databases/create-datetime-attribute.md | 39 +++---- docs/examples/databases/create-document.md | 38 +++---- .../databases/create-email-attribute.md | 39 +++---- .../databases/create-enum-attribute.md | 41 ++++--- .../databases/create-float-attribute.md | 41 ++++--- docs/examples/databases/create-index.md | 40 +++---- .../databases/create-integer-attribute.md | 41 ++++--- .../examples/databases/create-ip-attribute.md | 39 +++---- .../create-relationship-attribute.md | 41 ++++--- .../databases/create-string-attribute.md | 42 ++++--- .../databases/create-url-attribute.md | 39 +++---- docs/examples/databases/create.md | 34 +++--- docs/examples/databases/delete-attribute.md | 35 +++--- docs/examples/databases/delete-collection.md | 33 +++--- docs/examples/databases/delete-document.md | 35 +++--- docs/examples/databases/delete-index.md | 35 +++--- docs/examples/databases/delete.md | 31 +++--- docs/examples/databases/get-attribute.md | 35 +++--- docs/examples/databases/get-collection.md | 33 +++--- docs/examples/databases/get-document.md | 36 +++--- docs/examples/databases/get-index.md | 35 +++--- docs/examples/databases/get.md | 31 +++--- docs/examples/databases/list-attributes.md | 34 +++--- docs/examples/databases/list-collections.md | 33 +++--- docs/examples/databases/list-documents.md | 34 +++--- docs/examples/databases/list-indexes.md | 34 +++--- docs/examples/databases/list.md | 31 +++--- .../databases/update-boolean-attribute.md | 39 +++---- docs/examples/databases/update-collection.md | 38 +++---- .../databases/update-datetime-attribute.md | 39 +++---- docs/examples/databases/update-document.md | 37 +++--- .../databases/update-email-attribute.md | 39 +++---- .../databases/update-enum-attribute.md | 41 +++---- .../databases/update-float-attribute.md | 43 ++++--- .../databases/update-integer-attribute.md | 43 ++++--- .../examples/databases/update-ip-attribute.md | 39 +++---- .../update-relationship-attribute.md | 36 +++--- .../databases/update-string-attribute.md | 39 +++---- .../databases/update-url-attribute.md | 39 +++---- docs/examples/databases/update.md | 34 +++--- docs/examples/functions/create-build.md | 35 +++--- docs/examples/functions/create-deployment.md | 37 +++--- docs/examples/functions/create-execution.md | 36 +++--- docs/examples/functions/create-variable.md | 35 +++--- docs/examples/functions/create.md | 52 +++++---- docs/examples/functions/delete-deployment.md | 33 +++--- docs/examples/functions/delete-variable.md | 33 +++--- docs/examples/functions/delete.md | 31 +++--- .../examples/functions/download-deployment.md | 33 +++--- docs/examples/functions/get-deployment.md | 33 +++--- docs/examples/functions/get-execution.md | 33 +++--- docs/examples/functions/get-variable.md | 33 +++--- docs/examples/functions/get.md | 31 +++--- docs/examples/functions/list-deployments.md | 33 +++--- docs/examples/functions/list-executions.md | 33 +++--- docs/examples/functions/list-runtimes.md | 27 ++--- docs/examples/functions/list-variables.md | 31 +++--- docs/examples/functions/list.md | 31 +++--- docs/examples/functions/update-deployment.md | 33 +++--- docs/examples/functions/update-variable.md | 36 +++--- docs/examples/functions/update.md | 47 ++++---- docs/examples/graphql/mutation.md | 31 +++--- docs/examples/graphql/query.md | 31 +++--- docs/examples/health/get-antivirus.md | 27 ++--- docs/examples/health/get-cache.md | 27 ++--- docs/examples/health/get-certificate.md | 30 +++-- docs/examples/health/get-d-b.md | 27 ++--- docs/examples/health/get-failed-jobs.md | 32 +++--- docs/examples/health/get-pub-sub.md | 27 ++--- docs/examples/health/get-queue-builds.md | 30 +++-- .../examples/health/get-queue-certificates.md | 30 +++-- docs/examples/health/get-queue-databases.md | 31 +++--- docs/examples/health/get-queue-deletes.md | 30 +++-- docs/examples/health/get-queue-functions.md | 30 +++-- docs/examples/health/get-queue-logs.md | 30 +++-- docs/examples/health/get-queue-mails.md | 30 +++-- docs/examples/health/get-queue-messaging.md | 30 +++-- docs/examples/health/get-queue-migrations.md | 30 +++-- docs/examples/health/get-queue-webhooks.md | 30 +++-- docs/examples/health/get-queue.md | 27 ++--- docs/examples/health/get-storage-local.md | 27 ++--- docs/examples/health/get-time.md | 27 ++--- docs/examples/health/get.md | 27 ++--- docs/examples/locale/get.md | 27 ++--- docs/examples/locale/list-codes.md | 27 ++--- docs/examples/locale/list-continents.md | 27 ++--- docs/examples/locale/list-countries-e-u.md | 27 ++--- docs/examples/locale/list-countries-phones.md | 27 ++--- docs/examples/locale/list-countries.md | 27 ++--- docs/examples/locale/list-currencies.md | 27 ++--- docs/examples/locale/list-languages.md | 27 ++--- .../messaging/create-a-p-n-s-provider.md | 24 ---- .../messaging/create-apns-provider.md | 24 ++++ docs/examples/messaging/create-email.md | 44 ++++---- .../messaging/create-f-c-m-provider.md | 24 ---- .../examples/messaging/create-fcm-provider.md | 21 ++++ .../messaging/create-mailgun-provider.md | 41 +++---- .../messaging/create-msg91provider.md | 37 +++--- docs/examples/messaging/create-push.md | 48 ++++---- docs/examples/messaging/create-s-m-s.md | 24 ---- .../messaging/create-s-m-t-p-provider.md | 25 ----- .../messaging/create-sendgrid-provider.md | 39 +++---- docs/examples/messaging/create-sms.md | 24 ++++ .../messaging/create-smtp-provider.md | 31 ++++++ docs/examples/messaging/create-subscriber.md | 35 +++--- .../messaging/create-telesign-provider.md | 37 +++--- .../messaging/create-textmagic-provider.md | 37 +++--- docs/examples/messaging/create-topic.md | 34 +++--- .../messaging/create-twilio-provider.md | 37 +++--- .../messaging/create-vonage-provider.md | 37 +++--- docs/examples/messaging/delete-provider.md | 31 +++--- docs/examples/messaging/delete-subscriber.md | 33 +++--- docs/examples/messaging/delete-topic.md | 31 +++--- docs/examples/messaging/delete.md | 31 +++--- docs/examples/messaging/get-message.md | 31 +++--- docs/examples/messaging/get-provider.md | 31 +++--- docs/examples/messaging/get-subscriber.md | 33 +++--- docs/examples/messaging/get-topic.md | 31 +++--- docs/examples/messaging/list-message-logs.md | 32 +++--- docs/examples/messaging/list-messages.md | 31 +++--- docs/examples/messaging/list-provider-logs.md | 32 +++--- docs/examples/messaging/list-providers.md | 31 +++--- .../messaging/list-subscriber-logs.md | 32 +++--- docs/examples/messaging/list-subscribers.md | 33 +++--- docs/examples/messaging/list-targets.md | 32 +++--- docs/examples/messaging/list-topic-logs.md | 32 +++--- docs/examples/messaging/list-topics.md | 31 +++--- .../messaging/update-a-p-n-s-provider.md | 37 +++--- docs/examples/messaging/update-email.md | 41 ++++--- .../messaging/update-f-c-m-provider.md | 34 +++--- .../messaging/update-mailgun-provider.md | 40 ++++--- .../messaging/update-msg91provider.md | 36 +++--- docs/examples/messaging/update-push.md | 46 +++++--- docs/examples/messaging/update-s-m-s.md | 23 ---- .../messaging/update-s-m-t-p-provider.md | 23 ---- .../messaging/update-sendgrid-provider.md | 38 ++++--- docs/examples/messaging/update-sms.md | 24 ++++ .../messaging/update-smtp-provider.md | 31 ++++++ .../messaging/update-telesign-provider.md | 36 +++--- .../messaging/update-textmagic-provider.md | 36 +++--- docs/examples/messaging/update-topic.md | 32 +++--- .../messaging/update-twilio-provider.md | 36 +++--- .../messaging/update-vonage-provider.md | 36 +++--- docs/examples/storage/create-bucket.md | 41 +++---- docs/examples/storage/create-file.md | 36 +++--- docs/examples/storage/delete-bucket.md | 31 +++--- docs/examples/storage/delete-file.md | 33 +++--- docs/examples/storage/get-bucket.md | 31 +++--- docs/examples/storage/get-file-download.md | 33 +++--- docs/examples/storage/get-file-preview.md | 44 ++++---- docs/examples/storage/get-file-view.md | 33 +++--- docs/examples/storage/get-file.md | 33 +++--- docs/examples/storage/list-buckets.md | 31 +++--- docs/examples/storage/list-files.md | 33 +++--- docs/examples/storage/update-bucket.md | 41 +++---- docs/examples/storage/update-file.md | 35 +++--- docs/examples/teams/create-membership.md | 38 +++---- docs/examples/teams/create.md | 34 +++--- docs/examples/teams/delete-membership.md | 33 +++--- docs/examples/teams/delete.md | 31 +++--- docs/examples/teams/get-membership.md | 33 +++--- docs/examples/teams/get-prefs.md | 31 +++--- docs/examples/teams/get.md | 31 +++--- docs/examples/teams/list-memberships.md | 33 +++--- docs/examples/teams/list.md | 31 +++--- .../teams/update-membership-status.md | 37 +++--- docs/examples/teams/update-membership.md | 35 +++--- docs/examples/teams/update-name.md | 33 +++--- docs/examples/teams/update-prefs.md | 33 +++--- docs/examples/users/create-argon2user.md | 36 +++--- docs/examples/users/create-bcrypt-user.md | 36 +++--- docs/examples/users/create-m-d5user.md | 36 +++--- docs/examples/users/create-p-h-pass-user.md | 36 +++--- docs/examples/users/create-s-h-a-user.md | 37 +++--- .../users/create-scrypt-modified-user.md | 42 ++++--- docs/examples/users/create-scrypt-user.md | 46 ++++---- docs/examples/users/create-session.md | 31 +++--- docs/examples/users/create-target.md | 39 +++---- docs/examples/users/create-token.md | 33 +++--- docs/examples/users/create.md | 35 +++--- docs/examples/users/delete-authenticator.md | 35 +++--- docs/examples/users/delete-identity.md | 31 +++--- docs/examples/users/delete-session.md | 33 +++--- docs/examples/users/delete-sessions.md | 31 +++--- docs/examples/users/delete-target.md | 33 +++--- docs/examples/users/delete.md | 31 +++--- docs/examples/users/get-prefs.md | 31 +++--- docs/examples/users/get-target.md | 33 +++--- docs/examples/users/get.md | 31 +++--- docs/examples/users/list-factors.md | 31 +++--- docs/examples/users/list-identities.md | 31 +++--- docs/examples/users/list-logs.md | 32 +++--- docs/examples/users/list-memberships.md | 31 +++--- docs/examples/users/list-sessions.md | 31 +++--- docs/examples/users/list-targets.md | 32 +++--- docs/examples/users/list.md | 31 +++--- .../users/update-email-verification.md | 33 +++--- docs/examples/users/update-email.md | 33 +++--- docs/examples/users/update-labels.md | 33 +++--- docs/examples/users/update-mfa.md | 33 +++--- docs/examples/users/update-name.md | 33 +++--- docs/examples/users/update-password.md | 33 +++--- .../users/update-phone-verification.md | 33 +++--- docs/examples/users/update-phone.md | 33 +++--- docs/examples/users/update-prefs.md | 33 +++--- docs/examples/users/update-status.md | 33 +++--- docs/examples/users/update-target.md | 36 +++--- lib/dart_appwrite.dart | 2 +- lib/enums.dart | 2 +- lib/services/account.dart | 8 +- lib/services/avatars.dart | 6 +- lib/services/health.dart | 2 +- lib/services/messaging.dart | 105 +++++++++++++----- lib/services/users.dart | 2 +- lib/src/client_browser.dart | 2 +- lib/src/client_io.dart | 4 +- .../{smtp_encryption.dart => encryption.dart} | 4 +- lib/src/enums/runtime.dart | 34 +++++- pubspec.yaml | 2 +- test/services/functions_test.dart | 2 +- test/services/messaging_test.dart | 24 ++-- 270 files changed, 3943 insertions(+), 4711 deletions(-) delete mode 100644 docs/examples/messaging/create-a-p-n-s-provider.md create mode 100644 docs/examples/messaging/create-apns-provider.md delete mode 100644 docs/examples/messaging/create-f-c-m-provider.md create mode 100644 docs/examples/messaging/create-fcm-provider.md delete mode 100644 docs/examples/messaging/create-s-m-s.md delete mode 100644 docs/examples/messaging/create-s-m-t-p-provider.md create mode 100644 docs/examples/messaging/create-sms.md create mode 100644 docs/examples/messaging/create-smtp-provider.md delete mode 100644 docs/examples/messaging/update-s-m-s.md delete mode 100644 docs/examples/messaging/update-s-m-t-p-provider.md create mode 100644 docs/examples/messaging/update-sms.md create mode 100644 docs/examples/messaging/update-smtp-provider.md rename lib/src/enums/{smtp_encryption.dart => encryption.dart} (79%) diff --git a/README.md b/README.md index 237df9e2..7c01857b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![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.4.x-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.5.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) @@ -23,7 +23,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - dart_appwrite: ^11.0.0-rc.3 + dart_appwrite: ^11.0.0-rc.4 ``` You can install packages from the command line: diff --git a/docs/examples/account/add-authenticator.md b/docs/examples/account/add-authenticator.md index 22071146..f047a4de 100644 --- a/docs/examples/account/add-authenticator.md +++ b/docs/examples/account/add-authenticator.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.addAuthenticator( - type: AuthenticatorType.totp, - ); +Future result = account.addAuthenticator( + type: AuthenticatorType.totp, +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index f711916d..a173aaaa 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -1,20 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; +Account account = Account(client); - Future result = account.createAnonymousSession(); +Future result = account.createAnonymousSession(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index 0fef819c..56b4e66f 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; +Account account = Account(client); - Future result = account.createEmailPasswordSession( - email:'email@example.com' , - password:'password' , - ); +Future result = account.createEmailPasswordSession( + email: 'email@example.com', + password: 'password', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index f80f8a7c..48e8bcd4 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -1,23 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; +Account account = Account(client); - Future result = account.createEmailToken( - userId:'[USER_ID]' , - email:'email@example.com' , - ); +Future result = account.createEmailToken( + userId: '[USER_ID]', + email: 'email@example.com', + phrase: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-j-w-t.md index eda97f3d..1551beaf 100644 --- a/docs/examples/account/create-j-w-t.md +++ b/docs/examples/account/create-j-w-t.md @@ -1,20 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; +Account account = Account(client); - Future result = account.createJWT(); +Future result = account.createJWT(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/create-magic-u-r-l-token.md b/docs/examples/account/create-magic-u-r-l-token.md index 1372ae26..dbd6ad2e 100644 --- a/docs/examples/account/create-magic-u-r-l-token.md +++ b/docs/examples/account/create-magic-u-r-l-token.md @@ -1,23 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; +Account account = Account(client); - Future result = account.createMagicURLToken( - userId:'[USER_ID]' , - email:'email@example.com' , - ); +Future result = account.createMagicURLToken( + userId: '[USER_ID]', + email: 'email@example.com', + url: 'https://example.com', // (optional) + phrase: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/create-o-auth2session.md b/docs/examples/account/create-o-auth2session.md index dca64592..6f930723 100644 --- a/docs/examples/account/create-o-auth2session.md +++ b/docs/examples/account/create-o-auth2session.md @@ -1,22 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; +Account account = Account(client); - Future result = account.createOAuth2Session( - provider: OAuthProvider.amazon, - ); +Future result = account.createOAuth2Session( + provider: OAuthProvider.amazon, + success: 'https://example.com', // (optional) + failure: 'https://example.com', // (optional) + token: false, // (optional) + scopes: [], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index 715d4d51..8b801b31 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; +Account account = Account(client); - Future result = account.createPhoneToken( - userId:'[USER_ID]' , - phone:'+12065550100' , - ); +Future result = account.createPhoneToken( + userId: '[USER_ID]', + phone: '+12065550100', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index 8cfa2003..080739ac 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.createPhoneVerification(); +Future result = account.createPhoneVerification(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index e13b82e7..24695ed3 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.createRecovery( - email:'email@example.com' , - url:'https://example.com' , - ); +Future result = account.createRecovery( + email: 'email@example.com', + url: 'https://example.com', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index 988aa82d..6e739e24 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; +Account account = Account(client); - Future result = account.createSession( - userId:'[USER_ID]' , - secret:'[SECRET]' , - ); +Future result = account.createSession( + userId: '[USER_ID]', + secret: '[SECRET]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index 0bf09404..b0a93203 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.createVerification( - url:'https://example.com' , - ); +Future result = account.createVerification( + url: 'https://example.com', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index fe87c194..71381f37 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -1,24 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; +Account account = Account(client); - Future result = account.create( - userId:'[USER_ID]' , - email:'email@example.com' , - password:'' , - ); +Future result = account.create( + userId: '[USER_ID]', + email: 'email@example.com', + password: '', + name: '[NAME]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/create2f-a-challenge.md b/docs/examples/account/create2f-a-challenge.md index 1f4fd217..049a3e43 100644 --- a/docs/examples/account/create2f-a-challenge.md +++ b/docs/examples/account/create2f-a-challenge.md @@ -1,22 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; +Account account = Account(client); - Future result = account.create2FAChallenge( - factor: AuthenticationFactor.totp, - ); +Future result = account.create2FAChallenge( + factor: AuthenticationFactor.totp, +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/delete-authenticator.md b/docs/examples/account/delete-authenticator.md index 9edee3f6..3528bac9 100644 --- a/docs/examples/account/delete-authenticator.md +++ b/docs/examples/account/delete-authenticator.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.deleteAuthenticator( - type: AuthenticatorType.totp, - otp:'[OTP]' , - ); +Future result = account.deleteAuthenticator( + type: AuthenticatorType.totp, + otp: '[OTP]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index 583dc732..46dddcbe 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.deleteIdentity( - identityId:'[IDENTITY_ID]' , - ); +Future result = account.deleteIdentity( + identityId: '[IDENTITY_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index 7f0fbd07..8bca4844 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.deleteSession( - sessionId:'[SESSION_ID]' , - ); +Future result = account.deleteSession( + sessionId: '[SESSION_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index 269adb1c..d6e0829c 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.deleteSessions(); +Future result = account.deleteSessions(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index 62689693..ea93ce6f 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.getPrefs(); +Future result = account.getPrefs(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index b0163af9..0306af43 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.getSession( - sessionId:'[SESSION_ID]' , - ); +Future result = account.getSession( + sessionId: '[SESSION_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index 2bc68791..135e8ed4 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.get(); +Future result = account.get(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/list-factors.md b/docs/examples/account/list-factors.md index 98b7282b..6926b7bc 100644 --- a/docs/examples/account/list-factors.md +++ b/docs/examples/account/list-factors.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.listFactors(); +Future result = account.listFactors(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index 110fe062..287c7bb8 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -1,22 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.listIdentities( - ); +Future result = account.listIdentities( + queries: [], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index daaca540..81e51d47 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -1,22 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.listLogs( - ); +Future result = account.listLogs( + queries: [], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index e6428415..a7e6f76e 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.listSessions(); +Future result = account.listSessions(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/update-challenge.md b/docs/examples/account/update-challenge.md index 8b93325e..26c67e4d 100644 --- a/docs/examples/account/update-challenge.md +++ b/docs/examples/account/update-challenge.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.updateChallenge( - challengeId:'[CHALLENGE_ID]' , - otp:'[OTP]' , - ); +Future result = account.updateChallenge( + challengeId: '[CHALLENGE_ID]', + otp: '[OTP]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index e05c0199..b5e0a0e2 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.updateEmail( - email:'email@example.com' , - password:'password' , - ); +Future result = account.updateEmail( + email: 'email@example.com', + password: 'password', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/update-m-f-a.md b/docs/examples/account/update-m-f-a.md index b096d41e..621e5a88 100644 --- a/docs/examples/account/update-m-f-a.md +++ b/docs/examples/account/update-m-f-a.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.updateMFA( - mfa:false , - ); +Future result = account.updateMFA( + mfa: false, +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-u-r-l-session.md index 063d027f..18470683 100644 --- a/docs/examples/account/update-magic-u-r-l-session.md +++ b/docs/examples/account/update-magic-u-r-l-session.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; +Account account = Account(client); - Future result = account.updateMagicURLSession( - userId:'[USER_ID]' , - secret:'[SECRET]' , - ); +Future result = account.updateMagicURLSession( + userId: '[USER_ID]', + secret: '[SECRET]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index 66dc884e..016adfc0 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.updateName( - name:'[NAME]' , - ); +Future result = account.updateName( + name: '[NAME]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index f5af12d1..3b211a7f 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -1,23 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.updatePassword( - password:'' , - ); +Future result = account.updatePassword( + password: '', + oldPassword: 'password', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index de28fcce..c6f740f1 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.updatePhoneVerification( - userId:'[USER_ID]' , - secret:'[SECRET]' , - ); +Future result = account.updatePhoneVerification( + userId: '[USER_ID]', + secret: '[SECRET]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index ae9e41c3..a723eda1 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.updatePhone( - phone:'+12065550100' , - password:'password' , - ); +Future result = account.updatePhone( + phone: '+12065550100', + password: 'password', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index ad7f7ee4..22ce6c8a 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.updatePrefs( - prefs:{} , - ); +Future result = account.updatePrefs( + prefs: {}, +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index 87f6d2ec..ad48d22d 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -1,25 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.updateRecovery( - userId:'[USER_ID]' , - secret:'[SECRET]' , - password:'' , - ); +Future result = account.updateRecovery( + userId: '[USER_ID]', + secret: '[SECRET]', + password: '', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index 2b3fe184..aa047a2f 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.updateSession( - sessionId:'[SESSION_ID]' , - ); +Future result = account.updateSession( + sessionId: '[SESSION_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index e22efe80..ecc636ca 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.updateStatus(); +Future result = account.updateStatus(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index c25ac9bd..2390b1e8 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.updateVerification( - userId:'[USER_ID]' , - secret:'[SECRET]' , - ); +Future result = account.updateVerification( + userId: '[USER_ID]', + secret: '[SECRET]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/verify-authenticator.md b/docs/examples/account/verify-authenticator.md index f2c904c0..e6006546 100644 --- a/docs/examples/account/verify-authenticator.md +++ b/docs/examples/account/verify-authenticator.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Account account = Account(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Account account = Account(client); - Future result = account.verifyAuthenticator( - type: AuthenticatorType.totp, - otp:'[OTP]' , - ); +Future result = account.verifyAuthenticator( + type: AuthenticatorType.totp, + otp: '[OTP]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index 4b2baccd..d87bb8ad 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -1,23 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Avatars avatars = Avatars(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Avatars avatars = Avatars(client); - Future result = avatars.getBrowser( - code: Browser.avantBrowser, - ); +Future result = avatars.getBrowser( + code: Browser.avantBrowser, + width: 0, // (optional) + height: 0, // (optional) + quality: 0, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index bbbe431b..82ecb1ba 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -1,23 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Avatars avatars = Avatars(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Avatars avatars = Avatars(client); - Future result = avatars.getCreditCard( - code: CreditCard.americanExpress, - ); +Future result = avatars.getCreditCard( + code: CreditCard.americanExpress, + width: 0, // (optional) + height: 0, // (optional) + quality: 0, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index 95386975..855a1716 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Avatars avatars = Avatars(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Avatars avatars = Avatars(client); - Future result = avatars.getFavicon( - url:'https://example.com' , - ); +Future result = avatars.getFavicon( + url: 'https://example.com', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index 615ec2e4..474cc7ef 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -1,23 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Avatars avatars = Avatars(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Avatars avatars = Avatars(client); - Future result = avatars.getFlag( - code: Flag.afghanistan, - ); +Future result = avatars.getFlag( + code: Flag.afghanistan, + width: 0, // (optional) + height: 0, // (optional) + quality: 0, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index d8879002..af6aaca0 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -1,23 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Avatars avatars = Avatars(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Avatars avatars = Avatars(client); - Future result = avatars.getImage( - url:'https://example.com' , - ); +Future result = avatars.getImage( + url: 'https://example.com', + width: 0, // (optional) + height: 0, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 379e892f..36162fc2 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -1,22 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Avatars avatars = Avatars(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Avatars avatars = Avatars(client); - Future result = avatars.getInitials( - ); +Future result = avatars.getInitials( + name: '[NAME]', // (optional) + width: 0, // (optional) + height: 0, // (optional) + background: '', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md index 8a0a0e6e..c6d4da48 100644 --- a/docs/examples/avatars/get-q-r.md +++ b/docs/examples/avatars/get-q-r.md @@ -1,23 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Avatars avatars = Avatars(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Avatars avatars = Avatars(client); - Future result = avatars.getQR( - text:'[TEXT]' , - ); +Future result = avatars.getQR( + text: '[TEXT]', + size: 1, // (optional) + margin: 0, // (optional) + download: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index 16a4b33b..39df7955 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -1,26 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.createBooleanAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - xrequired:false , - ); +Future result = databases.createBooleanAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + xrequired: false, + xdefault: false, // (optional) + array: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index dc51b916..01a88051 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -1,25 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.createCollection( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - name:'[NAME]' , - ); +Future result = databases.createCollection( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + name: '[NAME]', + permissions: ["read("any")"], // (optional) + documentSecurity: false, // (optional) + enabled: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index f0c4cd0a..2ad1138b 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -1,26 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.createDatetimeAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - xrequired:false , - ); +Future result = databases.createDatetimeAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + xrequired: false, + xdefault: '', // (optional) + array: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 2060fc26..56dd827e 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -1,26 +1,22 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Databases databases = Databases(client); - Future result = databases.createDocument( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - documentId:'[DOCUMENT_ID]' , - data:{} , - ); +Future result = databases.createDocument( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + documentId: '[DOCUMENT_ID]', + data: {}, + permissions: ["read("any")"], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index e8b2f87d..e66dc5fd 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -1,26 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.createEmailAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - xrequired:false , - ); +Future result = databases.createEmailAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + xrequired: false, + xdefault: 'email@example.com', // (optional) + array: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index c8ee7e42..9ca4a10c 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -1,27 +1,24 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.createEnumAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - elements:[] , - xrequired:false , - ); +Future result = databases.createEnumAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + elements: [], + xrequired: false, + xdefault: '[DEFAULT]', // (optional) + array: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index 64c379fa..7ec40b67 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -1,26 +1,25 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.createFloatAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - xrequired:false , - ); +Future result = databases.createFloatAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + xrequired: false, + min: 0, // (optional) + max: 0, // (optional) + xdefault: 0, // (optional) + array: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index 457cb93f..5f57488f 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -1,27 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.createIndex( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - type: IndexType.key, - attributes:[] , - ); +Future result = databases.createIndex( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + type: IndexType.key, + attributes: [], + orders: [], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index 2e9ce298..82ab19e3 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -1,26 +1,25 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.createIntegerAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - xrequired:false , - ); +Future result = databases.createIntegerAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + xrequired: false, + min: 0, // (optional) + max: 0, // (optional) + xdefault: 0, // (optional) + array: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index 0cc76c04..8548934f 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -1,26 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.createIpAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - xrequired:false , - ); +Future result = databases.createIpAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + xrequired: false, + xdefault: '', // (optional) + array: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index 9a46ae78..791d4c68 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -1,26 +1,25 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.createRelationshipAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - relatedCollectionId:'[RELATED_COLLECTION_ID]' , - type: RelationshipType.oneToOne, - ); +Future result = databases.createRelationshipAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + relatedCollectionId: '[RELATED_COLLECTION_ID]', + type: RelationshipType.oneToOne, + twoWay: false, // (optional) + key: '', // (optional) + twoWayKey: '', // (optional) + onDelete: RelationMutate.cascade, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index 30c125c1..71ceb7da 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -1,27 +1,25 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.createStringAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - size:1 , - xrequired:false , - ); +Future result = databases.createStringAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + size: 1, + xrequired: false, + xdefault: '[DEFAULT]', // (optional) + array: false, // (optional) + encrypt: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index e6707e6d..157a06cd 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -1,26 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.createUrlAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - xrequired:false , - ); +Future result = databases.createUrlAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + xrequired: false, + xdefault: 'https://example.com', // (optional) + array: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index 522c5648..8dd4d6e4 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -1,24 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.create( - databaseId:'[DATABASE_ID]' , - name:'[NAME]' , - ); +Future result = databases.create( + databaseId: '[DATABASE_ID]', + name: '[NAME]', + enabled: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index b23f0f72..819aa3ab 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -1,25 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.deleteAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - ); +Future result = databases.deleteAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md index f72125e1..53c49ac3 100644 --- a/docs/examples/databases/delete-collection.md +++ b/docs/examples/databases/delete-collection.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.deleteCollection( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - ); +Future result = databases.deleteCollection( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index bd4adc7c..b8b04acb 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -1,25 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Databases databases = Databases(client); - Future result = databases.deleteDocument( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - documentId:'[DOCUMENT_ID]' , - ); +Future result = databases.deleteDocument( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + documentId: '[DOCUMENT_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index 3bcd726b..e72a7e45 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -1,25 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.deleteIndex( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - ); +Future result = databases.deleteIndex( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md index c46befdb..c285a5b1 100644 --- a/docs/examples/databases/delete.md +++ b/docs/examples/databases/delete.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.delete( - databaseId:'[DATABASE_ID]' , - ); +Future result = databases.delete( + databaseId: '[DATABASE_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index 9a5e9e68..adce2f20 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -1,25 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.getAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - ); +Future result = databases.getAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md index 41977e87..35ac9336 100644 --- a/docs/examples/databases/get-collection.md +++ b/docs/examples/databases/get-collection.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.getCollection( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - ); +Future result = databases.getCollection( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index 8e5faaaf..4ea43289 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -1,25 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Databases databases = Databases(client); - Future result = databases.getDocument( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - documentId:'[DOCUMENT_ID]' , - ); +Future result = databases.getDocument( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + documentId: '[DOCUMENT_ID]', + queries: [], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index 63add609..86fe2ff1 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -1,25 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.getIndex( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - ); +Future result = databases.getIndex( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md index b8eb7749..4060bfa8 100644 --- a/docs/examples/databases/get.md +++ b/docs/examples/databases/get.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.get( - databaseId:'[DATABASE_ID]' , - ); +Future result = databases.get( + databaseId: '[DATABASE_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index a4755433..872b58dc 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -1,24 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.listAttributes( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - ); +Future result = databases.listAttributes( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + queries: [], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index f1b9c80f..abce80c8 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -1,23 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.listCollections( - databaseId:'[DATABASE_ID]' , - ); +Future result = databases.listCollections( + databaseId: '[DATABASE_ID]', + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 2b1c27b5..271d0a56 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -1,24 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Databases databases = Databases(client); - Future result = databases.listDocuments( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - ); +Future result = databases.listDocuments( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + queries: [], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index ed2e1585..9e3f7db9 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -1,24 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.listIndexes( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - ); +Future result = databases.listIndexes( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + queries: [], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index 772d5181..101b7085 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -1,22 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.list( - ); +Future result = databases.list( + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index f62cabc1..0adc7fc1 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -1,27 +1,22 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.updateBooleanAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - xrequired:false , - xdefault:false , - ); +Future result = databases.updateBooleanAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + xrequired: false, + xdefault: false, +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index 7341232e..35ba5d1d 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -1,25 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.updateCollection( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - name:'[NAME]' , - ); +Future result = databases.updateCollection( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + name: '[NAME]', + permissions: ["read("any")"], // (optional) + documentSecurity: false, // (optional) + enabled: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index a217cb1c..40e21835 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -1,27 +1,22 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.updateDatetimeAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - xrequired:false , - xdefault:'' , - ); +Future result = databases.updateDatetimeAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + xrequired: false, + xdefault: '', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index c21a4daf..43dd3504 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -1,25 +1,22 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Databases databases = Databases(client); - Future result = databases.updateDocument( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - documentId:'[DOCUMENT_ID]' , - ); +Future result = databases.updateDocument( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + documentId: '[DOCUMENT_ID]', + data: {}, // (optional) + permissions: ["read("any")"], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index a6385c13..a6c37e2f 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -1,27 +1,22 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.updateEmailAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - xrequired:false , - xdefault:'email@example.com' , - ); +Future result = databases.updateEmailAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + xrequired: false, + xdefault: 'email@example.com', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index 04515351..0d4a896f 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -1,28 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.updateEnumAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - elements:[] , - xrequired:false , - xdefault:'[DEFAULT]' , - ); +Future result = databases.updateEnumAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + elements: [], + xrequired: false, + xdefault: '[DEFAULT]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index d8eeb67a..f1513ed7 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -1,29 +1,24 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.updateFloatAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - xrequired:false , - min:0 , - max:0 , - xdefault:0 , - ); +Future result = databases.updateFloatAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + xrequired: false, + min: 0, + max: 0, + xdefault: 0, +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 432f13cf..1c78e22f 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -1,29 +1,24 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.updateIntegerAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - xrequired:false , - min:0 , - max:0 , - xdefault:0 , - ); +Future result = databases.updateIntegerAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + xrequired: false, + min: 0, + max: 0, + xdefault: 0, +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index 7680e756..d55d51e9 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -1,27 +1,22 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.updateIpAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - xrequired:false , - xdefault:'' , - ); +Future result = databases.updateIpAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + xrequired: false, + xdefault: '', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index b4c07a60..05a99bfe 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -1,25 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.updateRelationshipAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - ); +Future result = databases.updateRelationshipAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + onDelete: RelationMutate.cascade, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index fec6f0de..aff7b95b 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -1,27 +1,22 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.updateStringAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - xrequired:false , - xdefault:'[DEFAULT]' , - ); +Future result = databases.updateStringAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + xrequired: false, + xdefault: '[DEFAULT]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index b5712281..b51ebfac 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -1,27 +1,22 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.updateUrlAttribute( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - key:'' , - xrequired:false , - xdefault:'https://example.com' , - ); +Future result = databases.updateUrlAttribute( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + key: '', + xrequired: false, + xdefault: 'https://example.com', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index 4d8f27bd..bdaf8cc2 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -1,24 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Databases databases = Databases(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Databases databases = Databases(client); - Future result = databases.update( - databaseId:'[DATABASE_ID]' , - name:'[NAME]' , - ); +Future result = databases.update( + databaseId: '[DATABASE_ID]', + name: '[NAME]', + enabled: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/create-build.md b/docs/examples/functions/create-build.md index 0b19e4b3..3640e658 100644 --- a/docs/examples/functions/create-build.md +++ b/docs/examples/functions/create-build.md @@ -1,25 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.createBuild( - functionId:'[FUNCTION_ID]' , - deploymentId:'[DEPLOYMENT_ID]' , - buildId:'[BUILD_ID]' , - ); +Future result = functions.createBuild( + functionId: '[FUNCTION_ID]', + deploymentId: '[DEPLOYMENT_ID]', + buildId: '[BUILD_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index 8f2cc223..9d53e42b 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -1,25 +1,22 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.createDeployment( - functionId:'[FUNCTION_ID]' , - code:InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg') , - activate:false , - ); +Future result = functions.createDeployment( + functionId: '[FUNCTION_ID]', + code: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'), + activate: false, + entrypoint: '[ENTRYPOINT]', // (optional) + commands: '[COMMANDS]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index f35c4948..c200fc03 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -1,23 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Functions functions = Functions(client); - Future result = functions.createExecution( - functionId:'[FUNCTION_ID]' , - ); +Future result = functions.createExecution( + functionId: '[FUNCTION_ID]', + body: '[BODY]', // (optional) + xasync: false, // (optional) + path: '[PATH]', // (optional) + method: ExecutionMethod.gET, // (optional) + headers: {}, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index 565d4c0f..fb9b8f57 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -1,25 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.createVariable( - functionId:'[FUNCTION_ID]' , - key:'[KEY]' , - value:'[VALUE]' , - ); +Future result = functions.createVariable( + functionId: '[FUNCTION_ID]', + key: '[KEY]', + value: '[VALUE]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index ff8bb454..cd90a368 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -1,25 +1,37 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.create( - functionId:'[FUNCTION_ID]' , - name:'[NAME]' , - runtime: .node180, - ); +Future result = functions.create( + functionId: '[FUNCTION_ID]', + name: '[NAME]', + runtime: .node145, + execute: ["any"], // (optional) + events: [], // (optional) + schedule: '', // (optional) + timeout: 1, // (optional) + enabled: false, // (optional) + logging: false, // (optional) + entrypoint: '[ENTRYPOINT]', // (optional) + commands: '[COMMANDS]', // (optional) + installationId: '[INSTALLATION_ID]', // (optional) + providerRepositoryId: '[PROVIDER_REPOSITORY_ID]', // (optional) + providerBranch: '[PROVIDER_BRANCH]', // (optional) + providerSilentMode: false, // (optional) + providerRootDirectory: '[PROVIDER_ROOT_DIRECTORY]', // (optional) + templateRepository: '[TEMPLATE_REPOSITORY]', // (optional) + templateOwner: '[TEMPLATE_OWNER]', // (optional) + templateRootDirectory: '[TEMPLATE_ROOT_DIRECTORY]', // (optional) + templateBranch: '[TEMPLATE_BRANCH]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md index 8e920bf6..653090e1 100644 --- a/docs/examples/functions/delete-deployment.md +++ b/docs/examples/functions/delete-deployment.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.deleteDeployment( - functionId:'[FUNCTION_ID]' , - deploymentId:'[DEPLOYMENT_ID]' , - ); +Future result = functions.deleteDeployment( + functionId: '[FUNCTION_ID]', + deploymentId: '[DEPLOYMENT_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md index 747ad8b6..adc8fd1c 100644 --- a/docs/examples/functions/delete-variable.md +++ b/docs/examples/functions/delete-variable.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.deleteVariable( - functionId:'[FUNCTION_ID]' , - variableId:'[VARIABLE_ID]' , - ); +Future result = functions.deleteVariable( + functionId: '[FUNCTION_ID]', + variableId: '[VARIABLE_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md index d49b56f6..24b563b6 100644 --- a/docs/examples/functions/delete.md +++ b/docs/examples/functions/delete.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.delete( - functionId:'[FUNCTION_ID]' , - ); +Future result = functions.delete( + functionId: '[FUNCTION_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/download-deployment.md b/docs/examples/functions/download-deployment.md index ab219700..a6853b4d 100644 --- a/docs/examples/functions/download-deployment.md +++ b/docs/examples/functions/download-deployment.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.downloadDeployment( - functionId:'[FUNCTION_ID]' , - deploymentId:'[DEPLOYMENT_ID]' , - ); +Future result = functions.downloadDeployment( + functionId: '[FUNCTION_ID]', + deploymentId: '[DEPLOYMENT_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md index 708731b2..4f0dace5 100644 --- a/docs/examples/functions/get-deployment.md +++ b/docs/examples/functions/get-deployment.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.getDeployment( - functionId:'[FUNCTION_ID]' , - deploymentId:'[DEPLOYMENT_ID]' , - ); +Future result = functions.getDeployment( + functionId: '[FUNCTION_ID]', + deploymentId: '[DEPLOYMENT_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index 7c27e4f6..3a2aee20 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Functions functions = Functions(client); - Future result = functions.getExecution( - functionId:'[FUNCTION_ID]' , - executionId:'[EXECUTION_ID]' , - ); +Future result = functions.getExecution( + functionId: '[FUNCTION_ID]', + executionId: '[EXECUTION_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md index 203c78c4..4f1e790a 100644 --- a/docs/examples/functions/get-variable.md +++ b/docs/examples/functions/get-variable.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.getVariable( - functionId:'[FUNCTION_ID]' , - variableId:'[VARIABLE_ID]' , - ); +Future result = functions.getVariable( + functionId: '[FUNCTION_ID]', + variableId: '[VARIABLE_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md index d8d8bd0a..1b128a74 100644 --- a/docs/examples/functions/get.md +++ b/docs/examples/functions/get.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.get( - functionId:'[FUNCTION_ID]' , - ); +Future result = functions.get( + functionId: '[FUNCTION_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index f3fe9ef4..2bf78016 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -1,23 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.listDeployments( - functionId:'[FUNCTION_ID]' , - ); +Future result = functions.listDeployments( + functionId: '[FUNCTION_ID]', + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 464b3bd0..cf37585b 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -1,23 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Functions functions = Functions(client); - Future result = functions.listExecutions( - functionId:'[FUNCTION_ID]' , - ); +Future result = functions.listExecutions( + functionId: '[FUNCTION_ID]', + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md index c1e22f4b..b67db078 100644 --- a/docs/examples/functions/list-runtimes.md +++ b/docs/examples/functions/list-runtimes.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.listRuntimes(); +Future result = functions.listRuntimes(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index ef998bca..56d01b4c 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.listVariables( - functionId:'[FUNCTION_ID]' , - ); +Future result = functions.listVariables( + functionId: '[FUNCTION_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index 9dfb828d..47de7df4 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -1,22 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.list( - ); +Future result = functions.list( + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/update-deployment.md b/docs/examples/functions/update-deployment.md index edf052b5..6f9a362f 100644 --- a/docs/examples/functions/update-deployment.md +++ b/docs/examples/functions/update-deployment.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.updateDeployment( - functionId:'[FUNCTION_ID]' , - deploymentId:'[DEPLOYMENT_ID]' , - ); +Future result = functions.updateDeployment( + functionId: '[FUNCTION_ID]', + deploymentId: '[DEPLOYMENT_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index e5681fff..cdbba7aa 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -1,25 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.updateVariable( - functionId:'[FUNCTION_ID]' , - variableId:'[VARIABLE_ID]' , - key:'[KEY]' , - ); +Future result = functions.updateVariable( + functionId: '[FUNCTION_ID]', + variableId: '[VARIABLE_ID]', + key: '[KEY]', + value: '[VALUE]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 1a390a98..42847ff1 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -1,24 +1,33 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Functions functions = Functions(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Functions functions = Functions(client); - Future result = functions.update( - functionId:'[FUNCTION_ID]' , - name:'[NAME]' , - ); +Future result = functions.update( + functionId: '[FUNCTION_ID]', + name: '[NAME]', + runtime: .node145, // (optional) + execute: ["any"], // (optional) + events: [], // (optional) + schedule: '', // (optional) + timeout: 1, // (optional) + enabled: false, // (optional) + logging: false, // (optional) + entrypoint: '[ENTRYPOINT]', // (optional) + commands: '[COMMANDS]', // (optional) + installationId: '[INSTALLATION_ID]', // (optional) + providerRepositoryId: '[PROVIDER_REPOSITORY_ID]', // (optional) + providerBranch: '[PROVIDER_BRANCH]', // (optional) + providerSilentMode: false, // (optional) + providerRootDirectory: '[PROVIDER_ROOT_DIRECTORY]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index b207aabf..56015d2a 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Graphql graphql = Graphql(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Graphql graphql = Graphql(client); - Future result = graphql.mutation( - query:{} , - ); +Future result = graphql.mutation( + query: {}, +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index 08f45777..39fa1cab 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Graphql graphql = Graphql(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Graphql graphql = Graphql(client); - Future result = graphql.query( - query:{} , - ); +Future result = graphql.query( + query: {}, +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md index 869bed29..782fd9de 100644 --- a/docs/examples/health/get-antivirus.md +++ b/docs/examples/health/get-antivirus.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getAntivirus(); +Future result = health.getAntivirus(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md index 0ac99e02..83869cbf 100644 --- a/docs/examples/health/get-cache.md +++ b/docs/examples/health/get-cache.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getCache(); +Future result = health.getCache(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md index c47b621f..9396be0f 100644 --- a/docs/examples/health/get-certificate.md +++ b/docs/examples/health/get-certificate.md @@ -1,22 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getCertificate( - ); +Future result = health.getCertificate( + domain: '', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-d-b.md b/docs/examples/health/get-d-b.md index f6c90880..d5408a43 100644 --- a/docs/examples/health/get-d-b.md +++ b/docs/examples/health/get-d-b.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getDB(); +Future result = health.getDB(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md index a1c24fee..66cd91f2 100644 --- a/docs/examples/health/get-failed-jobs.md +++ b/docs/examples/health/get-failed-jobs.md @@ -1,23 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getFailedJobs( - name: .v1Database, - ); +Future result = health.getFailedJobs( + name: .v1Database, + threshold: 0, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md index 4e577ffa..a1487cb6 100644 --- a/docs/examples/health/get-pub-sub.md +++ b/docs/examples/health/get-pub-sub.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getPubSub(); +Future result = health.getPubSub(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md index 0d14d5a3..65968de9 100644 --- a/docs/examples/health/get-queue-builds.md +++ b/docs/examples/health/get-queue-builds.md @@ -1,22 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getQueueBuilds( - ); +Future result = health.getQueueBuilds( + threshold: 0, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md index 231433dc..701a79a7 100644 --- a/docs/examples/health/get-queue-certificates.md +++ b/docs/examples/health/get-queue-certificates.md @@ -1,22 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getQueueCertificates( - ); +Future result = health.getQueueCertificates( + threshold: 0, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md index 64e5a960..913a1c1d 100644 --- a/docs/examples/health/get-queue-databases.md +++ b/docs/examples/health/get-queue-databases.md @@ -1,22 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getQueueDatabases( - ); +Future result = health.getQueueDatabases( + name: '[NAME]', // (optional) + threshold: 0, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md index cccca883..ca203267 100644 --- a/docs/examples/health/get-queue-deletes.md +++ b/docs/examples/health/get-queue-deletes.md @@ -1,22 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getQueueDeletes( - ); +Future result = health.getQueueDeletes( + threshold: 0, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md index df8de720..bb8eb652 100644 --- a/docs/examples/health/get-queue-functions.md +++ b/docs/examples/health/get-queue-functions.md @@ -1,22 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getQueueFunctions( - ); +Future result = health.getQueueFunctions( + threshold: 0, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md index f89d966d..4fd1afe0 100644 --- a/docs/examples/health/get-queue-logs.md +++ b/docs/examples/health/get-queue-logs.md @@ -1,22 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getQueueLogs( - ); +Future result = health.getQueueLogs( + threshold: 0, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md index e4462b28..f5c04439 100644 --- a/docs/examples/health/get-queue-mails.md +++ b/docs/examples/health/get-queue-mails.md @@ -1,22 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getQueueMails( - ); +Future result = health.getQueueMails( + threshold: 0, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md index ad79f2dc..f2e5159f 100644 --- a/docs/examples/health/get-queue-messaging.md +++ b/docs/examples/health/get-queue-messaging.md @@ -1,22 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getQueueMessaging( - ); +Future result = health.getQueueMessaging( + threshold: 0, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md index 9ec18507..ac76f681 100644 --- a/docs/examples/health/get-queue-migrations.md +++ b/docs/examples/health/get-queue-migrations.md @@ -1,22 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getQueueMigrations( - ); +Future result = health.getQueueMigrations( + threshold: 0, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md index 363d900f..4ebe33af 100644 --- a/docs/examples/health/get-queue-webhooks.md +++ b/docs/examples/health/get-queue-webhooks.md @@ -1,22 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getQueueWebhooks( - ); +Future result = health.getQueueWebhooks( + threshold: 0, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-queue.md b/docs/examples/health/get-queue.md index 48b60ba2..56d804e6 100644 --- a/docs/examples/health/get-queue.md +++ b/docs/examples/health/get-queue.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getQueue(); +Future result = health.getQueue(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md index 0e54a6df..b2e4dbab 100644 --- a/docs/examples/health/get-storage-local.md +++ b/docs/examples/health/get-storage-local.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getStorageLocal(); +Future result = health.getStorageLocal(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md index 668fe608..6d55ac2d 100644 --- a/docs/examples/health/get-time.md +++ b/docs/examples/health/get-time.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.getTime(); +Future result = health.getTime(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md index 10d1addb..cb3c9c3a 100644 --- a/docs/examples/health/get.md +++ b/docs/examples/health/get.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Health health = Health(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Health health = Health(client); - Future result = health.get(); +Future result = health.get(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index e0fe8a10..84debf0e 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Locale locale = Locale(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Locale locale = Locale(client); - Future result = locale.get(); +Future result = locale.get(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index f0f9a670..5ca9c62a 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Locale locale = Locale(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Locale locale = Locale(client); - Future result = locale.listCodes(); +Future result = locale.listCodes(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index c92a6bb7..3d9fa7ea 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Locale locale = Locale(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Locale locale = Locale(client); - Future result = locale.listContinents(); +Future result = locale.listContinents(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-e-u.md index 7965dab7..a51c92c0 100644 --- a/docs/examples/locale/list-countries-e-u.md +++ b/docs/examples/locale/list-countries-e-u.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Locale locale = Locale(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Locale locale = Locale(client); - Future result = locale.listCountriesEU(); +Future result = locale.listCountriesEU(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index f3ef0685..402a5d8a 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Locale locale = Locale(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Locale locale = Locale(client); - Future result = locale.listCountriesPhones(); +Future result = locale.listCountriesPhones(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index 7d4d8b4b..2bae8194 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Locale locale = Locale(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Locale locale = Locale(client); - Future result = locale.listCountries(); +Future result = locale.listCountries(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index 9acad5c1..c8694c65 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Locale locale = Locale(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Locale locale = Locale(client); - Future result = locale.listCurrencies(); +Future result = locale.listCurrencies(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index 7a636681..8f704106 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -1,21 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Locale locale = Locale(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Locale locale = Locale(client); - Future result = locale.listLanguages(); +Future result = locale.listLanguages(); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); 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 792cd997..00000000 --- a/docs/examples/messaging/create-a-p-n-s-provider.md +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:dart_appwrite/dart_appwrite.dart'; - -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); - - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; - - Future result = messaging.createAPNSProvider( - providerId:'[PROVIDER_ID]' , - name:'[NAME]' , - ); - - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md new file mode 100644 index 00000000..ca650590 --- /dev/null +++ b/docs/examples/messaging/create-apns-provider.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + +Messaging messaging = Messaging(client); + +Future result = messaging.createApnsProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + authKey: '[AUTH_KEY]', // (optional) + authKeyId: '[AUTH_KEY_ID]', // (optional) + teamId: '[TEAM_ID]', // (optional) + bundleId: '[BUNDLE_ID]', // (optional) + enabled: false, // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md index 670d2431..b52019a7 100644 --- a/docs/examples/messaging/create-email.md +++ b/docs/examples/messaging/create-email.md @@ -1,25 +1,29 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.createEmail( - messageId:'[MESSAGE_ID]' , - subject:'[SUBJECT]' , - content:'[CONTENT]' , - ); +Future result = messaging.createEmail( + messageId: '[MESSAGE_ID]', + subject: '[SUBJECT]', + content: '[CONTENT]', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + cc: [], // (optional) + bcc: [], // (optional) + attachments: [], // (optional) + status: MessageStatus.draft, // (optional) + html: false, // (optional) + scheduledAt: '', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); 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 595feb7f..00000000 --- a/docs/examples/messaging/create-f-c-m-provider.md +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:dart_appwrite/dart_appwrite.dart'; - -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); - - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; - - Future result = messaging.createFCMProvider( - providerId:'[PROVIDER_ID]' , - name:'[NAME]' , - ); - - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md new file mode 100644 index 00000000..088a0111 --- /dev/null +++ b/docs/examples/messaging/create-fcm-provider.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + +Messaging messaging = Messaging(client); + +Future result = messaging.createFcmProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + serviceAccountJSON: {}, // (optional) + enabled: false, // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md index 5e9b4e7a..0e88a8c8 100644 --- a/docs/examples/messaging/create-mailgun-provider.md +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -1,24 +1,27 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.createMailgunProvider( - providerId:'[PROVIDER_ID]' , - name:'[NAME]' , - ); +Future result = messaging.createMailgunProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + apiKey: '[API_KEY]', // (optional) + domain: '[DOMAIN]', // (optional) + isEuRegion: false, // (optional) + fromName: '[FROM_NAME]', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '[REPLY_TO_NAME]', // (optional) + replyToEmail: 'email@example.com', // (optional) + enabled: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/create-msg91provider.md b/docs/examples/messaging/create-msg91provider.md index 2754ef16..25f52705 100644 --- a/docs/examples/messaging/create-msg91provider.md +++ b/docs/examples/messaging/create-msg91provider.md @@ -1,24 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.createMsg91Provider( - providerId:'[PROVIDER_ID]' , - name:'[NAME]' , - ); +Future result = messaging.createMsg91Provider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + from: '+12065550100', // (optional) + senderId: '[SENDER_ID]', // (optional) + authKey: '[AUTH_KEY]', // (optional) + enabled: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index 79f68709..53a900e7 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -1,25 +1,33 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.createPush( - messageId:'[MESSAGE_ID]' , - title:'[TITLE]' , - body:'[BODY]' , - ); +Future result = messaging.createPush( + messageId: '[MESSAGE_ID]', + title: '[TITLE]', + body: '[BODY]', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + data: {}, // (optional) + action: '[ACTION]', // (optional) + image: '[ID1:ID2]', // (optional) + icon: '[ICON]', // (optional) + sound: '[SOUND]', // (optional) + color: '[COLOR]', // (optional) + tag: '[TAG]', // (optional) + badge: '[BADGE]', // (optional) + status: MessageStatus.draft, // (optional) + scheduledAt: '', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); 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 82bbaab2..00000000 --- a/docs/examples/messaging/create-s-m-s.md +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:dart_appwrite/dart_appwrite.dart'; - -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); - - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; - - Future result = messaging.createSMS( - messageId:'[MESSAGE_ID]' , - content:'[CONTENT]' , - ); - - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file 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 c22c27c0..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'; - -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); - - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; - - Future result = messaging.createSMTPProvider( - providerId:'[PROVIDER_ID]' , - name:'[NAME]' , - host:'[HOST]' , - ); - - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md index 61f80a28..21a58a6c 100644 --- a/docs/examples/messaging/create-sendgrid-provider.md +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -1,24 +1,25 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.createSendgridProvider( - providerId:'[PROVIDER_ID]' , - name:'[NAME]' , - ); +Future result = messaging.createSendgridProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + apiKey: '[API_KEY]', // (optional) + fromName: '[FROM_NAME]', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '[REPLY_TO_NAME]', // (optional) + replyToEmail: 'email@example.com', // (optional) + enabled: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md new file mode 100644 index 00000000..213c360a --- /dev/null +++ b/docs/examples/messaging/create-sms.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + +Messaging messaging = Messaging(client); + +Future result = messaging.createSms( + messageId: '[MESSAGE_ID]', + content: '[CONTENT]', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + status: MessageStatus.draft, // (optional) + scheduledAt: '', // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md new file mode 100644 index 00000000..012e560a --- /dev/null +++ b/docs/examples/messaging/create-smtp-provider.md @@ -0,0 +1,31 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + +Messaging messaging = Messaging(client); + +Future result = messaging.createSmtpProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + host: '[HOST]', + port: 1, // (optional) + username: '[USERNAME]', // (optional) + password: '[PASSWORD]', // (optional) + encryption: .none, // (optional) + autoTLS: false, // (optional) + mailer: '[MAILER]', // (optional) + fromName: '[FROM_NAME]', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '[REPLY_TO_NAME]', // (optional) + replyToEmail: 'email@example.com', // (optional) + enabled: false, // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md index 2cb79dd0..4998e314 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -1,25 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...'); // Your secret JSON Web Token - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token - ; +Messaging messaging = Messaging(client); - Future result = messaging.createSubscriber( - topicId:'[TOPIC_ID]' , - subscriberId:'[SUBSCRIBER_ID]' , - targetId:'[TARGET_ID]' , - ); +Future result = messaging.createSubscriber( + topicId: '[TOPIC_ID]', + subscriberId: '[SUBSCRIBER_ID]', + targetId: '[TARGET_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md index f1693170..2f13526d 100644 --- a/docs/examples/messaging/create-telesign-provider.md +++ b/docs/examples/messaging/create-telesign-provider.md @@ -1,24 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.createTelesignProvider( - providerId:'[PROVIDER_ID]' , - name:'[NAME]' , - ); +Future result = messaging.createTelesignProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + from: '+12065550100', // (optional) + customerId: '[CUSTOMER_ID]', // (optional) + apiKey: '[API_KEY]', // (optional) + enabled: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md index d6b248f4..42a1e8c5 100644 --- a/docs/examples/messaging/create-textmagic-provider.md +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -1,24 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.createTextmagicProvider( - providerId:'[PROVIDER_ID]' , - name:'[NAME]' , - ); +Future result = messaging.createTextmagicProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + from: '+12065550100', // (optional) + username: '[USERNAME]', // (optional) + apiKey: '[API_KEY]', // (optional) + enabled: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md index 0dfafc16..9828f49f 100644 --- a/docs/examples/messaging/create-topic.md +++ b/docs/examples/messaging/create-topic.md @@ -1,24 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.createTopic( - topicId:'[TOPIC_ID]' , - name:'[NAME]' , - ); +Future result = messaging.createTopic( + topicId: '[TOPIC_ID]', + name: '[NAME]', + subscribe: ["any"], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md index 88e77590..d12bacfd 100644 --- a/docs/examples/messaging/create-twilio-provider.md +++ b/docs/examples/messaging/create-twilio-provider.md @@ -1,24 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.createTwilioProvider( - providerId:'[PROVIDER_ID]' , - name:'[NAME]' , - ); +Future result = messaging.createTwilioProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + from: '+12065550100', // (optional) + accountSid: '[ACCOUNT_SID]', // (optional) + authToken: '[AUTH_TOKEN]', // (optional) + enabled: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md index e51ab437..0eb69291 100644 --- a/docs/examples/messaging/create-vonage-provider.md +++ b/docs/examples/messaging/create-vonage-provider.md @@ -1,24 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.createVonageProvider( - providerId:'[PROVIDER_ID]' , - name:'[NAME]' , - ); +Future result = messaging.createVonageProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', + from: '+12065550100', // (optional) + apiKey: '[API_KEY]', // (optional) + apiSecret: '[API_SECRET]', // (optional) + enabled: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md index 2f53a4d4..c319926b 100644 --- a/docs/examples/messaging/delete-provider.md +++ b/docs/examples/messaging/delete-provider.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.deleteProvider( - providerId:'[PROVIDER_ID]' , - ); +Future result = messaging.deleteProvider( + providerId: '[PROVIDER_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md index 0a24dfc0..d11c28b0 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...'); // Your secret JSON Web Token - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token - ; +Messaging messaging = Messaging(client); - Future result = messaging.deleteSubscriber( - topicId:'[TOPIC_ID]' , - subscriberId:'[SUBSCRIBER_ID]' , - ); +Future result = messaging.deleteSubscriber( + topicId: '[TOPIC_ID]', + subscriberId: '[SUBSCRIBER_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md index 343a5321..8887f209 100644 --- a/docs/examples/messaging/delete-topic.md +++ b/docs/examples/messaging/delete-topic.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.deleteTopic( - topicId:'[TOPIC_ID]' , - ); +Future result = messaging.deleteTopic( + topicId: '[TOPIC_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md index bf466d20..80182872 100644 --- a/docs/examples/messaging/delete.md +++ b/docs/examples/messaging/delete.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.delete( - messageId:'[MESSAGE_ID]' , - ); +Future result = messaging.delete( + messageId: '[MESSAGE_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md index 25876c6c..b1e462cd 100644 --- a/docs/examples/messaging/get-message.md +++ b/docs/examples/messaging/get-message.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.getMessage( - messageId:'[MESSAGE_ID]' , - ); +Future result = messaging.getMessage( + messageId: '[MESSAGE_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md index 73a46154..59fb930f 100644 --- a/docs/examples/messaging/get-provider.md +++ b/docs/examples/messaging/get-provider.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.getProvider( - providerId:'[PROVIDER_ID]' , - ); +Future result = messaging.getProvider( + providerId: '[PROVIDER_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md index 7ac072b6..f6d5429f 100644 --- a/docs/examples/messaging/get-subscriber.md +++ b/docs/examples/messaging/get-subscriber.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.getSubscriber( - topicId:'[TOPIC_ID]' , - subscriberId:'[SUBSCRIBER_ID]' , - ); +Future result = messaging.getSubscriber( + topicId: '[TOPIC_ID]', + subscriberId: '[SUBSCRIBER_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md index 4473566b..4627f299 100644 --- a/docs/examples/messaging/get-topic.md +++ b/docs/examples/messaging/get-topic.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.getTopic( - topicId:'[TOPIC_ID]' , - ); +Future result = messaging.getTopic( + topicId: '[TOPIC_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md index 5bda8a1e..e9c376c1 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/messaging/list-message-logs.md @@ -1,23 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.listMessageLogs( - messageId:'[MESSAGE_ID]' , - ); +Future result = messaging.listMessageLogs( + messageId: '[MESSAGE_ID]', + queries: [], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md index ff78bb35..2d70b4fa 100644 --- a/docs/examples/messaging/list-messages.md +++ b/docs/examples/messaging/list-messages.md @@ -1,22 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.listMessages( - ); +Future result = messaging.listMessages( + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md index fb23a313..3de551cf 100644 --- a/docs/examples/messaging/list-provider-logs.md +++ b/docs/examples/messaging/list-provider-logs.md @@ -1,23 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.listProviderLogs( - providerId:'[PROVIDER_ID]' , - ); +Future result = messaging.listProviderLogs( + providerId: '[PROVIDER_ID]', + queries: [], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md index 9770b835..84709915 100644 --- a/docs/examples/messaging/list-providers.md +++ b/docs/examples/messaging/list-providers.md @@ -1,22 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.listProviders( - ); +Future result = messaging.listProviders( + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md index bed33f03..2a08a651 100644 --- a/docs/examples/messaging/list-subscriber-logs.md +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -1,23 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.listSubscriberLogs( - subscriberId:'[SUBSCRIBER_ID]' , - ); +Future result = messaging.listSubscriberLogs( + subscriberId: '[SUBSCRIBER_ID]', + queries: [], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md index ccfda580..3cd42c9b 100644 --- a/docs/examples/messaging/list-subscribers.md +++ b/docs/examples/messaging/list-subscribers.md @@ -1,23 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.listSubscribers( - topicId:'[TOPIC_ID]' , - ); +Future result = messaging.listSubscribers( + topicId: '[TOPIC_ID]', + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md index d51d200d..a7508a80 100644 --- a/docs/examples/messaging/list-targets.md +++ b/docs/examples/messaging/list-targets.md @@ -1,23 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.listTargets( - messageId:'[MESSAGE_ID]' , - ); +Future result = messaging.listTargets( + messageId: '[MESSAGE_ID]', + queries: [], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md index 4827c450..0ca10f51 100644 --- a/docs/examples/messaging/list-topic-logs.md +++ b/docs/examples/messaging/list-topic-logs.md @@ -1,23 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.listTopicLogs( - topicId:'[TOPIC_ID]' , - ); +Future result = messaging.listTopicLogs( + topicId: '[TOPIC_ID]', + queries: [], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md index 3b653496..3e7a2507 100644 --- a/docs/examples/messaging/list-topics.md +++ b/docs/examples/messaging/list-topics.md @@ -1,22 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.listTopics( - ); +Future result = messaging.listTopics( + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/update-a-p-n-s-provider.md b/docs/examples/messaging/update-a-p-n-s-provider.md index 0fb41a2f..7a321532 100644 --- a/docs/examples/messaging/update-a-p-n-s-provider.md +++ b/docs/examples/messaging/update-a-p-n-s-provider.md @@ -1,23 +1,24 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.updateAPNSProvider( - providerId:'[PROVIDER_ID]' , - ); +Future result = messaging.updateAPNSProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', // (optional) + enabled: false, // (optional) + authKey: '[AUTH_KEY]', // (optional) + authKeyId: '[AUTH_KEY_ID]', // (optional) + teamId: '[TEAM_ID]', // (optional) + bundleId: '[BUNDLE_ID]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index aa4cbddc..dbca395c 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -1,23 +1,28 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.updateEmail( - messageId:'[MESSAGE_ID]' , - ); +Future result = messaging.updateEmail( + messageId: '[MESSAGE_ID]', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + subject: '[SUBJECT]', // (optional) + content: '[CONTENT]', // (optional) + status: MessageStatus.draft, // (optional) + html: false, // (optional) + cc: [], // (optional) + bcc: [], // (optional) + scheduledAt: '', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/update-f-c-m-provider.md b/docs/examples/messaging/update-f-c-m-provider.md index 868f2a2a..12ddad79 100644 --- a/docs/examples/messaging/update-f-c-m-provider.md +++ b/docs/examples/messaging/update-f-c-m-provider.md @@ -1,23 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.updateFCMProvider( - providerId:'[PROVIDER_ID]' , - ); +Future result = messaging.updateFCMProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', // (optional) + enabled: false, // (optional) + serviceAccountJSON: {}, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md index 1d494c3f..d55203e8 100644 --- a/docs/examples/messaging/update-mailgun-provider.md +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -1,23 +1,27 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.updateMailgunProvider( - providerId:'[PROVIDER_ID]' , - ); +Future result = messaging.updateMailgunProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', // (optional) + apiKey: '[API_KEY]', // (optional) + domain: '[DOMAIN]', // (optional) + isEuRegion: false, // (optional) + enabled: false, // (optional) + fromName: '[FROM_NAME]', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '[REPLY_TO_NAME]', // (optional) + replyToEmail: '[REPLY_TO_EMAIL]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/update-msg91provider.md b/docs/examples/messaging/update-msg91provider.md index 73a03d2a..2c79c1f9 100644 --- a/docs/examples/messaging/update-msg91provider.md +++ b/docs/examples/messaging/update-msg91provider.md @@ -1,23 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.updateMsg91Provider( - providerId:'[PROVIDER_ID]' , - ); +Future result = messaging.updateMsg91Provider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', // (optional) + enabled: false, // (optional) + senderId: '[SENDER_ID]', // (optional) + authKey: '[AUTH_KEY]', // (optional) + from: '[FROM]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index 92bf2127..1ddf03ae 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -1,23 +1,33 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.updatePush( - messageId:'[MESSAGE_ID]' , - ); +Future result = messaging.updatePush( + messageId: '[MESSAGE_ID]', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + title: '[TITLE]', // (optional) + body: '[BODY]', // (optional) + data: {}, // (optional) + action: '[ACTION]', // (optional) + image: '[ID1:ID2]', // (optional) + icon: '[ICON]', // (optional) + sound: '[SOUND]', // (optional) + color: '[COLOR]', // (optional) + tag: '[TAG]', // (optional) + badge: 0, // (optional) + status: MessageStatus.draft, // (optional) + scheduledAt: '', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); 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 f091ba6f..00000000 --- a/docs/examples/messaging/update-s-m-s.md +++ /dev/null @@ -1,23 +0,0 @@ -import 'package:dart_appwrite/dart_appwrite.dart'; - -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); - - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; - - Future result = messaging.updateSMS( - messageId:'[MESSAGE_ID]' , - ); - - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file 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 d74bbcd2..00000000 --- a/docs/examples/messaging/update-s-m-t-p-provider.md +++ /dev/null @@ -1,23 +0,0 @@ -import 'package:dart_appwrite/dart_appwrite.dart'; - -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); - - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; - - Future result = messaging.updateSMTPProvider( - providerId:'[PROVIDER_ID]' , - ); - - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md index 89c60247..feecbe42 100644 --- a/docs/examples/messaging/update-sendgrid-provider.md +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -1,23 +1,25 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.updateSendgridProvider( - providerId:'[PROVIDER_ID]' , - ); +Future result = messaging.updateSendgridProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', // (optional) + enabled: false, // (optional) + apiKey: '[API_KEY]', // (optional) + fromName: '[FROM_NAME]', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '[REPLY_TO_NAME]', // (optional) + replyToEmail: '[REPLY_TO_EMAIL]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md new file mode 100644 index 00000000..6c8bad98 --- /dev/null +++ b/docs/examples/messaging/update-sms.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + +Messaging messaging = Messaging(client); + +Future result = messaging.updateSms( + messageId: '[MESSAGE_ID]', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + content: '[CONTENT]', // (optional) + status: MessageStatus.draft, // (optional) + scheduledAt: '', // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md new file mode 100644 index 00000000..ff7316af --- /dev/null +++ b/docs/examples/messaging/update-smtp-provider.md @@ -0,0 +1,31 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + +Messaging messaging = Messaging(client); + +Future result = messaging.updateSmtpProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', // (optional) + host: '[HOST]', // (optional) + port: 1, // (optional) + username: '[USERNAME]', // (optional) + password: '[PASSWORD]', // (optional) + encryption: .none, // (optional) + autoTLS: false, // (optional) + mailer: '[MAILER]', // (optional) + fromName: '[FROM_NAME]', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '[REPLY_TO_NAME]', // (optional) + replyToEmail: '[REPLY_TO_EMAIL]', // (optional) + enabled: false, // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md index fa6b5a20..38003682 100644 --- a/docs/examples/messaging/update-telesign-provider.md +++ b/docs/examples/messaging/update-telesign-provider.md @@ -1,23 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.updateTelesignProvider( - providerId:'[PROVIDER_ID]' , - ); +Future result = messaging.updateTelesignProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', // (optional) + enabled: false, // (optional) + customerId: '[CUSTOMER_ID]', // (optional) + apiKey: '[API_KEY]', // (optional) + from: '[FROM]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md index 971f8850..dc7df222 100644 --- a/docs/examples/messaging/update-textmagic-provider.md +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -1,23 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.updateTextmagicProvider( - providerId:'[PROVIDER_ID]' , - ); +Future result = messaging.updateTextmagicProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', // (optional) + enabled: false, // (optional) + username: '[USERNAME]', // (optional) + apiKey: '[API_KEY]', // (optional) + from: '[FROM]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md index 1fa9cc25..299bfe17 100644 --- a/docs/examples/messaging/update-topic.md +++ b/docs/examples/messaging/update-topic.md @@ -1,23 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.updateTopic( - topicId:'[TOPIC_ID]' , - ); +Future result = messaging.updateTopic( + topicId: '[TOPIC_ID]', + name: '[NAME]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md index 1ad3697c..29b64b48 100644 --- a/docs/examples/messaging/update-twilio-provider.md +++ b/docs/examples/messaging/update-twilio-provider.md @@ -1,23 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.updateTwilioProvider( - providerId:'[PROVIDER_ID]' , - ); +Future result = messaging.updateTwilioProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', // (optional) + enabled: false, // (optional) + accountSid: '[ACCOUNT_SID]', // (optional) + authToken: '[AUTH_TOKEN]', // (optional) + from: '[FROM]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md index c185c1f3..835d4f32 100644 --- a/docs/examples/messaging/update-vonage-provider.md +++ b/docs/examples/messaging/update-vonage-provider.md @@ -1,23 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Messaging messaging = Messaging(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Messaging messaging = Messaging(client); - Future result = messaging.updateVonageProvider( - providerId:'[PROVIDER_ID]' , - ); +Future result = messaging.updateVonageProvider( + providerId: '[PROVIDER_ID]', + name: '[NAME]', // (optional) + enabled: false, // (optional) + apiKey: '[API_KEY]', // (optional) + apiSecret: '[API_SECRET]', // (optional) + from: '[FROM]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index 3ad7a0d4..dfae56a6 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -1,24 +1,27 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Storage storage = Storage(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Storage storage = Storage(client); - Future result = storage.createBucket( - bucketId:'[BUCKET_ID]' , - name:'[NAME]' , - ); +Future result = storage.createBucket( + bucketId: '[BUCKET_ID]', + name: '[NAME]', + permissions: ["read("any")"], // (optional) + fileSecurity: false, // (optional) + enabled: false, // (optional) + maximumFileSize: 1, // (optional) + allowedFileExtensions: [], // (optional) + compression: .none, // (optional) + encryption: false, // (optional) + antivirus: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index f1efad6b..69aee405 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -1,26 +1,22 @@ import 'dart:io'; import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Storage storage = Storage(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Storage storage = Storage(client); - Future result = storage.createFile( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - file:InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg') , - ); +Future result = storage.createFile( + bucketId: '[BUCKET_ID]', + fileId: '[FILE_ID]', + file: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'), + permissions: ["read("any")"], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md index 2cf8cb51..a3f164bd 100644 --- a/docs/examples/storage/delete-bucket.md +++ b/docs/examples/storage/delete-bucket.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Storage storage = Storage(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Storage storage = Storage(client); - Future result = storage.deleteBucket( - bucketId:'[BUCKET_ID]' , - ); +Future result = storage.deleteBucket( + bucketId: '[BUCKET_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index 622f498e..677cea62 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Storage storage = Storage(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Storage storage = Storage(client); - Future result = storage.deleteFile( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - ); +Future result = storage.deleteFile( + bucketId: '[BUCKET_ID]', + fileId: '[FILE_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md index e0ec232e..daa9edd8 100644 --- a/docs/examples/storage/get-bucket.md +++ b/docs/examples/storage/get-bucket.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Storage storage = Storage(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Storage storage = Storage(client); - Future result = storage.getBucket( - bucketId:'[BUCKET_ID]' , - ); +Future result = storage.getBucket( + bucketId: '[BUCKET_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index ef00b0d2..9551d45b 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Storage storage = Storage(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Storage storage = Storage(client); - Future result = storage.getFileDownload( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - ); +Future result = storage.getFileDownload( + bucketId: '[BUCKET_ID]', + fileId: '[FILE_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 2091e7b2..6ea895c2 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -1,24 +1,30 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Storage storage = Storage(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Storage storage = Storage(client); - Future result = storage.getFilePreview( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - ); +Future result = storage.getFilePreview( + bucketId: '[BUCKET_ID]', + fileId: '[FILE_ID]', + width: 0, // (optional) + height: 0, // (optional) + gravity: ImageGravity.center, // (optional) + quality: 0, // (optional) + borderWidth: 0, // (optional) + borderColor: '', // (optional) + borderRadius: 0, // (optional) + opacity: 0, // (optional) + rotation: -360, // (optional) + background: '', // (optional) + output: ImageFormat.jpg, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index 01959e51..b576c43a 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Storage storage = Storage(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Storage storage = Storage(client); - Future result = storage.getFileView( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - ); +Future result = storage.getFileView( + bucketId: '[BUCKET_ID]', + fileId: '[FILE_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index e532682f..c6a21b76 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Storage storage = Storage(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Storage storage = Storage(client); - Future result = storage.getFile( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - ); +Future result = storage.getFile( + bucketId: '[BUCKET_ID]', + fileId: '[FILE_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index 3aa7b99b..d9010c8b 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -1,22 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Storage storage = Storage(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Storage storage = Storage(client); - Future result = storage.listBuckets( - ); +Future result = storage.listBuckets( + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index f17658f0..ace7391c 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -1,23 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Storage storage = Storage(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Storage storage = Storage(client); - Future result = storage.listFiles( - bucketId:'[BUCKET_ID]' , - ); +Future result = storage.listFiles( + bucketId: '[BUCKET_ID]', + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index 2ea2a8ae..33c84216 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -1,24 +1,27 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Storage storage = Storage(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Storage storage = Storage(client); - Future result = storage.updateBucket( - bucketId:'[BUCKET_ID]' , - name:'[NAME]' , - ); +Future result = storage.updateBucket( + bucketId: '[BUCKET_ID]', + name: '[NAME]', + permissions: ["read("any")"], // (optional) + fileSecurity: false, // (optional) + enabled: false, // (optional) + maximumFileSize: 1, // (optional) + allowedFileExtensions: [], // (optional) + compression: .none, // (optional) + encryption: false, // (optional) + antivirus: false, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index bd340862..b31dd1b9 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -1,24 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Storage storage = Storage(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Storage storage = Storage(client); - Future result = storage.updateFile( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - ); +Future result = storage.updateFile( + bucketId: '[BUCKET_ID]', + fileId: '[FILE_ID]', + name: '[NAME]', // (optional) + permissions: ["read("any")"], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 44a7daa6..645b979e 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -1,24 +1,24 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Teams teams = Teams(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Teams teams = Teams(client); - Future result = teams.createMembership( - teamId:'[TEAM_ID]' , - roles:[] , - ); +Future result = teams.createMembership( + teamId: '[TEAM_ID]', + roles: [], + email: 'email@example.com', // (optional) + userId: '[USER_ID]', // (optional) + phone: '+12065550100', // (optional) + url: 'https://example.com', // (optional) + name: '[NAME]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index adc0480b..4616ed4b 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -1,24 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Teams teams = Teams(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Teams teams = Teams(client); - Future result = teams.create( - teamId:'[TEAM_ID]' , - name:'[NAME]' , - ); +Future result = teams.create( + teamId: '[TEAM_ID]', + name: '[NAME]', + roles: [], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index cc3246d1..73f5a0db 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Teams teams = Teams(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Teams teams = Teams(client); - Future result = teams.deleteMembership( - teamId:'[TEAM_ID]' , - membershipId:'[MEMBERSHIP_ID]' , - ); +Future result = teams.deleteMembership( + teamId: '[TEAM_ID]', + membershipId: '[MEMBERSHIP_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index 8286949d..d46e40d9 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Teams teams = Teams(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Teams teams = Teams(client); - Future result = teams.delete( - teamId:'[TEAM_ID]' , - ); +Future result = teams.delete( + teamId: '[TEAM_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index afca18a8..b436cbf0 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Teams teams = Teams(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Teams teams = Teams(client); - Future result = teams.getMembership( - teamId:'[TEAM_ID]' , - membershipId:'[MEMBERSHIP_ID]' , - ); +Future result = teams.getMembership( + teamId: '[TEAM_ID]', + membershipId: '[MEMBERSHIP_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index 46457abd..9f3d13f6 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Teams teams = Teams(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Teams teams = Teams(client); - Future result = teams.getPrefs( - teamId:'[TEAM_ID]' , - ); +Future result = teams.getPrefs( + teamId: '[TEAM_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index adec734d..2665b60a 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Teams teams = Teams(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Teams teams = Teams(client); - Future result = teams.get( - teamId:'[TEAM_ID]' , - ); +Future result = teams.get( + teamId: '[TEAM_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 709de974..19ff612b 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -1,23 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Teams teams = Teams(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Teams teams = Teams(client); - Future result = teams.listMemberships( - teamId:'[TEAM_ID]' , - ); +Future result = teams.listMemberships( + teamId: '[TEAM_ID]', + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index 9370bd92..b2f8f42c 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -1,22 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Teams teams = Teams(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Teams teams = Teams(client); - Future result = teams.list( - ); +Future result = teams.list( + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index 550679ca..184c3f91 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -1,26 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Teams teams = Teams(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Teams teams = Teams(client); - Future result = teams.updateMembershipStatus( - teamId:'[TEAM_ID]' , - membershipId:'[MEMBERSHIP_ID]' , - userId:'[USER_ID]' , - secret:'[SECRET]' , - ); +Future result = teams.updateMembershipStatus( + teamId: '[TEAM_ID]', + membershipId: '[MEMBERSHIP_ID]', + userId: '[USER_ID]', + secret: '[SECRET]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index 91b82d4c..883f4428 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -1,25 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Teams teams = Teams(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Teams teams = Teams(client); - Future result = teams.updateMembership( - teamId:'[TEAM_ID]' , - membershipId:'[MEMBERSHIP_ID]' , - roles:[] , - ); +Future result = teams.updateMembership( + teamId: '[TEAM_ID]', + membershipId: '[MEMBERSHIP_ID]', + roles: [], +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index 835d2c83..dfdab2a4 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Teams teams = Teams(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Teams teams = Teams(client); - Future result = teams.updateName( - teamId:'[TEAM_ID]' , - name:'[NAME]' , - ); +Future result = teams.updateName( + teamId: '[TEAM_ID]', + name: '[NAME]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index 2acaed5e..87ef5d10 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Teams teams = Teams(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession('') // The user session to authenticate with - ; +Teams teams = Teams(client); - Future result = teams.updatePrefs( - teamId:'[TEAM_ID]' , - prefs:{} , - ); +Future result = teams.updatePrefs( + teamId: '[TEAM_ID]', + prefs: {}, +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/create-argon2user.md b/docs/examples/users/create-argon2user.md index bb013e1a..96cfad67 100644 --- a/docs/examples/users/create-argon2user.md +++ b/docs/examples/users/create-argon2user.md @@ -1,25 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.createArgon2User( - userId:'[USER_ID]' , - email:'email@example.com' , - password:'password' , - ); +Future result = users.createArgon2User( + userId: '[USER_ID]', + email: 'email@example.com', + password: 'password', + name: '[NAME]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md index fc6f26d2..c0e23bdc 100644 --- a/docs/examples/users/create-bcrypt-user.md +++ b/docs/examples/users/create-bcrypt-user.md @@ -1,25 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.createBcryptUser( - userId:'[USER_ID]' , - email:'email@example.com' , - password:'password' , - ); +Future result = users.createBcryptUser( + userId: '[USER_ID]', + email: 'email@example.com', + password: 'password', + name: '[NAME]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/create-m-d5user.md b/docs/examples/users/create-m-d5user.md index 201dc9f6..a85f511f 100644 --- a/docs/examples/users/create-m-d5user.md +++ b/docs/examples/users/create-m-d5user.md @@ -1,25 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.createMD5User( - userId:'[USER_ID]' , - email:'email@example.com' , - password:'password' , - ); +Future result = users.createMD5User( + userId: '[USER_ID]', + email: 'email@example.com', + password: 'password', + name: '[NAME]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/create-p-h-pass-user.md b/docs/examples/users/create-p-h-pass-user.md index b6a52cd3..a3168218 100644 --- a/docs/examples/users/create-p-h-pass-user.md +++ b/docs/examples/users/create-p-h-pass-user.md @@ -1,25 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.createPHPassUser( - userId:'[USER_ID]' , - email:'email@example.com' , - password:'password' , - ); +Future result = users.createPHPassUser( + userId: '[USER_ID]', + email: 'email@example.com', + password: 'password', + name: '[NAME]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/create-s-h-a-user.md b/docs/examples/users/create-s-h-a-user.md index 9dcc1c6c..195cbb65 100644 --- a/docs/examples/users/create-s-h-a-user.md +++ b/docs/examples/users/create-s-h-a-user.md @@ -1,25 +1,22 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.createSHAUser( - userId:'[USER_ID]' , - email:'email@example.com' , - password:'password' , - ); +Future result = users.createSHAUser( + userId: '[USER_ID]', + email: 'email@example.com', + password: 'password', + passwordVersion: PasswordHash.sha1, // (optional) + name: '[NAME]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md index 1e007641..25d33845 100644 --- a/docs/examples/users/create-scrypt-modified-user.md +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -1,28 +1,24 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.createScryptModifiedUser( - userId:'[USER_ID]' , - email:'email@example.com' , - password:'password' , - passwordSalt:'[PASSWORD_SALT]' , - passwordSaltSeparator:'[PASSWORD_SALT_SEPARATOR]' , - passwordSignerKey:'[PASSWORD_SIGNER_KEY]' , - ); +Future result = users.createScryptModifiedUser( + userId: '[USER_ID]', + email: 'email@example.com', + password: 'password', + passwordSalt: '[PASSWORD_SALT]', + passwordSaltSeparator: '[PASSWORD_SALT_SEPARATOR]', + passwordSignerKey: '[PASSWORD_SIGNER_KEY]', + name: '[NAME]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index 2f58c7ca..58facd69 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -1,30 +1,26 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.createScryptUser( - userId:'[USER_ID]' , - email:'email@example.com' , - password:'password' , - passwordSalt:'[PASSWORD_SALT]' , - passwordCpu:0 , - passwordMemory:0 , - passwordParallel:0 , - passwordLength:0 , - ); +Future result = users.createScryptUser( + userId: '[USER_ID]', + email: 'email@example.com', + password: 'password', + passwordSalt: '[PASSWORD_SALT]', + passwordCpu: 0, + passwordMemory: 0, + passwordParallel: 0, + passwordLength: 0, + name: '[NAME]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md index ad791ae3..17677553 100644 --- a/docs/examples/users/create-session.md +++ b/docs/examples/users/create-session.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.createSession( - userId:'[USER_ID]' , - ); +Future result = users.createSession( + userId: '[USER_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md index 1bd30dd0..06b8c475 100644 --- a/docs/examples/users/create-target.md +++ b/docs/examples/users/create-target.md @@ -1,26 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.createTarget( - userId:'[USER_ID]' , - targetId:'[TARGET_ID]' , - providerType: MessagingProviderType.email, - identifier:'[IDENTIFIER]' , - ); +Future result = users.createTarget( + userId: '[USER_ID]', + targetId: '[TARGET_ID]', + providerType: MessagingProviderType.email, + identifier: '[IDENTIFIER]', + providerId: '[PROVIDER_ID]', // (optional) + name: '[NAME]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md index c832b6fe..a1a2fe84 100644 --- a/docs/examples/users/create-token.md +++ b/docs/examples/users/create-token.md @@ -1,23 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.createToken( - userId:'[USER_ID]' , - ); +Future result = users.createToken( + userId: '[USER_ID]', + length: 4, // (optional) + expire: 60, // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index 382ed190..a1ad5b09 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -1,23 +1,22 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.create( - userId:'[USER_ID]' , - ); +Future result = users.create( + userId: '[USER_ID]', + email: 'email@example.com', // (optional) + phone: '+12065550100', // (optional) + password: '', // (optional) + name: '[NAME]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/delete-authenticator.md b/docs/examples/users/delete-authenticator.md index 04b18e99..f24006ee 100644 --- a/docs/examples/users/delete-authenticator.md +++ b/docs/examples/users/delete-authenticator.md @@ -1,25 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.deleteAuthenticator( - userId:'[USER_ID]' , - type: AuthenticatorType.totp, - otp:'[OTP]' , - ); +Future result = users.deleteAuthenticator( + userId: '[USER_ID]', + type: AuthenticatorType.totp, + otp: '[OTP]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md index 3e276d2e..275e6ce0 100644 --- a/docs/examples/users/delete-identity.md +++ b/docs/examples/users/delete-identity.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.deleteIdentity( - identityId:'[IDENTITY_ID]' , - ); +Future result = users.deleteIdentity( + identityId: '[IDENTITY_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md index b916944f..a56d2d7c 100644 --- a/docs/examples/users/delete-session.md +++ b/docs/examples/users/delete-session.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.deleteSession( - userId:'[USER_ID]' , - sessionId:'[SESSION_ID]' , - ); +Future result = users.deleteSession( + userId: '[USER_ID]', + sessionId: '[SESSION_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md index 6b0d23e1..76602dc2 100644 --- a/docs/examples/users/delete-sessions.md +++ b/docs/examples/users/delete-sessions.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.deleteSessions( - userId:'[USER_ID]' , - ); +Future result = users.deleteSessions( + userId: '[USER_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md index 293f83f6..783b8cda 100644 --- a/docs/examples/users/delete-target.md +++ b/docs/examples/users/delete-target.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.deleteTarget( - userId:'[USER_ID]' , - targetId:'[TARGET_ID]' , - ); +Future result = users.deleteTarget( + userId: '[USER_ID]', + targetId: '[TARGET_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md index 32e3bbee..fbde5dce 100644 --- a/docs/examples/users/delete.md +++ b/docs/examples/users/delete.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.delete( - userId:'[USER_ID]' , - ); +Future result = users.delete( + userId: '[USER_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md index 5b325aa9..8ff31320 100644 --- a/docs/examples/users/get-prefs.md +++ b/docs/examples/users/get-prefs.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.getPrefs( - userId:'[USER_ID]' , - ); +Future result = users.getPrefs( + userId: '[USER_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md index 3ba2166a..04e6b01a 100644 --- a/docs/examples/users/get-target.md +++ b/docs/examples/users/get-target.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.getTarget( - userId:'[USER_ID]' , - targetId:'[TARGET_ID]' , - ); +Future result = users.getTarget( + userId: '[USER_ID]', + targetId: '[TARGET_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md index b1f6b2b3..29ef8e3a 100644 --- a/docs/examples/users/get.md +++ b/docs/examples/users/get.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.get( - userId:'[USER_ID]' , - ); +Future result = users.get( + userId: '[USER_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/list-factors.md b/docs/examples/users/list-factors.md index 339a01f5..af0d526a 100644 --- a/docs/examples/users/list-factors.md +++ b/docs/examples/users/list-factors.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.listFactors( - userId:'[USER_ID]' , - ); +Future result = users.listFactors( + userId: '[USER_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index 5d0dafb5..702d821c 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -1,22 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.listIdentities( - ); +Future result = users.listIdentities( + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index e0f18152..1864e270 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -1,23 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.listLogs( - userId:'[USER_ID]' , - ); +Future result = users.listLogs( + userId: '[USER_ID]', + queries: [], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index 294dab07..df23d429 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.listMemberships( - userId:'[USER_ID]' , - ); +Future result = users.listMemberships( + userId: '[USER_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index 74dfe67a..5c76fc06 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -1,23 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.listSessions( - userId:'[USER_ID]' , - ); +Future result = users.listSessions( + userId: '[USER_ID]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md index e394846b..2cc05fdf 100644 --- a/docs/examples/users/list-targets.md +++ b/docs/examples/users/list-targets.md @@ -1,23 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.listTargets( - userId:'[USER_ID]' , - ); +Future result = users.listTargets( + userId: '[USER_ID]', + queries: [], // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 5d947f9e..6583d456 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -1,22 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.list( - ); +Future result = users.list( + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md index 21a9a450..b91ce512 100644 --- a/docs/examples/users/update-email-verification.md +++ b/docs/examples/users/update-email-verification.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.updateEmailVerification( - userId:'[USER_ID]' , - emailVerification:false , - ); +Future result = users.updateEmailVerification( + userId: '[USER_ID]', + emailVerification: false, +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md index 0cab9402..aee6fead 100644 --- a/docs/examples/users/update-email.md +++ b/docs/examples/users/update-email.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.updateEmail( - userId:'[USER_ID]' , - email:'email@example.com' , - ); +Future result = users.updateEmail( + userId: '[USER_ID]', + email: 'email@example.com', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md index 467ad388..d6736ceb 100644 --- a/docs/examples/users/update-labels.md +++ b/docs/examples/users/update-labels.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.updateLabels( - userId:'[USER_ID]' , - labels:[] , - ); +Future result = users.updateLabels( + userId: '[USER_ID]', + labels: [], +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md index 01bab89a..9b00eee4 100644 --- a/docs/examples/users/update-mfa.md +++ b/docs/examples/users/update-mfa.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.updateMfa( - userId:'[USER_ID]' , - mfa:false , - ); +Future result = users.updateMfa( + userId: '[USER_ID]', + mfa: false, +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md index 91bb04b3..4c3b4a90 100644 --- a/docs/examples/users/update-name.md +++ b/docs/examples/users/update-name.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.updateName( - userId:'[USER_ID]' , - name:'[NAME]' , - ); +Future result = users.updateName( + userId: '[USER_ID]', + name: '[NAME]', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index d7d24d9b..79beeb29 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.updatePassword( - userId:'[USER_ID]' , - password:'' , - ); +Future result = users.updatePassword( + userId: '[USER_ID]', + password: '', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md index 7c4d57a2..faa28a07 100644 --- a/docs/examples/users/update-phone-verification.md +++ b/docs/examples/users/update-phone-verification.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.updatePhoneVerification( - userId:'[USER_ID]' , - phoneVerification:false , - ); +Future result = users.updatePhoneVerification( + userId: '[USER_ID]', + phoneVerification: false, +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md index adad1c95..d380909c 100644 --- a/docs/examples/users/update-phone.md +++ b/docs/examples/users/update-phone.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.updatePhone( - userId:'[USER_ID]' , - number:'+12065550100' , - ); +Future result = users.updatePhone( + userId: '[USER_ID]', + number: '+12065550100', +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md index f5fadbc7..adba3539 100644 --- a/docs/examples/users/update-prefs.md +++ b/docs/examples/users/update-prefs.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.updatePrefs( - userId:'[USER_ID]' , - prefs:{} , - ); +Future result = users.updatePrefs( + userId: '[USER_ID]', + prefs: {}, +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md index dacac6f4..65e870fe 100644 --- a/docs/examples/users/update-status.md +++ b/docs/examples/users/update-status.md @@ -1,24 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.updateStatus( - userId:'[USER_ID]' , - status:false , - ); +Future result = users.updateStatus( + userId: '[USER_ID]', + status: false, +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md index 64a3effc..117c8bd6 100644 --- a/docs/examples/users/update-target.md +++ b/docs/examples/users/update-target.md @@ -1,24 +1,22 @@ import 'package:dart_appwrite/dart_appwrite.dart'; -void main() { // Init SDK - Client client = Client(); - Users users = Users(client); +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - ; +Users users = Users(client); - Future result = users.updateTarget( - userId:'[USER_ID]' , - targetId:'[TARGET_ID]' , - ); +Future result = users.updateTarget( + userId: '[USER_ID]', + targetId: '[TARGET_ID]', + identifier: '[IDENTIFIER]', // (optional) + providerId: '[PROVIDER_ID]', // (optional) + name: '[NAME]', // (optional) +); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -}} \ No newline at end of file +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/lib/dart_appwrite.dart b/lib/dart_appwrite.dart index 8c88df56..7e9498a1 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.4.x. +/// This SDK is compatible with Appwrite server version 1.5.x. /// For older versions, please check /// [previous releases](https://github.com/appwrite/sdk-for-dart/releases). library dart_appwrite; diff --git a/lib/enums.dart b/lib/enums.dart index 5c06f8a5..72874ca1 100644 --- a/lib/enums.dart +++ b/lib/enums.dart @@ -14,7 +14,7 @@ part 'src/enums/runtime.dart'; part 'src/enums/execution_method.dart'; part 'src/enums/name.dart'; part 'src/enums/message_status.dart'; -part 'src/enums/smtp_encryption.dart'; +part 'src/enums/encryption.dart'; part 'src/enums/compression.dart'; part 'src/enums/image_gravity.dart'; part 'src/enums/image_format.dart'; diff --git a/lib/services/account.dart b/lib/services/account.dart index 8ce052c7..fc887e87 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -275,7 +275,7 @@ class Account extends Service { /// Add Authenticator /// Future addAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type); + final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type.value); final Map apiParams = { @@ -296,7 +296,7 @@ class Account extends Service { /// Verify Authenticator /// Future verifyAuthenticator({required enums.AuthenticatorType type, required String otp}) async { - final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type); + final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type.value); final Map apiParams = { @@ -318,7 +318,7 @@ class Account extends Service { /// Delete Authenticator /// Future deleteAuthenticator({required enums.AuthenticatorType type, required String otp}) async { - final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type); + final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type.value); final Map apiParams = { @@ -674,7 +674,7 @@ class Account extends Service { /// limits](https://appwrite.io/docs/authentication-security#limits). /// Future createOAuth2Session({required enums.OAuthProvider provider, String? success, String? failure, bool? token, List? scopes}) async { - final String apiPath = '/account/sessions/oauth2/{provider}'.replaceAll('{provider}', provider); + final String apiPath = '/account/sessions/oauth2/{provider}'.replaceAll('{provider}', provider.value); final Map apiParams = { 'success': success, diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index a9a5881d..f3f3a95b 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -18,7 +18,7 @@ class Avatars extends Service { /// 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); + final String apiPath = '/avatars/browsers/{code}'.replaceAll('{code}', code.value); final Map params = { 'width': width, @@ -46,7 +46,7 @@ class Avatars extends Service { /// 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); + final String apiPath = '/avatars/credit-cards/{code}'.replaceAll('{code}', code.value); final Map params = { 'width': width, @@ -95,7 +95,7 @@ class Avatars extends Service { /// 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); + final String apiPath = '/avatars/flags/{code}'.replaceAll('{code}', code.value); final Map params = { 'width': width, diff --git a/lib/services/health.dart b/lib/services/health.dart index b1c6cdf6..59eaac60 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -265,7 +265,7 @@ class Health extends Service { /// 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); + final String apiPath = '/health/queue/failed/{name}'.replaceAll('{name}', name.value); final Map apiParams = { 'threshold': threshold, diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 359e1ca1..4fee4bde 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -7,6 +7,7 @@ class Messaging extends Service { /// List messages /// + /// Get a list of all messages from the current Appwrite project. Future listMessages({List? queries, String? search}) async { final String apiPath = '/messaging/messages'; @@ -28,9 +29,10 @@ class Messaging extends Service { } - /// Create an email. + /// Create an email /// - Future createEmail({required String messageId, required String subject, required String content, List? topics, List? users, List? targets, List? cc, List? bcc, enums.MessageStatus? status, bool? html, String? scheduledAt}) async { + /// 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, enums.MessageStatus? status, bool? html, String? scheduledAt}) async { final String apiPath = '/messaging/messages/email'; final Map apiParams = { @@ -43,6 +45,7 @@ class Messaging extends Service { 'targets': targets, 'cc': cc, 'bcc': bcc, +'attachments': attachments, 'status': status, 'html': html, 'scheduledAt': scheduledAt, @@ -60,8 +63,10 @@ class Messaging extends Service { } - /// Update an email. + /// Update an email /// + /// Update an email message by its unique ID. + /// Future updateEmail({required String messageId, List? topics, List? users, List? targets, String? subject, String? content, enums.MessageStatus? status, bool? html, List? cc, List? bcc, String? scheduledAt}) async { final String apiPath = '/messaging/messages/email/{messageId}'.replaceAll('{messageId}', messageId); @@ -91,9 +96,10 @@ class Messaging extends Service { } - /// Create a push notification. + /// Create a push notification /// - Future createPush({required String messageId, required String title, required String body, List? topics, List? users, List? targets, Map? data, String? action, String? icon, String? sound, String? color, String? tag, String? badge, enums.MessageStatus? status, String? scheduledAt}) async { + /// Create a new push notification. + Future createPush({required String messageId, required String title, required String body, List? topics, List? users, List? targets, Map? data, String? action, String? image, String? icon, String? sound, String? color, String? tag, String? badge, enums.MessageStatus? status, String? scheduledAt}) async { final String apiPath = '/messaging/messages/push'; final Map apiParams = { @@ -106,6 +112,7 @@ class Messaging extends Service { 'targets': targets, 'data': data, 'action': action, +'image': image, 'icon': icon, 'sound': sound, 'color': color, @@ -127,9 +134,11 @@ class Messaging extends Service { } - /// Update a push notification. + /// Update a push notification /// - Future updatePush({required String messageId, List? topics, List? users, List? targets, String? title, String? body, Map? data, String? action, String? icon, String? sound, String? color, String? tag, int? badge, enums.MessageStatus? status, String? scheduledAt}) async { + /// Update a push notification by its unique ID. + /// + 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, enums.MessageStatus? status, String? scheduledAt}) async { final String apiPath = '/messaging/messages/push/{messageId}'.replaceAll('{messageId}', messageId); final Map apiParams = { @@ -141,6 +150,7 @@ class Messaging extends Service { 'body': body, 'data': data, 'action': action, +'image': image, 'icon': icon, 'sound': sound, 'color': color, @@ -162,9 +172,10 @@ class Messaging extends Service { } - /// Create an SMS. + /// Create an SMS /// - Future createSMS({required String messageId, required String content, List? topics, List? users, List? targets, enums.MessageStatus? status, String? scheduledAt}) async { + /// Create a new SMS message. + Future createSms({required String messageId, required String content, List? topics, List? users, List? targets, enums.MessageStatus? status, String? scheduledAt}) async { final String apiPath = '/messaging/messages/sms'; final Map apiParams = { @@ -190,9 +201,11 @@ class Messaging extends Service { } - /// Update an SMS. + /// Update an SMS /// - Future updateSMS({required String messageId, List? topics, List? users, List? targets, String? content, enums.MessageStatus? status, String? scheduledAt}) async { + /// Update an email message by its unique ID. + /// + Future updateSms({required String messageId, List? topics, List? users, List? targets, String? content, enums.MessageStatus? status, String? scheduledAt}) async { final String apiPath = '/messaging/messages/sms/{messageId}'.replaceAll('{messageId}', messageId); final Map apiParams = { @@ -219,6 +232,8 @@ class Messaging extends Service { /// Get a message /// + /// Get a message by its unique ID. + /// Future getMessage({required String messageId}) async { final String apiPath = '/messaging/messages/{messageId}'.replaceAll('{messageId}', messageId); @@ -261,6 +276,7 @@ class Messaging extends Service { /// List message logs /// + /// 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); @@ -283,8 +299,7 @@ class Messaging extends Service { /// List message targets /// - /// List the targets associated with a message as set via the targets - /// attribute. + /// 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); @@ -307,6 +322,7 @@ class Messaging extends Service { /// List providers /// + /// Get a list of all providers from the current Appwrite project. Future listProviders({List? queries, String? search}) async { final String apiPath = '/messaging/providers'; @@ -330,7 +346,8 @@ class Messaging extends Service { /// Create APNS provider /// - Future createAPNSProvider({required String providerId, required String name, String? authKey, String? authKeyId, String? teamId, String? bundleId, bool? enabled}) async { + /// 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? enabled}) async { final String apiPath = '/messaging/providers/apns'; final Map apiParams = { @@ -358,6 +375,7 @@ class Messaging extends Service { /// Update APNS provider /// + /// 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}) async { final String apiPath = '/messaging/providers/apns/{providerId}'.replaceAll('{providerId}', providerId); @@ -385,7 +403,8 @@ class Messaging extends Service { /// Create FCM provider /// - Future createFCMProvider({required String providerId, required String name, Map? serviceAccountJSON, bool? enabled}) async { + /// 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 = { @@ -410,6 +429,7 @@ class Messaging extends Service { /// Update FCM provider /// + /// 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); @@ -434,6 +454,7 @@ class Messaging extends Service { /// Create Mailgun provider /// + /// 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'; @@ -465,6 +486,7 @@ class Messaging extends Service { /// Update Mailgun provider /// + /// 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); @@ -495,6 +517,7 @@ class Messaging extends Service { /// Create Msg91 provider /// + /// Create a new MSG91 provider. Future createMsg91Provider({required String providerId, required String name, String? from, String? senderId, String? authKey, bool? enabled}) async { final String apiPath = '/messaging/providers/msg91'; @@ -522,6 +545,7 @@ class Messaging extends Service { /// Update Msg91 provider /// + /// Update a MSG91 provider by its unique ID. Future updateMsg91Provider({required String providerId, String? name, bool? enabled, String? senderId, String? authKey, String? from}) async { final String apiPath = '/messaging/providers/msg91/{providerId}'.replaceAll('{providerId}', providerId); @@ -577,6 +601,7 @@ class Messaging extends Service { /// Update Sendgrid provider /// + /// 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); @@ -605,7 +630,8 @@ class Messaging extends Service { /// Create 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 { + /// Create a new SMTP provider. + Future createSmtpProvider({required String providerId, required String name, required String host, int? port, String? username, String? password, enums.Encryption? 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 = { @@ -640,7 +666,8 @@ class Messaging extends Service { /// Update SMTP provider /// - 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 { + /// Update a SMTP provider by its unique ID. + Future updateSmtpProvider({required String providerId, String? name, String? host, int? port, String? username, String? password, enums.Encryption? 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 = { @@ -674,6 +701,7 @@ class Messaging extends Service { /// Create Telesign provider /// + /// 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'; @@ -701,6 +729,7 @@ class Messaging extends Service { /// Update Telesign provider /// + /// 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); @@ -727,6 +756,7 @@ class Messaging extends Service { /// Create Textmagic provider /// + /// 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'; @@ -754,6 +784,7 @@ class Messaging extends Service { /// Update Textmagic provider /// + /// 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); @@ -780,6 +811,7 @@ class Messaging extends Service { /// Create Twilio provider /// + /// 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'; @@ -807,6 +839,7 @@ class Messaging extends Service { /// Update Twilio provider /// + /// 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); @@ -833,6 +866,7 @@ class Messaging extends Service { /// Create Vonage provider /// + /// 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'; @@ -860,6 +894,7 @@ class Messaging extends Service { /// Update Vonage provider /// + /// 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); @@ -886,6 +921,8 @@ class Messaging extends Service { /// Get provider /// + /// Get a provider by its unique ID. + /// Future getProvider({required String providerId}) async { final String apiPath = '/messaging/providers/{providerId}'.replaceAll('{providerId}', providerId); @@ -907,6 +944,7 @@ class Messaging extends Service { /// Delete provider /// + /// Delete a provider by its unique ID. Future deleteProvider({required String providerId}) async { final String apiPath = '/messaging/providers/{providerId}'.replaceAll('{providerId}', providerId); @@ -928,6 +966,7 @@ class Messaging extends Service { /// List provider logs /// + /// 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); @@ -950,6 +989,7 @@ class Messaging extends Service { /// List subscriber logs /// + /// 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); @@ -970,8 +1010,9 @@ class Messaging extends Service { } - /// List topics. + /// List topics /// + /// Get a list of all topics from the current Appwrite project. Future listTopics({List? queries, String? search}) async { final String apiPath = '/messaging/topics'; @@ -993,8 +1034,9 @@ class Messaging extends Service { } - /// Create a topic. + /// Create a topic /// + /// Create a new topic. Future createTopic({required String topicId, required String name, List? subscribe}) async { final String apiPath = '/messaging/topics'; @@ -1017,8 +1059,10 @@ class Messaging extends Service { } - /// Get a topic. + /// Get a topic /// + /// Get a topic by its unique ID. + /// Future getTopic({required String topicId}) async { final String apiPath = '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); @@ -1038,8 +1082,10 @@ class Messaging extends Service { } - /// Update a topic. + /// Update a topic /// + /// Update a topic by its unique ID. + /// Future updateTopic({required String topicId, String? name}) async { final String apiPath = '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); @@ -1060,8 +1106,9 @@ class Messaging extends Service { } - /// Delete a topic. + /// Delete a topic /// + /// Delete a topic by its unique ID. Future deleteTopic({required String topicId}) async { final String apiPath = '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); @@ -1083,6 +1130,7 @@ class Messaging extends Service { /// List topic logs /// + /// 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); @@ -1103,8 +1151,9 @@ class Messaging extends Service { } - /// List subscribers. + /// List subscribers /// + /// 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); @@ -1126,8 +1175,9 @@ class Messaging extends Service { } - /// Create a subscriber. + /// Create a subscriber /// + /// 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); @@ -1149,8 +1199,10 @@ class Messaging extends Service { } - /// Get a subscriber. + /// Get a subscriber /// + /// 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); @@ -1170,8 +1222,9 @@ class Messaging extends Service { } - /// Delete a subscriber. + /// Delete a subscriber /// + /// 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); diff --git a/lib/services/users.dart b/lib/services/users.dart index e2e00a22..5c3a6fa4 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -506,7 +506,7 @@ class Users extends Service { /// Delete Authenticator /// Future deleteAuthenticator({required String userId, required enums.AuthenticatorType type, required String otp}) async { - final String apiPath = '/users/{userId}/mfa/{type}'.replaceAll('{userId}', userId).replaceAll('{type}', type); + final String apiPath = '/users/{userId}/mfa/{type}'.replaceAll('{userId}', userId).replaceAll('{type}', type.value); final Map apiParams = { diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index 1de049cd..699f7718 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -33,7 +33,7 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '11.0.0-rc.3', + 'x-sdk-version': '11.0.0-rc.4', 'X-Appwrite-Response-Format' : '1.5.0', }; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 3e5eea31..e0f31f8a 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -42,8 +42,8 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '11.0.0-rc.3', - 'user-agent' : 'AppwriteDartSDK/11.0.0-rc.3 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'x-sdk-version': '11.0.0-rc.4', + 'user-agent' : 'AppwriteDartSDK/11.0.0-rc.4 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', 'X-Appwrite-Response-Format' : '1.5.0', }; diff --git a/lib/src/enums/smtp_encryption.dart b/lib/src/enums/encryption.dart similarity index 79% rename from lib/src/enums/smtp_encryption.dart rename to lib/src/enums/encryption.dart index b86387e5..17ccf9b7 100644 --- a/lib/src/enums/smtp_encryption.dart +++ b/lib/src/enums/encryption.dart @@ -1,11 +1,11 @@ part of dart_appwrite.enums; -enum SMTPEncryption { +enum Encryption { none(value: 'none'), ssl(value: 'ssl'), tls(value: 'tls'); - const SMTPEncryption({ + const Encryption({ required this.value }); diff --git a/lib/src/enums/runtime.dart b/lib/src/enums/runtime.dart index 4a39a081..45c09443 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,10 +1,42 @@ part of dart_appwrite.enums; 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'), php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + ruby30(value: 'ruby-3.0'), ruby31(value: 'ruby-3.1'), - python39(value: 'python-3.9'); + ruby32(value: 'ruby-3.2'), + 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'), + dart215(value: 'dart-2.15'), + dart216(value: 'dart-2.16'), + dart217(value: 'dart-2.17'), + dart218(value: 'dart-2.18'), + dart30(value: 'dart-3.0'), + dart31(value: 'dart-3.1'), + dotnet31(value: 'dotnet-3.1'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + java80(value: 'java-8.0'), + java110(value: 'java-11.0'), + java170(value: 'java-17.0'), + java180(value: 'java-18.0'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'); const Runtime({ required this.value diff --git a/pubspec.yaml b/pubspec.yaml index 7134e5b7..588b0b79 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: dart_appwrite -version: 11.0.0-rc.3 +version: 11.0.0-rc.4 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 diff --git a/test/services/functions_test.dart b/test/services/functions_test.dart index c38d0682..119db32b 100644 --- a/test/services/functions_test.dart +++ b/test/services/functions_test.dart @@ -105,7 +105,7 @@ void main() { final response = await functions.create( functionId: '[FUNCTION_ID]', name: '[NAME]', - runtime: 'node-18.0', + runtime: 'node-14.5', ); expect(response, isA()); diff --git a/test/services/messaging_test.dart b/test/services/messaging_test.dart index 0062c2ad..a985baae 100644 --- a/test/services/messaging_test.dart +++ b/test/services/messaging_test.dart @@ -179,7 +179,7 @@ void main() { }); - test('test method createSMS()', () async { + test('test method createSms()', () async { final Map data = { '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', @@ -198,7 +198,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await messaging.createSMS( + final response = await messaging.createSms( messageId: '[MESSAGE_ID]', content: '[CONTENT]', ); @@ -206,7 +206,7 @@ void main() { }); - test('test method updateSMS()', () async { + test('test method updateSms()', () async { final Map data = { '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', @@ -225,7 +225,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await messaging.updateSMS( + final response = await messaging.updateSms( messageId: '[MESSAGE_ID]', ); expect(response, isA()); @@ -324,7 +324,7 @@ void main() { }); - test('test method createAPNSProvider()', () async { + test('test method createApnsProvider()', () async { final Map data = { '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', @@ -341,7 +341,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await messaging.createAPNSProvider( + final response = await messaging.createApnsProvider( providerId: '[PROVIDER_ID]', name: '[NAME]', ); @@ -373,7 +373,7 @@ void main() { }); - test('test method createFCMProvider()', () async { + test('test method createFcmProvider()', () async { final Map data = { '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', @@ -390,7 +390,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await messaging.createFCMProvider( + final response = await messaging.createFcmProvider( providerId: '[PROVIDER_ID]', name: '[NAME]', ); @@ -569,7 +569,7 @@ void main() { }); - test('test method createSMTPProvider()', () async { + test('test method createSmtpProvider()', () async { final Map data = { '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', @@ -586,7 +586,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await messaging.createSMTPProvider( + final response = await messaging.createSmtpProvider( providerId: '[PROVIDER_ID]', name: '[NAME]', host: '[HOST]', @@ -595,7 +595,7 @@ void main() { }); - test('test method updateSMTPProvider()', () async { + test('test method updateSmtpProvider()', () async { final Map data = { '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', @@ -612,7 +612,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await messaging.updateSMTPProvider( + final response = await messaging.updateSmtpProvider( providerId: '[PROVIDER_ID]', ); expect(response, isA()); From 9fc8f44039c0bbdf20fae77420372b67422f6333 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Sun, 25 Feb 2024 00:31:55 +1300 Subject: [PATCH 4/7] Release candidate for 1.5.x --- README.md | 6 +- ...e2f-a-challenge.md => create-challenge.md} | 2 +- docs/examples/account/create-email-token.md | 2 +- .../account/create-magic-u-r-l-token.md | 2 +- .../examples/account/create-o-auth2session.md | 1 - docs/examples/account/create-o-auth2token.md | 20 ++ docs/examples/account/create-phone-token.md | 2 +- docs/examples/account/create-session.md | 4 +- docs/examples/account/create.md | 4 +- docs/examples/account/delete-authenticator.md | 2 +- docs/examples/account/delete-identity.md | 2 +- docs/examples/account/delete-session.md | 2 +- docs/examples/account/get-session.md | 2 +- docs/examples/account/update-challenge.md | 4 +- .../account/update-magic-u-r-l-session.md | 4 +- docs/examples/account/update-name.md | 2 +- .../account/update-phone-verification.md | 4 +- docs/examples/account/update-recovery.md | 4 +- docs/examples/account/update-session.md | 2 +- docs/examples/account/update-verification.md | 4 +- docs/examples/account/verify-authenticator.md | 2 +- docs/examples/avatars/get-initials.md | 2 +- docs/examples/avatars/get-q-r.md | 2 +- .../databases/create-boolean-attribute.md | 4 +- docs/examples/databases/create-collection.md | 6 +- .../databases/create-datetime-attribute.md | 4 +- docs/examples/databases/create-document.md | 6 +- .../databases/create-email-attribute.md | 4 +- .../databases/create-enum-attribute.md | 6 +- .../databases/create-float-attribute.md | 4 +- docs/examples/databases/create-index.md | 4 +- .../databases/create-integer-attribute.md | 4 +- .../examples/databases/create-ip-attribute.md | 4 +- .../create-relationship-attribute.md | 6 +- .../databases/create-string-attribute.md | 6 +- .../databases/create-url-attribute.md | 4 +- docs/examples/databases/create.md | 4 +- docs/examples/databases/delete-attribute.md | 4 +- docs/examples/databases/delete-collection.md | 4 +- docs/examples/databases/delete-document.md | 6 +- docs/examples/databases/delete-index.md | 4 +- docs/examples/databases/delete.md | 2 +- docs/examples/databases/get-attribute.md | 4 +- docs/examples/databases/get-collection.md | 4 +- docs/examples/databases/get-document.md | 6 +- docs/examples/databases/get-index.md | 4 +- docs/examples/databases/get.md | 2 +- docs/examples/databases/list-attributes.md | 4 +- docs/examples/databases/list-collections.md | 4 +- docs/examples/databases/list-documents.md | 4 +- docs/examples/databases/list-indexes.md | 4 +- docs/examples/databases/list.md | 2 +- .../databases/update-boolean-attribute.md | 4 +- docs/examples/databases/update-collection.md | 6 +- .../databases/update-datetime-attribute.md | 4 +- docs/examples/databases/update-document.md | 6 +- .../databases/update-email-attribute.md | 4 +- .../databases/update-enum-attribute.md | 6 +- .../databases/update-float-attribute.md | 4 +- .../databases/update-integer-attribute.md | 4 +- .../examples/databases/update-ip-attribute.md | 4 +- .../update-relationship-attribute.md | 4 +- .../databases/update-string-attribute.md | 6 +- .../databases/update-url-attribute.md | 4 +- docs/examples/databases/update.md | 4 +- docs/examples/functions/create-build.md | 6 +- docs/examples/functions/create-deployment.md | 6 +- docs/examples/functions/create-execution.md | 6 +- docs/examples/functions/create-variable.md | 6 +- docs/examples/functions/create.md | 24 +-- docs/examples/functions/delete-deployment.md | 4 +- docs/examples/functions/delete-variable.md | 4 +- docs/examples/functions/delete.md | 2 +- .../examples/functions/download-deployment.md | 4 +- docs/examples/functions/get-deployment.md | 4 +- docs/examples/functions/get-execution.md | 4 +- docs/examples/functions/get-variable.md | 4 +- docs/examples/functions/get.md | 2 +- docs/examples/functions/list-deployments.md | 4 +- docs/examples/functions/list-executions.md | 4 +- docs/examples/functions/list-variables.md | 2 +- docs/examples/functions/list.md | 2 +- docs/examples/functions/update-deployment.md | 4 +- docs/examples/functions/update-variable.md | 8 +- docs/examples/functions/update.md | 16 +- docs/examples/health/get-queue-databases.md | 2 +- .../messaging/create-apns-provider.md | 13 +- docs/examples/messaging/create-email.md | 6 +- .../examples/messaging/create-fcm-provider.md | 4 +- .../messaging/create-mailgun-provider.md | 12 +- .../messaging/create-msg91provider.md | 8 +- docs/examples/messaging/create-push.md | 18 +- .../messaging/create-sendgrid-provider.md | 10 +- docs/examples/messaging/create-sms.md | 4 +- .../messaging/create-smtp-provider.md | 18 +- docs/examples/messaging/create-subscriber.md | 6 +- .../messaging/create-telesign-provider.md | 8 +- .../messaging/create-textmagic-provider.md | 8 +- docs/examples/messaging/create-topic.md | 4 +- .../messaging/create-twilio-provider.md | 8 +- .../messaging/create-vonage-provider.md | 8 +- docs/examples/messaging/delete-provider.md | 2 +- docs/examples/messaging/delete-subscriber.md | 4 +- docs/examples/messaging/delete-topic.md | 2 +- docs/examples/messaging/delete.md | 2 +- docs/examples/messaging/get-message.md | 2 +- docs/examples/messaging/get-provider.md | 2 +- docs/examples/messaging/get-subscriber.md | 4 +- docs/examples/messaging/get-topic.md | 2 +- docs/examples/messaging/list-message-logs.md | 2 +- docs/examples/messaging/list-messages.md | 2 +- docs/examples/messaging/list-provider-logs.md | 2 +- docs/examples/messaging/list-providers.md | 2 +- .../messaging/list-subscriber-logs.md | 2 +- docs/examples/messaging/list-subscribers.md | 4 +- docs/examples/messaging/list-targets.md | 2 +- docs/examples/messaging/list-topic-logs.md | 2 +- docs/examples/messaging/list-topics.md | 2 +- ...-s-provider.md => update-apns-provider.md} | 15 +- docs/examples/messaging/update-email.md | 6 +- ...c-m-provider.md => update-fcm-provider.md} | 6 +- .../messaging/update-mailgun-provider.md | 14 +- .../messaging/update-msg91provider.md | 10 +- docs/examples/messaging/update-push.md | 16 +- .../messaging/update-sendgrid-provider.md | 12 +- docs/examples/messaging/update-sms.md | 4 +- .../messaging/update-smtp-provider.md | 20 +- .../messaging/update-telesign-provider.md | 10 +- .../messaging/update-textmagic-provider.md | 10 +- docs/examples/messaging/update-topic.md | 5 +- .../messaging/update-twilio-provider.md | 10 +- .../messaging/update-vonage-provider.md | 10 +- docs/examples/storage/create-bucket.md | 4 +- docs/examples/storage/create-file.md | 4 +- docs/examples/storage/delete-bucket.md | 2 +- docs/examples/storage/delete-file.md | 4 +- docs/examples/storage/get-bucket.md | 2 +- docs/examples/storage/get-file-download.md | 4 +- docs/examples/storage/get-file-preview.md | 4 +- docs/examples/storage/get-file-view.md | 4 +- docs/examples/storage/get-file.md | 4 +- docs/examples/storage/list-buckets.md | 2 +- docs/examples/storage/list-files.md | 4 +- docs/examples/storage/update-bucket.md | 4 +- docs/examples/storage/update-file.md | 6 +- docs/examples/teams/create-membership.md | 6 +- docs/examples/teams/create.md | 4 +- docs/examples/teams/delete-membership.md | 4 +- docs/examples/teams/delete.md | 2 +- docs/examples/teams/get-membership.md | 4 +- docs/examples/teams/get-prefs.md | 2 +- docs/examples/teams/get.md | 2 +- docs/examples/teams/list-memberships.md | 4 +- docs/examples/teams/list.md | 2 +- .../teams/update-membership-status.md | 8 +- docs/examples/teams/update-membership.md | 4 +- docs/examples/teams/update-name.md | 4 +- docs/examples/teams/update-prefs.md | 2 +- docs/examples/users/create-argon2user.md | 4 +- docs/examples/users/create-bcrypt-user.md | 4 +- docs/examples/users/create-m-d5user.md | 4 +- docs/examples/users/create-p-h-pass-user.md | 4 +- docs/examples/users/create-s-h-a-user.md | 4 +- .../users/create-scrypt-modified-user.md | 10 +- docs/examples/users/create-scrypt-user.md | 6 +- docs/examples/users/create-session.md | 2 +- docs/examples/users/create-target.md | 10 +- docs/examples/users/create-token.md | 2 +- docs/examples/users/create.md | 4 +- docs/examples/users/delete-authenticator.md | 4 +- docs/examples/users/delete-identity.md | 2 +- docs/examples/users/delete-session.md | 4 +- docs/examples/users/delete-sessions.md | 2 +- docs/examples/users/delete-target.md | 4 +- docs/examples/users/delete.md | 2 +- docs/examples/users/get-prefs.md | 2 +- docs/examples/users/get-target.md | 4 +- docs/examples/users/get.md | 2 +- docs/examples/users/list-factors.md | 2 +- docs/examples/users/list-identities.md | 2 +- docs/examples/users/list-logs.md | 2 +- docs/examples/users/list-memberships.md | 2 +- docs/examples/users/list-sessions.md | 2 +- docs/examples/users/list-targets.md | 2 +- docs/examples/users/list.md | 2 +- .../users/update-email-verification.md | 2 +- docs/examples/users/update-email.md | 2 +- docs/examples/users/update-labels.md | 2 +- docs/examples/users/update-mfa.md | 2 +- docs/examples/users/update-name.md | 4 +- docs/examples/users/update-password.md | 2 +- .../users/update-phone-verification.md | 2 +- docs/examples/users/update-phone.md | 2 +- docs/examples/users/update-prefs.md | 2 +- docs/examples/users/update-status.md | 2 +- docs/examples/users/update-target.md | 10 +- example/README.md | 10 +- lib/enums.dart | 2 +- lib/services/account.dart | 93 +++++++-- lib/services/messaging.dart | 15 +- lib/src/client.dart | 8 +- lib/src/client_base.dart | 3 - lib/src/client_browser.dart | 17 +- lib/src/client_io.dart | 19 +- .../{encryption.dart => smtp_encryption.dart} | 4 +- pubspec.yaml | 2 +- test/services/account_test.dart | 62 +++--- test/services/avatars_test.dart | 2 +- test/services/databases_test.dart | 176 +++++++++--------- test/services/functions_test.dart | 68 +++---- test/services/messaging_test.dart | 136 +++++++------- test/services/storage_test.dart | 42 ++--- test/services/teams_test.dart | 40 ++-- test/services/users_test.dart | 96 +++++----- 214 files changed, 911 insertions(+), 812 deletions(-) rename docs/examples/account/{create2f-a-challenge.md => create-challenge.md} (89%) create mode 100644 docs/examples/account/create-o-auth2token.md rename docs/examples/messaging/{update-a-p-n-s-provider.md => update-apns-provider.md} (59%) rename docs/examples/messaging/{update-f-c-m-provider.md => update-fcm-provider.md} (81%) rename lib/src/enums/{encryption.dart => smtp_encryption.dart} (79%) diff --git a/README.md b/README.md index 7c01857b..7a4c8f61 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - dart_appwrite: ^11.0.0-rc.4 + dart_appwrite: ^11.0.0-rc.5 ``` You can install packages from the command line: @@ -51,7 +51,7 @@ void main() async { Users users = Users(client); try { - final user = await users.create(userId: ID.unique(), email: ‘email@example.com’,password: ‘password’, name: ‘name’); + 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); @@ -66,7 +66,7 @@ The Appwrite Dart SDK raises `AppwriteException` object with `message`, `code` a Users users = Users(client); try { - final user = await users.create(userId: ID.unique(), email: ‘email@example.com’,password: ‘password’, name: ‘name’); + 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) { //show message to user or do other operation based on error as required diff --git a/docs/examples/account/create2f-a-challenge.md b/docs/examples/account/create-challenge.md similarity index 89% rename from docs/examples/account/create2f-a-challenge.md rename to docs/examples/account/create-challenge.md index 049a3e43..953bb93b 100644 --- a/docs/examples/account/create2f-a-challenge.md +++ b/docs/examples/account/create-challenge.md @@ -6,7 +6,7 @@ Client client = Client() Account account = Account(client); -Future result = account.create2FAChallenge( +Future result = account.createChallenge( factor: AuthenticationFactor.totp, ); diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index 48e8bcd4..7c1e45f1 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -7,7 +7,7 @@ Client client = Client() Account account = Account(client); Future result = account.createEmailToken( - userId: '[USER_ID]', + userId: '', email: 'email@example.com', phrase: false, // (optional) ); diff --git a/docs/examples/account/create-magic-u-r-l-token.md b/docs/examples/account/create-magic-u-r-l-token.md index dbd6ad2e..7dcda1fd 100644 --- a/docs/examples/account/create-magic-u-r-l-token.md +++ b/docs/examples/account/create-magic-u-r-l-token.md @@ -7,7 +7,7 @@ Client client = Client() Account account = Account(client); Future result = account.createMagicURLToken( - userId: '[USER_ID]', + userId: '', email: 'email@example.com', url: 'https://example.com', // (optional) phrase: false, // (optional) diff --git a/docs/examples/account/create-o-auth2session.md b/docs/examples/account/create-o-auth2session.md index 6f930723..993733ca 100644 --- a/docs/examples/account/create-o-auth2session.md +++ b/docs/examples/account/create-o-auth2session.md @@ -10,7 +10,6 @@ Future result = account.createOAuth2Session( provider: OAuthProvider.amazon, success: 'https://example.com', // (optional) failure: 'https://example.com', // (optional) - token: false, // (optional) scopes: [], // (optional) ); diff --git a/docs/examples/account/create-o-auth2token.md b/docs/examples/account/create-o-auth2token.md new file mode 100644 index 00000000..47030526 --- /dev/null +++ b/docs/examples/account/create-o-auth2token.md @@ -0,0 +1,20 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID + +Account account = Account(client); + +Future result = account.createOAuth2Token( + provider: OAuthProvider.amazon, + success: 'https://example.com', // (optional) + failure: 'https://example.com', // (optional) + scopes: [], // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index 8b801b31..819a2cfd 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -7,7 +7,7 @@ Client client = Client() Account account = Account(client); Future result = account.createPhoneToken( - userId: '[USER_ID]', + userId: '', phone: '+12065550100', ); diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index 6e739e24..b6c91087 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -7,8 +7,8 @@ Client client = Client() Account account = Account(client); Future result = account.createSession( - userId: '[USER_ID]', - secret: '[SECRET]', + userId: '', + secret: '', ); result.then((response) { diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index 71381f37..98511105 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -7,10 +7,10 @@ Client client = Client() Account account = Account(client); Future result = account.create( - userId: '[USER_ID]', + userId: '', email: 'email@example.com', password: '', - name: '[NAME]', // (optional) + name: '', // (optional) ); result.then((response) { diff --git a/docs/examples/account/delete-authenticator.md b/docs/examples/account/delete-authenticator.md index 3528bac9..8332c2f0 100644 --- a/docs/examples/account/delete-authenticator.md +++ b/docs/examples/account/delete-authenticator.md @@ -9,7 +9,7 @@ Account account = Account(client); Future result = account.deleteAuthenticator( type: AuthenticatorType.totp, - otp: '[OTP]', + otp: '', ); result.then((response) { diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index 46dddcbe..67d5fa86 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -8,7 +8,7 @@ Client client = Client() Account account = Account(client); Future result = account.deleteIdentity( - identityId: '[IDENTITY_ID]', + identityId: '', ); result.then((response) { diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index 8bca4844..752ca381 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -8,7 +8,7 @@ Client client = Client() Account account = Account(client); Future result = account.deleteSession( - sessionId: '[SESSION_ID]', + sessionId: '', ); result.then((response) { diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index 0306af43..5b9f9a8b 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -8,7 +8,7 @@ Client client = Client() Account account = Account(client); Future result = account.getSession( - sessionId: '[SESSION_ID]', + sessionId: '', ); result.then((response) { diff --git a/docs/examples/account/update-challenge.md b/docs/examples/account/update-challenge.md index 26c67e4d..dee58f53 100644 --- a/docs/examples/account/update-challenge.md +++ b/docs/examples/account/update-challenge.md @@ -8,8 +8,8 @@ Client client = Client() Account account = Account(client); Future result = account.updateChallenge( - challengeId: '[CHALLENGE_ID]', - otp: '[OTP]', + challengeId: '', + otp: '', ); result.then((response) { diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-u-r-l-session.md index 18470683..52b05dc0 100644 --- a/docs/examples/account/update-magic-u-r-l-session.md +++ b/docs/examples/account/update-magic-u-r-l-session.md @@ -7,8 +7,8 @@ Client client = Client() Account account = Account(client); Future result = account.updateMagicURLSession( - userId: '[USER_ID]', - secret: '[SECRET]', + userId: '', + secret: '', ); result.then((response) { diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index 016adfc0..38fd7ea1 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -8,7 +8,7 @@ Client client = Client() Account account = Account(client); Future result = account.updateName( - name: '[NAME]', + name: '', ); result.then((response) { diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index c6f740f1..7d88fb39 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -8,8 +8,8 @@ Client client = Client() Account account = Account(client); Future result = account.updatePhoneVerification( - userId: '[USER_ID]', - secret: '[SECRET]', + userId: '', + secret: '', ); result.then((response) { diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index ad48d22d..3f13119b 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -8,8 +8,8 @@ Client client = Client() Account account = Account(client); Future result = account.updateRecovery( - userId: '[USER_ID]', - secret: '[SECRET]', + userId: '', + secret: '', password: '', ); diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index aa047a2f..55e96f36 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -8,7 +8,7 @@ Client client = Client() Account account = Account(client); Future result = account.updateSession( - sessionId: '[SESSION_ID]', + sessionId: '', ); result.then((response) { diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index 2390b1e8..f9fcf0a5 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -8,8 +8,8 @@ Client client = Client() Account account = Account(client); Future result = account.updateVerification( - userId: '[USER_ID]', - secret: '[SECRET]', + userId: '', + secret: '', ); result.then((response) { diff --git a/docs/examples/account/verify-authenticator.md b/docs/examples/account/verify-authenticator.md index e6006546..8b70c77c 100644 --- a/docs/examples/account/verify-authenticator.md +++ b/docs/examples/account/verify-authenticator.md @@ -9,7 +9,7 @@ Account account = Account(client); Future result = account.verifyAuthenticator( type: AuthenticatorType.totp, - otp: '[OTP]', + otp: '', ); result.then((response) { diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 36162fc2..8a2c0a5f 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -8,7 +8,7 @@ Client client = Client() Avatars avatars = Avatars(client); Future result = avatars.getInitials( - name: '[NAME]', // (optional) + name: '', // (optional) width: 0, // (optional) height: 0, // (optional) background: '', // (optional) diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md index c6d4da48..43c67c4f 100644 --- a/docs/examples/avatars/get-q-r.md +++ b/docs/examples/avatars/get-q-r.md @@ -8,7 +8,7 @@ Client client = Client() Avatars avatars = Avatars(client); Future result = avatars.getQR( - text: '[TEXT]', + text: '', size: 1, // (optional) margin: 0, // (optional) download: false, // (optional) diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index 39df7955..44e9b11d 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.createBooleanAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', xrequired: false, xdefault: false, // (optional) diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index 01a88051..e3236a99 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -8,9 +8,9 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.createCollection( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - name: '[NAME]', + databaseId: '', + collectionId: '', + name: '', permissions: ["read("any")"], // (optional) documentSecurity: false, // (optional) enabled: false, // (optional) diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index 2ad1138b..0511096b 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.createDatetimeAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', xrequired: false, xdefault: '', // (optional) diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 56dd827e..d648a5cd 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -8,9 +8,9 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.createDocument( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - documentId: '[DOCUMENT_ID]', + databaseId: '', + collectionId: '', + documentId: '', data: {}, permissions: ["read("any")"], // (optional) ); diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index e66dc5fd..6684f8ee 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.createEmailAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', xrequired: false, xdefault: 'email@example.com', // (optional) diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index 9ca4a10c..6c04fa42 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -8,12 +8,12 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.createEnumAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', elements: [], xrequired: false, - xdefault: '[DEFAULT]', // (optional) + xdefault: '', // (optional) array: false, // (optional) ); diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index 7ec40b67..6ca871d2 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.createFloatAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', xrequired: false, min: 0, // (optional) diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index 5f57488f..3aeab976 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.createIndex( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', type: IndexType.key, attributes: [], diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index 82ab19e3..b707bffb 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.createIntegerAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', xrequired: false, min: 0, // (optional) diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index 8548934f..46081ba1 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.createIpAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', xrequired: false, xdefault: '', // (optional) diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index 791d4c68..a9a2ed3f 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -8,9 +8,9 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.createRelationshipAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - relatedCollectionId: '[RELATED_COLLECTION_ID]', + databaseId: '', + collectionId: '', + relatedCollectionId: '', type: RelationshipType.oneToOne, twoWay: false, // (optional) key: '', // (optional) diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index 71ceb7da..ba80f761 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -8,12 +8,12 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.createStringAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', size: 1, xrequired: false, - xdefault: '[DEFAULT]', // (optional) + xdefault: '', // (optional) array: false, // (optional) encrypt: false, // (optional) ); diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index 157a06cd..b59ccf33 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.createUrlAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', xrequired: false, xdefault: 'https://example.com', // (optional) diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index 8dd4d6e4..0d36c66c 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.create( - databaseId: '[DATABASE_ID]', - name: '[NAME]', + databaseId: '', + name: '', enabled: false, // (optional) ); diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index 819aa3ab..2a6c38c4 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.deleteAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', ); diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md index 53c49ac3..bfaab82a 100644 --- a/docs/examples/databases/delete-collection.md +++ b/docs/examples/databases/delete-collection.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.deleteCollection( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', ); result.then((response) { diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index b8b04acb..145e48a4 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -8,9 +8,9 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.deleteDocument( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - documentId: '[DOCUMENT_ID]', + databaseId: '', + collectionId: '', + documentId: '', ); result.then((response) { diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index e72a7e45..ba3a101e 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.deleteIndex( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', ); diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md index c285a5b1..9567c357 100644 --- a/docs/examples/databases/delete.md +++ b/docs/examples/databases/delete.md @@ -8,7 +8,7 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.delete( - databaseId: '[DATABASE_ID]', + databaseId: '', ); result.then((response) { diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index adce2f20..1d2958ef 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.getAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', ); diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md index 35ac9336..160855bf 100644 --- a/docs/examples/databases/get-collection.md +++ b/docs/examples/databases/get-collection.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.getCollection( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', ); result.then((response) { diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index 4ea43289..645f7ffa 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -8,9 +8,9 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.getDocument( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - documentId: '[DOCUMENT_ID]', + databaseId: '', + collectionId: '', + documentId: '', queries: [], // (optional) ); diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index 86fe2ff1..effbd3c7 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.getIndex( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', ); diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md index 4060bfa8..39b05699 100644 --- a/docs/examples/databases/get.md +++ b/docs/examples/databases/get.md @@ -8,7 +8,7 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.get( - databaseId: '[DATABASE_ID]', + databaseId: '', ); result.then((response) { diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index 872b58dc..c1b14c7b 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.listAttributes( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', queries: [], // (optional) ); diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index abce80c8..be6d9645 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -8,9 +8,9 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.listCollections( - databaseId: '[DATABASE_ID]', + databaseId: '', queries: [], // (optional) - search: '[SEARCH]', // (optional) + search: '', // (optional) ); result.then((response) { diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 271d0a56..0db86d54 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.listDocuments( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', queries: [], // (optional) ); diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index 9e3f7db9..0c3eff92 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.listIndexes( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', queries: [], // (optional) ); diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index 101b7085..a2e07420 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -9,7 +9,7 @@ Databases databases = Databases(client); Future result = databases.list( queries: [], // (optional) - search: '[SEARCH]', // (optional) + search: '', // (optional) ); result.then((response) { diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index 0adc7fc1..a0f46b0d 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.updateBooleanAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', xrequired: false, xdefault: false, diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index 35ba5d1d..c731d51b 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -8,9 +8,9 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.updateCollection( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - name: '[NAME]', + databaseId: '', + collectionId: '', + name: '', permissions: ["read("any")"], // (optional) documentSecurity: false, // (optional) enabled: false, // (optional) diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index 40e21835..aabf1a1f 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.updateDatetimeAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', xrequired: false, xdefault: '', diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 43dd3504..3340172e 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -8,9 +8,9 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.updateDocument( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - documentId: '[DOCUMENT_ID]', + databaseId: '', + collectionId: '', + documentId: '', data: {}, // (optional) permissions: ["read("any")"], // (optional) ); diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index a6c37e2f..c5f0f605 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.updateEmailAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', xrequired: false, xdefault: 'email@example.com', diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index 0d4a896f..b55acd86 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -8,12 +8,12 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.updateEnumAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', elements: [], xrequired: false, - xdefault: '[DEFAULT]', + xdefault: '', ); result.then((response) { diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index f1513ed7..8454438a 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.updateFloatAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', xrequired: false, min: 0, diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 1c78e22f..801205dd 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.updateIntegerAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', xrequired: false, min: 0, diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index d55d51e9..eac2e034 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.updateIpAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', xrequired: false, xdefault: '', diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index 05a99bfe..680224b6 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.updateRelationshipAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', onDelete: RelationMutate.cascade, // (optional) ); diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index aff7b95b..52589932 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -8,11 +8,11 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.updateStringAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', xrequired: false, - xdefault: '[DEFAULT]', + xdefault: '', ); result.then((response) { diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index b51ebfac..9b86359d 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.updateUrlAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '', + collectionId: '', key: '', xrequired: false, xdefault: 'https://example.com', diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index bdaf8cc2..6a094c90 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -8,8 +8,8 @@ Client client = Client() Databases databases = Databases(client); Future result = databases.update( - databaseId: '[DATABASE_ID]', - name: '[NAME]', + databaseId: '', + name: '', enabled: false, // (optional) ); diff --git a/docs/examples/functions/create-build.md b/docs/examples/functions/create-build.md index 3640e658..ba7d87f3 100644 --- a/docs/examples/functions/create-build.md +++ b/docs/examples/functions/create-build.md @@ -8,9 +8,9 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.createBuild( - functionId: '[FUNCTION_ID]', - deploymentId: '[DEPLOYMENT_ID]', - buildId: '[BUILD_ID]', + functionId: '', + deploymentId: '', + buildId: '', ); result.then((response) { diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index 9d53e42b..68276da7 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -8,11 +8,11 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.createDeployment( - functionId: '[FUNCTION_ID]', + functionId: '', code: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'), activate: false, - entrypoint: '[ENTRYPOINT]', // (optional) - commands: '[COMMANDS]', // (optional) + entrypoint: '', // (optional) + commands: '', // (optional) ); result.then((response) { diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index c200fc03..66f09bcb 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -8,10 +8,10 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.createExecution( - functionId: '[FUNCTION_ID]', - body: '[BODY]', // (optional) + functionId: '', + body: '', // (optional) xasync: false, // (optional) - path: '[PATH]', // (optional) + path: '', // (optional) method: ExecutionMethod.gET, // (optional) headers: {}, // (optional) ); diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index fb9b8f57..f05f4a0d 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -8,9 +8,9 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.createVariable( - functionId: '[FUNCTION_ID]', - key: '[KEY]', - value: '[VALUE]', + functionId: '', + key: '', + value: '', ); result.then((response) { diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index cd90a368..1b9ad5f3 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -8,8 +8,8 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.create( - functionId: '[FUNCTION_ID]', - name: '[NAME]', + functionId: '', + name: '', runtime: .node145, execute: ["any"], // (optional) events: [], // (optional) @@ -17,17 +17,17 @@ Future result = functions.create( timeout: 1, // (optional) enabled: false, // (optional) logging: false, // (optional) - entrypoint: '[ENTRYPOINT]', // (optional) - commands: '[COMMANDS]', // (optional) - installationId: '[INSTALLATION_ID]', // (optional) - providerRepositoryId: '[PROVIDER_REPOSITORY_ID]', // (optional) - providerBranch: '[PROVIDER_BRANCH]', // (optional) + entrypoint: '', // (optional) + commands: '', // (optional) + installationId: '', // (optional) + providerRepositoryId: '', // (optional) + providerBranch: '', // (optional) providerSilentMode: false, // (optional) - providerRootDirectory: '[PROVIDER_ROOT_DIRECTORY]', // (optional) - templateRepository: '[TEMPLATE_REPOSITORY]', // (optional) - templateOwner: '[TEMPLATE_OWNER]', // (optional) - templateRootDirectory: '[TEMPLATE_ROOT_DIRECTORY]', // (optional) - templateBranch: '[TEMPLATE_BRANCH]', // (optional) + providerRootDirectory: '', // (optional) + templateRepository: '', // (optional) + templateOwner: '', // (optional) + templateRootDirectory: '', // (optional) + templateBranch: '', // (optional) ); result.then((response) { diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md index 653090e1..b9a5288a 100644 --- a/docs/examples/functions/delete-deployment.md +++ b/docs/examples/functions/delete-deployment.md @@ -8,8 +8,8 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.deleteDeployment( - functionId: '[FUNCTION_ID]', - deploymentId: '[DEPLOYMENT_ID]', + functionId: '', + deploymentId: '', ); result.then((response) { diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md index adc8fd1c..2558ac76 100644 --- a/docs/examples/functions/delete-variable.md +++ b/docs/examples/functions/delete-variable.md @@ -8,8 +8,8 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.deleteVariable( - functionId: '[FUNCTION_ID]', - variableId: '[VARIABLE_ID]', + functionId: '', + variableId: '', ); result.then((response) { diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md index 24b563b6..b6df6142 100644 --- a/docs/examples/functions/delete.md +++ b/docs/examples/functions/delete.md @@ -8,7 +8,7 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.delete( - functionId: '[FUNCTION_ID]', + functionId: '', ); result.then((response) { diff --git a/docs/examples/functions/download-deployment.md b/docs/examples/functions/download-deployment.md index a6853b4d..a28d3725 100644 --- a/docs/examples/functions/download-deployment.md +++ b/docs/examples/functions/download-deployment.md @@ -8,8 +8,8 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.downloadDeployment( - functionId: '[FUNCTION_ID]', - deploymentId: '[DEPLOYMENT_ID]', + functionId: '', + deploymentId: '', ); result.then((response) { diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md index 4f0dace5..ce60b991 100644 --- a/docs/examples/functions/get-deployment.md +++ b/docs/examples/functions/get-deployment.md @@ -8,8 +8,8 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.getDeployment( - functionId: '[FUNCTION_ID]', - deploymentId: '[DEPLOYMENT_ID]', + functionId: '', + deploymentId: '', ); result.then((response) { diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index 3a2aee20..d3d57291 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -8,8 +8,8 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.getExecution( - functionId: '[FUNCTION_ID]', - executionId: '[EXECUTION_ID]', + functionId: '', + executionId: '', ); result.then((response) { diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md index 4f1e790a..c69bcf27 100644 --- a/docs/examples/functions/get-variable.md +++ b/docs/examples/functions/get-variable.md @@ -8,8 +8,8 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.getVariable( - functionId: '[FUNCTION_ID]', - variableId: '[VARIABLE_ID]', + functionId: '', + variableId: '', ); result.then((response) { diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md index 1b128a74..95bb8422 100644 --- a/docs/examples/functions/get.md +++ b/docs/examples/functions/get.md @@ -8,7 +8,7 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.get( - functionId: '[FUNCTION_ID]', + functionId: '', ); result.then((response) { diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index 2bf78016..b59b8d50 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -8,9 +8,9 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.listDeployments( - functionId: '[FUNCTION_ID]', + functionId: '', queries: [], // (optional) - search: '[SEARCH]', // (optional) + search: '', // (optional) ); result.then((response) { diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index cf37585b..b33af63c 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -8,9 +8,9 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.listExecutions( - functionId: '[FUNCTION_ID]', + functionId: '', queries: [], // (optional) - search: '[SEARCH]', // (optional) + search: '', // (optional) ); result.then((response) { diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index 56d01b4c..2952a10c 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -8,7 +8,7 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.listVariables( - functionId: '[FUNCTION_ID]', + functionId: '', ); result.then((response) { diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index 47de7df4..c614684f 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -9,7 +9,7 @@ Functions functions = Functions(client); Future result = functions.list( queries: [], // (optional) - search: '[SEARCH]', // (optional) + search: '', // (optional) ); result.then((response) { diff --git a/docs/examples/functions/update-deployment.md b/docs/examples/functions/update-deployment.md index 6f9a362f..ecec8262 100644 --- a/docs/examples/functions/update-deployment.md +++ b/docs/examples/functions/update-deployment.md @@ -8,8 +8,8 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.updateDeployment( - functionId: '[FUNCTION_ID]', - deploymentId: '[DEPLOYMENT_ID]', + functionId: '', + deploymentId: '', ); result.then((response) { diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index cdbba7aa..6e819e46 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -8,10 +8,10 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.updateVariable( - functionId: '[FUNCTION_ID]', - variableId: '[VARIABLE_ID]', - key: '[KEY]', - value: '[VALUE]', // (optional) + functionId: '', + variableId: '', + key: '', + value: '', // (optional) ); result.then((response) { diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 42847ff1..818e8837 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -8,8 +8,8 @@ Client client = Client() Functions functions = Functions(client); Future result = functions.update( - functionId: '[FUNCTION_ID]', - name: '[NAME]', + functionId: '', + name: '', runtime: .node145, // (optional) execute: ["any"], // (optional) events: [], // (optional) @@ -17,13 +17,13 @@ Future result = functions.update( timeout: 1, // (optional) enabled: false, // (optional) logging: false, // (optional) - entrypoint: '[ENTRYPOINT]', // (optional) - commands: '[COMMANDS]', // (optional) - installationId: '[INSTALLATION_ID]', // (optional) - providerRepositoryId: '[PROVIDER_REPOSITORY_ID]', // (optional) - providerBranch: '[PROVIDER_BRANCH]', // (optional) + entrypoint: '', // (optional) + commands: '', // (optional) + installationId: '', // (optional) + providerRepositoryId: '', // (optional) + providerBranch: '', // (optional) providerSilentMode: false, // (optional) - providerRootDirectory: '[PROVIDER_ROOT_DIRECTORY]', // (optional) + providerRootDirectory: '', // (optional) ); result.then((response) { diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md index 913a1c1d..b175a775 100644 --- a/docs/examples/health/get-queue-databases.md +++ b/docs/examples/health/get-queue-databases.md @@ -8,7 +8,7 @@ Client client = Client() Health health = Health(client); Future result = health.getQueueDatabases( - name: '[NAME]', // (optional) + name: '', // (optional) threshold: 0, // (optional) ); diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md index ca650590..91552e7b 100644 --- a/docs/examples/messaging/create-apns-provider.md +++ b/docs/examples/messaging/create-apns-provider.md @@ -8,12 +8,13 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.createApnsProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', - authKey: '[AUTH_KEY]', // (optional) - authKeyId: '[AUTH_KEY_ID]', // (optional) - teamId: '[TEAM_ID]', // (optional) - bundleId: '[BUNDLE_ID]', // (optional) + providerId: '', + name: '', + authKey: '', // (optional) + authKeyId: '', // (optional) + teamId: '', // (optional) + bundleId: '', // (optional) + sandbox: false, // (optional) enabled: false, // (optional) ); diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md index b52019a7..1fdaf411 100644 --- a/docs/examples/messaging/create-email.md +++ b/docs/examples/messaging/create-email.md @@ -8,9 +8,9 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.createEmail( - messageId: '[MESSAGE_ID]', - subject: '[SUBJECT]', - content: '[CONTENT]', + messageId: '', + subject: '', + content: '', topics: [], // (optional) users: [], // (optional) targets: [], // (optional) diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md index 088a0111..d73d9371 100644 --- a/docs/examples/messaging/create-fcm-provider.md +++ b/docs/examples/messaging/create-fcm-provider.md @@ -8,8 +8,8 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.createFcmProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', + providerId: '', + name: '', serviceAccountJSON: {}, // (optional) enabled: false, // (optional) ); diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md index 0e88a8c8..29ecbec7 100644 --- a/docs/examples/messaging/create-mailgun-provider.md +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -8,14 +8,14 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.createMailgunProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', - apiKey: '[API_KEY]', // (optional) - domain: '[DOMAIN]', // (optional) + providerId: '', + name: '', + apiKey: '', // (optional) + domain: '', // (optional) isEuRegion: false, // (optional) - fromName: '[FROM_NAME]', // (optional) + fromName: '', // (optional) fromEmail: 'email@example.com', // (optional) - replyToName: '[REPLY_TO_NAME]', // (optional) + replyToName: '', // (optional) replyToEmail: 'email@example.com', // (optional) enabled: false, // (optional) ); diff --git a/docs/examples/messaging/create-msg91provider.md b/docs/examples/messaging/create-msg91provider.md index 25f52705..6de77c4c 100644 --- a/docs/examples/messaging/create-msg91provider.md +++ b/docs/examples/messaging/create-msg91provider.md @@ -8,11 +8,11 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.createMsg91Provider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', + providerId: '', + name: '', from: '+12065550100', // (optional) - senderId: '[SENDER_ID]', // (optional) - authKey: '[AUTH_KEY]', // (optional) + senderId: '', // (optional) + authKey: '', // (optional) enabled: false, // (optional) ); diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index 53a900e7..1981f695 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -8,20 +8,20 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.createPush( - messageId: '[MESSAGE_ID]', - title: '[TITLE]', - body: '[BODY]', + messageId: '', + title: '', + body: '<BODY>', topics: [], // (optional) users: [], // (optional) targets: [], // (optional) data: {}, // (optional) - action: '[ACTION]', // (optional) + action: '<ACTION>', // (optional) image: '[ID1:ID2]', // (optional) - icon: '[ICON]', // (optional) - sound: '[SOUND]', // (optional) - color: '[COLOR]', // (optional) - tag: '[TAG]', // (optional) - badge: '[BADGE]', // (optional) + icon: '<ICON>', // (optional) + sound: '<SOUND>', // (optional) + color: '<COLOR>', // (optional) + tag: '<TAG>', // (optional) + badge: '<BADGE>', // (optional) status: MessageStatus.draft, // (optional) scheduledAt: '', // (optional) ); diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md index 21a58a6c..254da707 100644 --- a/docs/examples/messaging/create-sendgrid-provider.md +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -8,12 +8,12 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.createSendgridProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', - apiKey: '[API_KEY]', // (optional) - fromName: '[FROM_NAME]', // (optional) + providerId: '<PROVIDER_ID>', + name: '<NAME>', + apiKey: '<API_KEY>', // (optional) + fromName: '<FROM_NAME>', // (optional) fromEmail: 'email@example.com', // (optional) - replyToName: '[REPLY_TO_NAME]', // (optional) + replyToName: '<REPLY_TO_NAME>', // (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 213c360a..637c5e80 100644 --- a/docs/examples/messaging/create-sms.md +++ b/docs/examples/messaging/create-sms.md @@ -8,8 +8,8 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.createSms( - messageId: '[MESSAGE_ID]', - content: '[CONTENT]', + messageId: '<MESSAGE_ID>', + content: '<CONTENT>', topics: [], // (optional) users: [], // (optional) targets: [], // (optional) diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index 012e560a..abc18a3a 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -8,18 +8,18 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.createSmtpProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', - host: '[HOST]', + providerId: '<PROVIDER_ID>', + name: '<NAME>', + host: '<HOST>', port: 1, // (optional) - username: '[USERNAME]', // (optional) - password: '[PASSWORD]', // (optional) - encryption: .none, // (optional) + username: '<USERNAME>', // (optional) + password: '<PASSWORD>', // (optional) + encryption: SmtpEncryption.none, // (optional) autoTLS: false, // (optional) - mailer: '[MAILER]', // (optional) - fromName: '[FROM_NAME]', // (optional) + mailer: '<MAILER>', // (optional) + fromName: '<FROM_NAME>', // (optional) fromEmail: 'email@example.com', // (optional) - replyToName: '[REPLY_TO_NAME]', // (optional) + replyToName: '<REPLY_TO_NAME>', // (optional) replyToEmail: 'email@example.com', // (optional) enabled: false, // (optional) ); diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md index 4998e314..c743814a 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -8,9 +8,9 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.createSubscriber( - topicId: '[TOPIC_ID]', - subscriberId: '[SUBSCRIBER_ID]', - targetId: '[TARGET_ID]', + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>', + targetId: '<TARGET_ID>', ); result.then((response) { diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md index 2f13526d..31f60823 100644 --- a/docs/examples/messaging/create-telesign-provider.md +++ b/docs/examples/messaging/create-telesign-provider.md @@ -8,11 +8,11 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.createTelesignProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', + providerId: '<PROVIDER_ID>', + name: '<NAME>', from: '+12065550100', // (optional) - customerId: '[CUSTOMER_ID]', // (optional) - apiKey: '[API_KEY]', // (optional) + customerId: '<CUSTOMER_ID>', // (optional) + apiKey: '<API_KEY>', // (optional) enabled: false, // (optional) ); diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md index 42a1e8c5..22e149bd 100644 --- a/docs/examples/messaging/create-textmagic-provider.md +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -8,11 +8,11 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.createTextmagicProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', + providerId: '<PROVIDER_ID>', + name: '<NAME>', from: '+12065550100', // (optional) - username: '[USERNAME]', // (optional) - apiKey: '[API_KEY]', // (optional) + username: '<USERNAME>', // (optional) + apiKey: '<API_KEY>', // (optional) enabled: false, // (optional) ); diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md index 9828f49f..cf8614cc 100644 --- a/docs/examples/messaging/create-topic.md +++ b/docs/examples/messaging/create-topic.md @@ -8,8 +8,8 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.createTopic( - topicId: '[TOPIC_ID]', - name: '[NAME]', + topicId: '<TOPIC_ID>', + name: '<NAME>', subscribe: ["any"], // (optional) ); diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md index d12bacfd..e0cfc4d6 100644 --- a/docs/examples/messaging/create-twilio-provider.md +++ b/docs/examples/messaging/create-twilio-provider.md @@ -8,11 +8,11 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.createTwilioProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', + providerId: '<PROVIDER_ID>', + name: '<NAME>', from: '+12065550100', // (optional) - accountSid: '[ACCOUNT_SID]', // (optional) - authToken: '[AUTH_TOKEN]', // (optional) + accountSid: '<ACCOUNT_SID>', // (optional) + authToken: '<AUTH_TOKEN>', // (optional) enabled: false, // (optional) ); diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md index 0eb69291..6a5f855e 100644 --- a/docs/examples/messaging/create-vonage-provider.md +++ b/docs/examples/messaging/create-vonage-provider.md @@ -8,11 +8,11 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.createVonageProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', + providerId: '<PROVIDER_ID>', + name: '<NAME>', from: '+12065550100', // (optional) - apiKey: '[API_KEY]', // (optional) - apiSecret: '[API_SECRET]', // (optional) + apiKey: '<API_KEY>', // (optional) + apiSecret: '<API_SECRET>', // (optional) enabled: false, // (optional) ); diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md index c319926b..0c3282c4 100644 --- a/docs/examples/messaging/delete-provider.md +++ b/docs/examples/messaging/delete-provider.md @@ -8,7 +8,7 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.deleteProvider( - providerId: '[PROVIDER_ID]', + providerId: '<PROVIDER_ID>', ); result.then((response) { diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md index d11c28b0..af22f593 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -8,8 +8,8 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.deleteSubscriber( - topicId: '[TOPIC_ID]', - subscriberId: '[SUBSCRIBER_ID]', + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>', ); result.then((response) { diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md index 8887f209..586842d6 100644 --- a/docs/examples/messaging/delete-topic.md +++ b/docs/examples/messaging/delete-topic.md @@ -8,7 +8,7 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.deleteTopic( - topicId: '[TOPIC_ID]', + topicId: '<TOPIC_ID>', ); result.then((response) { diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md index 80182872..eaaa70c1 100644 --- a/docs/examples/messaging/delete.md +++ b/docs/examples/messaging/delete.md @@ -8,7 +8,7 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.delete( - messageId: '[MESSAGE_ID]', + messageId: '<MESSAGE_ID>', ); result.then((response) { diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md index b1e462cd..b189b37f 100644 --- a/docs/examples/messaging/get-message.md +++ b/docs/examples/messaging/get-message.md @@ -8,7 +8,7 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.getMessage( - messageId: '[MESSAGE_ID]', + messageId: '<MESSAGE_ID>', ); result.then((response) { diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md index 59fb930f..a9614959 100644 --- a/docs/examples/messaging/get-provider.md +++ b/docs/examples/messaging/get-provider.md @@ -8,7 +8,7 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.getProvider( - providerId: '[PROVIDER_ID]', + providerId: '<PROVIDER_ID>', ); result.then((response) { diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md index f6d5429f..22447162 100644 --- a/docs/examples/messaging/get-subscriber.md +++ b/docs/examples/messaging/get-subscriber.md @@ -8,8 +8,8 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.getSubscriber( - topicId: '[TOPIC_ID]', - subscriberId: '[SUBSCRIBER_ID]', + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>', ); result.then((response) { diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md index 4627f299..f256312b 100644 --- a/docs/examples/messaging/get-topic.md +++ b/docs/examples/messaging/get-topic.md @@ -8,7 +8,7 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.getTopic( - topicId: '[TOPIC_ID]', + topicId: '<TOPIC_ID>', ); result.then((response) { diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md index e9c376c1..b85765e4 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/messaging/list-message-logs.md @@ -8,7 +8,7 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.listMessageLogs( - messageId: '[MESSAGE_ID]', + messageId: '<MESSAGE_ID>', queries: [], // (optional) ); diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md index 2d70b4fa..923bbaaa 100644 --- a/docs/examples/messaging/list-messages.md +++ b/docs/examples/messaging/list-messages.md @@ -9,7 +9,7 @@ Messaging messaging = Messaging(client); Future result = messaging.listMessages( queries: [], // (optional) - search: '[SEARCH]', // (optional) + search: '<SEARCH>', // (optional) ); result.then((response) { diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md index 3de551cf..44138988 100644 --- a/docs/examples/messaging/list-provider-logs.md +++ b/docs/examples/messaging/list-provider-logs.md @@ -8,7 +8,7 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.listProviderLogs( - providerId: '[PROVIDER_ID]', + providerId: '<PROVIDER_ID>', queries: [], // (optional) ); diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md index 84709915..0da36c0a 100644 --- a/docs/examples/messaging/list-providers.md +++ b/docs/examples/messaging/list-providers.md @@ -9,7 +9,7 @@ Messaging messaging = Messaging(client); Future result = messaging.listProviders( queries: [], // (optional) - search: '[SEARCH]', // (optional) + search: '<SEARCH>', // (optional) ); result.then((response) { diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md index 2a08a651..1ff41617 100644 --- a/docs/examples/messaging/list-subscriber-logs.md +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -8,7 +8,7 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.listSubscriberLogs( - subscriberId: '[SUBSCRIBER_ID]', + subscriberId: '<SUBSCRIBER_ID>', queries: [], // (optional) ); diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md index 3cd42c9b..c30fdcdb 100644 --- a/docs/examples/messaging/list-subscribers.md +++ b/docs/examples/messaging/list-subscribers.md @@ -8,9 +8,9 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.listSubscribers( - topicId: '[TOPIC_ID]', + topicId: '<TOPIC_ID>', queries: [], // (optional) - search: '[SEARCH]', // (optional) + search: '<SEARCH>', // (optional) ); result.then((response) { diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md index a7508a80..88c652d5 100644 --- a/docs/examples/messaging/list-targets.md +++ b/docs/examples/messaging/list-targets.md @@ -8,7 +8,7 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.listTargets( - messageId: '[MESSAGE_ID]', + messageId: '<MESSAGE_ID>', queries: [], // (optional) ); diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md index 0ca10f51..e58597b5 100644 --- a/docs/examples/messaging/list-topic-logs.md +++ b/docs/examples/messaging/list-topic-logs.md @@ -8,7 +8,7 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.listTopicLogs( - topicId: '[TOPIC_ID]', + topicId: '<TOPIC_ID>', queries: [], // (optional) ); diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md index 3e7a2507..e050daae 100644 --- a/docs/examples/messaging/list-topics.md +++ b/docs/examples/messaging/list-topics.md @@ -9,7 +9,7 @@ Messaging messaging = Messaging(client); Future result = messaging.listTopics( queries: [], // (optional) - search: '[SEARCH]', // (optional) + search: '<SEARCH>', // (optional) ); result.then((response) { diff --git a/docs/examples/messaging/update-a-p-n-s-provider.md b/docs/examples/messaging/update-apns-provider.md similarity index 59% rename from docs/examples/messaging/update-a-p-n-s-provider.md rename to docs/examples/messaging/update-apns-provider.md index 7a321532..5ec0a40f 100644 --- a/docs/examples/messaging/update-a-p-n-s-provider.md +++ b/docs/examples/messaging/update-apns-provider.md @@ -7,14 +7,15 @@ Client client = Client() Messaging messaging = Messaging(client); -Future result = messaging.updateAPNSProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', // (optional) +Future result = messaging.updateApnsProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) enabled: false, // (optional) - authKey: '[AUTH_KEY]', // (optional) - authKeyId: '[AUTH_KEY_ID]', // (optional) - teamId: '[TEAM_ID]', // (optional) - bundleId: '[BUNDLE_ID]', // (optional) + authKey: '<AUTH_KEY>', // (optional) + authKeyId: '<AUTH_KEY_ID>', // (optional) + teamId: '<TEAM_ID>', // (optional) + bundleId: '<BUNDLE_ID>', // (optional) + sandbox: false, // (optional) ); result.then((response) { diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index dbca395c..00e00415 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -8,12 +8,12 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.updateEmail( - messageId: '[MESSAGE_ID]', + messageId: '<MESSAGE_ID>', topics: [], // (optional) users: [], // (optional) targets: [], // (optional) - subject: '[SUBJECT]', // (optional) - content: '[CONTENT]', // (optional) + subject: '<SUBJECT>', // (optional) + content: '<CONTENT>', // (optional) status: MessageStatus.draft, // (optional) html: false, // (optional) cc: [], // (optional) diff --git a/docs/examples/messaging/update-f-c-m-provider.md b/docs/examples/messaging/update-fcm-provider.md similarity index 81% rename from docs/examples/messaging/update-f-c-m-provider.md rename to docs/examples/messaging/update-fcm-provider.md index 12ddad79..b48892af 100644 --- a/docs/examples/messaging/update-f-c-m-provider.md +++ b/docs/examples/messaging/update-fcm-provider.md @@ -7,9 +7,9 @@ Client client = Client() Messaging messaging = Messaging(client); -Future result = messaging.updateFCMProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', // (optional) +Future result = messaging.updateFcmProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) enabled: false, // (optional) serviceAccountJSON: {}, // (optional) ); diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md index d55203e8..fbae717a 100644 --- a/docs/examples/messaging/update-mailgun-provider.md +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -8,16 +8,16 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.updateMailgunProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', // (optional) - apiKey: '[API_KEY]', // (optional) - domain: '[DOMAIN]', // (optional) + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + apiKey: '<API_KEY>', // (optional) + domain: '<DOMAIN>', // (optional) isEuRegion: false, // (optional) enabled: false, // (optional) - fromName: '[FROM_NAME]', // (optional) + fromName: '<FROM_NAME>', // (optional) fromEmail: 'email@example.com', // (optional) - replyToName: '[REPLY_TO_NAME]', // (optional) - replyToEmail: '[REPLY_TO_EMAIL]', // (optional) + replyToName: '<REPLY_TO_NAME>', // (optional) + replyToEmail: '<REPLY_TO_EMAIL>', // (optional) ); result.then((response) { diff --git a/docs/examples/messaging/update-msg91provider.md b/docs/examples/messaging/update-msg91provider.md index 2c79c1f9..79876e94 100644 --- a/docs/examples/messaging/update-msg91provider.md +++ b/docs/examples/messaging/update-msg91provider.md @@ -8,12 +8,12 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.updateMsg91Provider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', // (optional) + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) enabled: false, // (optional) - senderId: '[SENDER_ID]', // (optional) - authKey: '[AUTH_KEY]', // (optional) - from: '[FROM]', // (optional) + senderId: '<SENDER_ID>', // (optional) + authKey: '<AUTH_KEY>', // (optional) + from: '<FROM>', // (optional) ); result.then((response) { diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index 1ddf03ae..dad44dbd 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -8,19 +8,19 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.updatePush( - messageId: '[MESSAGE_ID]', + messageId: '<MESSAGE_ID>', topics: [], // (optional) users: [], // (optional) targets: [], // (optional) - title: '[TITLE]', // (optional) - body: '[BODY]', // (optional) + title: '<TITLE>', // (optional) + body: '<BODY>', // (optional) data: {}, // (optional) - action: '[ACTION]', // (optional) + action: '<ACTION>', // (optional) image: '[ID1:ID2]', // (optional) - icon: '[ICON]', // (optional) - sound: '[SOUND]', // (optional) - color: '[COLOR]', // (optional) - tag: '[TAG]', // (optional) + icon: '<ICON>', // (optional) + sound: '<SOUND>', // (optional) + color: '<COLOR>', // (optional) + tag: '<TAG>', // (optional) badge: 0, // (optional) status: MessageStatus.draft, // (optional) scheduledAt: '', // (optional) diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md index feecbe42..3284a603 100644 --- a/docs/examples/messaging/update-sendgrid-provider.md +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -8,14 +8,14 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.updateSendgridProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', // (optional) + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) enabled: false, // (optional) - apiKey: '[API_KEY]', // (optional) - fromName: '[FROM_NAME]', // (optional) + apiKey: '<API_KEY>', // (optional) + fromName: '<FROM_NAME>', // (optional) fromEmail: 'email@example.com', // (optional) - replyToName: '[REPLY_TO_NAME]', // (optional) - replyToEmail: '[REPLY_TO_EMAIL]', // (optional) + replyToName: '<REPLY_TO_NAME>', // (optional) + replyToEmail: '<REPLY_TO_EMAIL>', // (optional) ); result.then((response) { diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md index 6c8bad98..aabb1805 100644 --- a/docs/examples/messaging/update-sms.md +++ b/docs/examples/messaging/update-sms.md @@ -8,11 +8,11 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.updateSms( - messageId: '[MESSAGE_ID]', + messageId: '<MESSAGE_ID>', topics: [], // (optional) users: [], // (optional) targets: [], // (optional) - content: '[CONTENT]', // (optional) + content: '<CONTENT>', // (optional) status: MessageStatus.draft, // (optional) scheduledAt: '', // (optional) ); diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index ff7316af..7e369e4f 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -8,19 +8,19 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.updateSmtpProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', // (optional) - host: '[HOST]', // (optional) + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + host: '<HOST>', // (optional) port: 1, // (optional) - username: '[USERNAME]', // (optional) - password: '[PASSWORD]', // (optional) - encryption: .none, // (optional) + username: '<USERNAME>', // (optional) + password: '<PASSWORD>', // (optional) + encryption: SmtpEncryption.none, // (optional) autoTLS: false, // (optional) - mailer: '[MAILER]', // (optional) - fromName: '[FROM_NAME]', // (optional) + mailer: '<MAILER>', // (optional) + fromName: '<FROM_NAME>', // (optional) fromEmail: 'email@example.com', // (optional) - replyToName: '[REPLY_TO_NAME]', // (optional) - replyToEmail: '[REPLY_TO_EMAIL]', // (optional) + replyToName: '<REPLY_TO_NAME>', // (optional) + replyToEmail: '<REPLY_TO_EMAIL>', // (optional) enabled: false, // (optional) ); diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md index 38003682..e19fdcfe 100644 --- a/docs/examples/messaging/update-telesign-provider.md +++ b/docs/examples/messaging/update-telesign-provider.md @@ -8,12 +8,12 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.updateTelesignProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', // (optional) + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) enabled: false, // (optional) - customerId: '[CUSTOMER_ID]', // (optional) - apiKey: '[API_KEY]', // (optional) - from: '[FROM]', // (optional) + customerId: '<CUSTOMER_ID>', // (optional) + apiKey: '<API_KEY>', // (optional) + from: '<FROM>', // (optional) ); result.then((response) { diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md index dc7df222..16843cd7 100644 --- a/docs/examples/messaging/update-textmagic-provider.md +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -8,12 +8,12 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.updateTextmagicProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', // (optional) + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) enabled: false, // (optional) - username: '[USERNAME]', // (optional) - apiKey: '[API_KEY]', // (optional) - from: '[FROM]', // (optional) + username: '<USERNAME>', // (optional) + apiKey: '<API_KEY>', // (optional) + from: '<FROM>', // (optional) ); result.then((response) { diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md index 299bfe17..eae39824 100644 --- a/docs/examples/messaging/update-topic.md +++ b/docs/examples/messaging/update-topic.md @@ -8,8 +8,9 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.updateTopic( - topicId: '[TOPIC_ID]', - name: '[NAME]', // (optional) + topicId: '<TOPIC_ID>', + name: '<NAME>', // (optional) + subscribe: ["any"], // (optional) ); result.then((response) { diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md index 29b64b48..b65a1deb 100644 --- a/docs/examples/messaging/update-twilio-provider.md +++ b/docs/examples/messaging/update-twilio-provider.md @@ -8,12 +8,12 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.updateTwilioProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', // (optional) + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) enabled: false, // (optional) - accountSid: '[ACCOUNT_SID]', // (optional) - authToken: '[AUTH_TOKEN]', // (optional) - from: '[FROM]', // (optional) + accountSid: '<ACCOUNT_SID>', // (optional) + authToken: '<AUTH_TOKEN>', // (optional) + from: '<FROM>', // (optional) ); result.then((response) { diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md index 835d4f32..692171d3 100644 --- a/docs/examples/messaging/update-vonage-provider.md +++ b/docs/examples/messaging/update-vonage-provider.md @@ -8,12 +8,12 @@ Client client = Client() Messaging messaging = Messaging(client); Future result = messaging.updateVonageProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', // (optional) + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) enabled: false, // (optional) - apiKey: '[API_KEY]', // (optional) - apiSecret: '[API_SECRET]', // (optional) - from: '[FROM]', // (optional) + apiKey: '<API_KEY>', // (optional) + apiSecret: '<API_SECRET>', // (optional) + from: '<FROM>', // (optional) ); result.then((response) { diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index dfae56a6..aae1ab5c 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -8,8 +8,8 @@ Client client = Client() Storage storage = Storage(client); Future result = storage.createBucket( - bucketId: '[BUCKET_ID]', - name: '[NAME]', + bucketId: '<BUCKET_ID>', + name: '<NAME>', permissions: ["read("any")"], // (optional) fileSecurity: false, // (optional) enabled: false, // (optional) diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index 69aee405..565d213e 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -9,8 +9,8 @@ Client client = Client() Storage storage = Storage(client); Future result = storage.createFile( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', file: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'), permissions: ["read("any")"], // (optional) ); diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md index a3f164bd..2e6de8ac 100644 --- a/docs/examples/storage/delete-bucket.md +++ b/docs/examples/storage/delete-bucket.md @@ -8,7 +8,7 @@ Client client = Client() Storage storage = Storage(client); Future result = storage.deleteBucket( - bucketId: '[BUCKET_ID]', + bucketId: '<BUCKET_ID>', ); result.then((response) { diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index 677cea62..8027e44f 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -8,8 +8,8 @@ Client client = Client() Storage storage = Storage(client); Future result = storage.deleteFile( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', ); result.then((response) { diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md index daa9edd8..293194d7 100644 --- a/docs/examples/storage/get-bucket.md +++ b/docs/examples/storage/get-bucket.md @@ -8,7 +8,7 @@ Client client = Client() Storage storage = Storage(client); Future result = storage.getBucket( - bucketId: '[BUCKET_ID]', + bucketId: '<BUCKET_ID>', ); result.then((response) { diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index 9551d45b..1929b87d 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -8,8 +8,8 @@ Client client = Client() Storage storage = Storage(client); Future result = storage.getFileDownload( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', ); result.then((response) { diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 6ea895c2..ebda5c50 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -8,8 +8,8 @@ Client client = Client() Storage storage = Storage(client); Future result = storage.getFilePreview( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', width: 0, // (optional) height: 0, // (optional) gravity: ImageGravity.center, // (optional) diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index b576c43a..bd4679b7 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -8,8 +8,8 @@ Client client = Client() Storage storage = Storage(client); Future result = storage.getFileView( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', ); result.then((response) { diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index c6a21b76..96651d1e 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -8,8 +8,8 @@ Client client = Client() Storage storage = Storage(client); Future result = storage.getFile( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', ); result.then((response) { diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index d9010c8b..c13dc42a 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -9,7 +9,7 @@ Storage storage = Storage(client); Future result = storage.listBuckets( queries: [], // (optional) - search: '[SEARCH]', // (optional) + search: '<SEARCH>', // (optional) ); result.then((response) { diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index ace7391c..3dbb96de 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -8,9 +8,9 @@ Client client = Client() Storage storage = Storage(client); Future result = storage.listFiles( - bucketId: '[BUCKET_ID]', + bucketId: '<BUCKET_ID>', queries: [], // (optional) - search: '[SEARCH]', // (optional) + search: '<SEARCH>', // (optional) ); result.then((response) { diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index 33c84216..6292a1a8 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -8,8 +8,8 @@ Client client = Client() Storage storage = Storage(client); Future result = storage.updateBucket( - bucketId: '[BUCKET_ID]', - name: '[NAME]', + bucketId: '<BUCKET_ID>', + name: '<NAME>', permissions: ["read("any")"], // (optional) fileSecurity: false, // (optional) enabled: false, // (optional) diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index b31dd1b9..601542c6 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -8,9 +8,9 @@ Client client = Client() Storage storage = Storage(client); Future result = storage.updateFile( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', - name: '[NAME]', // (optional) + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + name: '<NAME>', // (optional) permissions: ["read("any")"], // (optional) ); diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 645b979e..c7c132c4 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -8,13 +8,13 @@ Client client = Client() Teams teams = Teams(client); Future result = teams.createMembership( - teamId: '[TEAM_ID]', + teamId: '<TEAM_ID>', roles: [], email: 'email@example.com', // (optional) - userId: '[USER_ID]', // (optional) + userId: '<USER_ID>', // (optional) phone: '+12065550100', // (optional) url: 'https://example.com', // (optional) - name: '[NAME]', // (optional) + name: '<NAME>', // (optional) ); result.then((response) { diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index 4616ed4b..9ab7fc4b 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -8,8 +8,8 @@ Client client = Client() Teams teams = Teams(client); Future result = teams.create( - teamId: '[TEAM_ID]', - name: '[NAME]', + teamId: '<TEAM_ID>', + name: '<NAME>', roles: [], // (optional) ); diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index 73f5a0db..56e20b01 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -8,8 +8,8 @@ Client client = Client() Teams teams = Teams(client); Future result = teams.deleteMembership( - teamId: '[TEAM_ID]', - membershipId: '[MEMBERSHIP_ID]', + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', ); result.then((response) { diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index d46e40d9..06e1630b 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -8,7 +8,7 @@ Client client = Client() Teams teams = Teams(client); Future result = teams.delete( - teamId: '[TEAM_ID]', + teamId: '<TEAM_ID>', ); result.then((response) { diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index b436cbf0..c16a7eb5 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -8,8 +8,8 @@ Client client = Client() Teams teams = Teams(client); Future result = teams.getMembership( - teamId: '[TEAM_ID]', - membershipId: '[MEMBERSHIP_ID]', + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', ); result.then((response) { diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index 9f3d13f6..ca5b8d44 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -8,7 +8,7 @@ Client client = Client() Teams teams = Teams(client); Future result = teams.getPrefs( - teamId: '[TEAM_ID]', + teamId: '<TEAM_ID>', ); result.then((response) { diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index 2665b60a..849b0735 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -8,7 +8,7 @@ Client client = Client() Teams teams = Teams(client); Future result = teams.get( - teamId: '[TEAM_ID]', + teamId: '<TEAM_ID>', ); result.then((response) { diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 19ff612b..ad519276 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -8,9 +8,9 @@ Client client = Client() Teams teams = Teams(client); Future result = teams.listMemberships( - teamId: '[TEAM_ID]', + teamId: '<TEAM_ID>', queries: [], // (optional) - search: '[SEARCH]', // (optional) + search: '<SEARCH>', // (optional) ); result.then((response) { diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index b2f8f42c..2f0aeb1a 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -9,7 +9,7 @@ Teams teams = Teams(client); Future result = teams.list( queries: [], // (optional) - search: '[SEARCH]', // (optional) + search: '<SEARCH>', // (optional) ); result.then((response) { diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index 184c3f91..bb5046f6 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -8,10 +8,10 @@ Client client = Client() Teams teams = Teams(client); Future result = teams.updateMembershipStatus( - teamId: '[TEAM_ID]', - membershipId: '[MEMBERSHIP_ID]', - userId: '[USER_ID]', - secret: '[SECRET]', + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', + userId: '<USER_ID>', + secret: '<SECRET>', ); result.then((response) { diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index 883f4428..f7092721 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -8,8 +8,8 @@ Client client = Client() Teams teams = Teams(client); Future result = teams.updateMembership( - teamId: '[TEAM_ID]', - membershipId: '[MEMBERSHIP_ID]', + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', roles: [], ); diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index dfdab2a4..9c066ab2 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -8,8 +8,8 @@ Client client = Client() Teams teams = Teams(client); Future result = teams.updateName( - teamId: '[TEAM_ID]', - name: '[NAME]', + teamId: '<TEAM_ID>', + name: '<NAME>', ); result.then((response) { diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index 87ef5d10..644f146c 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -8,7 +8,7 @@ Client client = Client() Teams teams = Teams(client); Future result = teams.updatePrefs( - teamId: '[TEAM_ID]', + teamId: '<TEAM_ID>', prefs: {}, ); diff --git a/docs/examples/users/create-argon2user.md b/docs/examples/users/create-argon2user.md index 96cfad67..6b7c36b7 100644 --- a/docs/examples/users/create-argon2user.md +++ b/docs/examples/users/create-argon2user.md @@ -8,10 +8,10 @@ Client client = Client() Users users = Users(client); Future result = users.createArgon2User( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', password: 'password', - name: '[NAME]', // (optional) + name: '<NAME>', // (optional) ); result.then((response) { diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md index c0e23bdc..02d0c9c6 100644 --- a/docs/examples/users/create-bcrypt-user.md +++ b/docs/examples/users/create-bcrypt-user.md @@ -8,10 +8,10 @@ Client client = Client() Users users = Users(client); Future result = users.createBcryptUser( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', password: 'password', - name: '[NAME]', // (optional) + name: '<NAME>', // (optional) ); result.then((response) { diff --git a/docs/examples/users/create-m-d5user.md b/docs/examples/users/create-m-d5user.md index a85f511f..771d3bac 100644 --- a/docs/examples/users/create-m-d5user.md +++ b/docs/examples/users/create-m-d5user.md @@ -8,10 +8,10 @@ Client client = Client() Users users = Users(client); Future result = users.createMD5User( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', password: 'password', - name: '[NAME]', // (optional) + name: '<NAME>', // (optional) ); result.then((response) { diff --git a/docs/examples/users/create-p-h-pass-user.md b/docs/examples/users/create-p-h-pass-user.md index a3168218..03576ab4 100644 --- a/docs/examples/users/create-p-h-pass-user.md +++ b/docs/examples/users/create-p-h-pass-user.md @@ -8,10 +8,10 @@ Client client = Client() Users users = Users(client); Future result = users.createPHPassUser( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', password: 'password', - name: '[NAME]', // (optional) + name: '<NAME>', // (optional) ); result.then((response) { diff --git a/docs/examples/users/create-s-h-a-user.md b/docs/examples/users/create-s-h-a-user.md index 195cbb65..35c34f07 100644 --- a/docs/examples/users/create-s-h-a-user.md +++ b/docs/examples/users/create-s-h-a-user.md @@ -8,11 +8,11 @@ Client client = Client() Users users = Users(client); Future result = users.createSHAUser( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', password: 'password', passwordVersion: PasswordHash.sha1, // (optional) - name: '[NAME]', // (optional) + name: '<NAME>', // (optional) ); result.then((response) { diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md index 25d33845..b6ff5304 100644 --- a/docs/examples/users/create-scrypt-modified-user.md +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -8,13 +8,13 @@ Client client = Client() Users users = Users(client); Future result = users.createScryptModifiedUser( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', password: 'password', - passwordSalt: '[PASSWORD_SALT]', - passwordSaltSeparator: '[PASSWORD_SALT_SEPARATOR]', - passwordSignerKey: '[PASSWORD_SIGNER_KEY]', - name: '[NAME]', // (optional) + passwordSalt: '<PASSWORD_SALT>', + passwordSaltSeparator: '<PASSWORD_SALT_SEPARATOR>', + passwordSignerKey: '<PASSWORD_SIGNER_KEY>', + name: '<NAME>', // (optional) ); result.then((response) { diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index 58facd69..32fe2162 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -8,15 +8,15 @@ Client client = Client() Users users = Users(client); Future result = users.createScryptUser( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', password: 'password', - passwordSalt: '[PASSWORD_SALT]', + passwordSalt: '<PASSWORD_SALT>', passwordCpu: 0, passwordMemory: 0, passwordParallel: 0, passwordLength: 0, - name: '[NAME]', // (optional) + name: '<NAME>', // (optional) ); result.then((response) { diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md index 17677553..617a79a5 100644 --- a/docs/examples/users/create-session.md +++ b/docs/examples/users/create-session.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.createSession( - userId: '[USER_ID]', + userId: '<USER_ID>', ); result.then((response) { diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md index 06b8c475..4478efac 100644 --- a/docs/examples/users/create-target.md +++ b/docs/examples/users/create-target.md @@ -8,12 +8,12 @@ Client client = Client() Users users = Users(client); Future result = users.createTarget( - userId: '[USER_ID]', - targetId: '[TARGET_ID]', + userId: '<USER_ID>', + targetId: '<TARGET_ID>', providerType: MessagingProviderType.email, - identifier: '[IDENTIFIER]', - providerId: '[PROVIDER_ID]', // (optional) - name: '[NAME]', // (optional) + identifier: '<IDENTIFIER>', + providerId: '<PROVIDER_ID>', // (optional) + name: '<NAME>', // (optional) ); result.then((response) { diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md index a1a2fe84..db7648e2 100644 --- a/docs/examples/users/create-token.md +++ b/docs/examples/users/create-token.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.createToken( - userId: '[USER_ID]', + userId: '<USER_ID>', length: 4, // (optional) expire: 60, // (optional) ); diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index a1ad5b09..d36dc92b 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -8,11 +8,11 @@ Client client = Client() Users users = Users(client); Future result = users.create( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', // (optional) phone: '+12065550100', // (optional) password: '', // (optional) - name: '[NAME]', // (optional) + name: '<NAME>', // (optional) ); result.then((response) { diff --git a/docs/examples/users/delete-authenticator.md b/docs/examples/users/delete-authenticator.md index f24006ee..2cd70f5a 100644 --- a/docs/examples/users/delete-authenticator.md +++ b/docs/examples/users/delete-authenticator.md @@ -8,9 +8,9 @@ Client client = Client() Users users = Users(client); Future result = users.deleteAuthenticator( - userId: '[USER_ID]', + userId: '<USER_ID>', type: AuthenticatorType.totp, - otp: '[OTP]', + otp: '<OTP>', ); result.then((response) { diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md index 275e6ce0..b35e1e6d 100644 --- a/docs/examples/users/delete-identity.md +++ b/docs/examples/users/delete-identity.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.deleteIdentity( - identityId: '[IDENTITY_ID]', + identityId: '<IDENTITY_ID>', ); result.then((response) { diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md index a56d2d7c..7173be72 100644 --- a/docs/examples/users/delete-session.md +++ b/docs/examples/users/delete-session.md @@ -8,8 +8,8 @@ Client client = Client() Users users = Users(client); Future result = users.deleteSession( - userId: '[USER_ID]', - sessionId: '[SESSION_ID]', + userId: '<USER_ID>', + sessionId: '<SESSION_ID>', ); result.then((response) { diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md index 76602dc2..57bacc38 100644 --- a/docs/examples/users/delete-sessions.md +++ b/docs/examples/users/delete-sessions.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.deleteSessions( - userId: '[USER_ID]', + userId: '<USER_ID>', ); result.then((response) { diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md index 783b8cda..e1a4427c 100644 --- a/docs/examples/users/delete-target.md +++ b/docs/examples/users/delete-target.md @@ -8,8 +8,8 @@ Client client = Client() Users users = Users(client); Future result = users.deleteTarget( - userId: '[USER_ID]', - targetId: '[TARGET_ID]', + userId: '<USER_ID>', + targetId: '<TARGET_ID>', ); result.then((response) { diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md index fbde5dce..8d8b8dbc 100644 --- a/docs/examples/users/delete.md +++ b/docs/examples/users/delete.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.delete( - userId: '[USER_ID]', + userId: '<USER_ID>', ); result.then((response) { diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md index 8ff31320..29826d14 100644 --- a/docs/examples/users/get-prefs.md +++ b/docs/examples/users/get-prefs.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.getPrefs( - userId: '[USER_ID]', + userId: '<USER_ID>', ); result.then((response) { diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md index 04e6b01a..0c6d8924 100644 --- a/docs/examples/users/get-target.md +++ b/docs/examples/users/get-target.md @@ -8,8 +8,8 @@ Client client = Client() Users users = Users(client); Future result = users.getTarget( - userId: '[USER_ID]', - targetId: '[TARGET_ID]', + userId: '<USER_ID>', + targetId: '<TARGET_ID>', ); result.then((response) { diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md index 29ef8e3a..1326523a 100644 --- a/docs/examples/users/get.md +++ b/docs/examples/users/get.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.get( - userId: '[USER_ID]', + userId: '<USER_ID>', ); result.then((response) { diff --git a/docs/examples/users/list-factors.md b/docs/examples/users/list-factors.md index af0d526a..4a53f77a 100644 --- a/docs/examples/users/list-factors.md +++ b/docs/examples/users/list-factors.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.listFactors( - userId: '[USER_ID]', + userId: '<USER_ID>', ); result.then((response) { diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index 702d821c..3283741a 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -9,7 +9,7 @@ Users users = Users(client); Future result = users.listIdentities( queries: [], // (optional) - search: '[SEARCH]', // (optional) + search: '<SEARCH>', // (optional) ); result.then((response) { diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index 1864e270..7df28f84 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.listLogs( - userId: '[USER_ID]', + userId: '<USER_ID>', queries: [], // (optional) ); diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index df23d429..df40f979 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.listMemberships( - userId: '[USER_ID]', + userId: '<USER_ID>', ); result.then((response) { diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index 5c76fc06..74bb4b01 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.listSessions( - userId: '[USER_ID]', + userId: '<USER_ID>', ); result.then((response) { diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md index 2cc05fdf..a02c4468 100644 --- a/docs/examples/users/list-targets.md +++ b/docs/examples/users/list-targets.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.listTargets( - userId: '[USER_ID]', + userId: '<USER_ID>', queries: [], // (optional) ); diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 6583d456..5faf585d 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -9,7 +9,7 @@ Users users = Users(client); Future result = users.list( queries: [], // (optional) - search: '[SEARCH]', // (optional) + search: '<SEARCH>', // (optional) ); result.then((response) { diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md index b91ce512..e207cce8 100644 --- a/docs/examples/users/update-email-verification.md +++ b/docs/examples/users/update-email-verification.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.updateEmailVerification( - userId: '[USER_ID]', + userId: '<USER_ID>', emailVerification: false, ); diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md index aee6fead..bf623ec6 100644 --- a/docs/examples/users/update-email.md +++ b/docs/examples/users/update-email.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.updateEmail( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', ); diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md index d6736ceb..984f4d35 100644 --- a/docs/examples/users/update-labels.md +++ b/docs/examples/users/update-labels.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.updateLabels( - userId: '[USER_ID]', + userId: '<USER_ID>', labels: [], ); diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md index 9b00eee4..73519810 100644 --- a/docs/examples/users/update-mfa.md +++ b/docs/examples/users/update-mfa.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.updateMfa( - userId: '[USER_ID]', + userId: '<USER_ID>', mfa: false, ); diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md index 4c3b4a90..3714671c 100644 --- a/docs/examples/users/update-name.md +++ b/docs/examples/users/update-name.md @@ -8,8 +8,8 @@ Client client = Client() Users users = Users(client); Future result = users.updateName( - userId: '[USER_ID]', - name: '[NAME]', + userId: '<USER_ID>', + name: '<NAME>', ); result.then((response) { diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index 79beeb29..48a77124 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.updatePassword( - userId: '[USER_ID]', + userId: '<USER_ID>', password: '', ); diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md index faa28a07..948750be 100644 --- a/docs/examples/users/update-phone-verification.md +++ b/docs/examples/users/update-phone-verification.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.updatePhoneVerification( - userId: '[USER_ID]', + userId: '<USER_ID>', phoneVerification: false, ); diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md index d380909c..ba9c2d85 100644 --- a/docs/examples/users/update-phone.md +++ b/docs/examples/users/update-phone.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.updatePhone( - userId: '[USER_ID]', + userId: '<USER_ID>', number: '+12065550100', ); diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md index adba3539..98454b79 100644 --- a/docs/examples/users/update-prefs.md +++ b/docs/examples/users/update-prefs.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.updatePrefs( - userId: '[USER_ID]', + userId: '<USER_ID>', prefs: {}, ); diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md index 65e870fe..ac07d08d 100644 --- a/docs/examples/users/update-status.md +++ b/docs/examples/users/update-status.md @@ -8,7 +8,7 @@ Client client = Client() Users users = Users(client); Future result = users.updateStatus( - userId: '[USER_ID]', + userId: '<USER_ID>', status: false, ); diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md index 117c8bd6..8e66a371 100644 --- a/docs/examples/users/update-target.md +++ b/docs/examples/users/update-target.md @@ -8,11 +8,11 @@ Client client = Client() Users users = Users(client); Future result = users.updateTarget( - userId: '[USER_ID]', - targetId: '[TARGET_ID]', - identifier: '[IDENTIFIER]', // (optional) - providerId: '[PROVIDER_ID]', // (optional) - name: '[NAME]', // (optional) + userId: '<USER_ID>', + targetId: '<TARGET_ID>', + identifier: '<IDENTIFIER>', // (optional) + providerId: '<PROVIDER_ID>', // (optional) + name: '<NAME>', // (optional) ); result.then((response) { diff --git a/example/README.md b/example/README.md index 208cc7f7..fc2c6d09 100644 --- a/example/README.md +++ b/example/README.md @@ -18,9 +18,11 @@ Create a new user: Users users = Users(client); User result = await users.create( - userId: '[USER_ID]', - email: 'email@example.com', - password: 'password', + userId: ID.unique(), + email: "email@example.com", + phone: "+123456789", + password: "password", + name: "Walter O'Brien" ); ``` @@ -57,4 +59,4 @@ storage.createFile( }); ``` -All examples and API features are available at the [official Appwrite docs](https://appwrite.io/docs) \ No newline at end of file +All examples and API features are available at the [official Appwrite docs](https://appwrite.io/docs) diff --git a/lib/enums.dart b/lib/enums.dart index 72874ca1..5c06f8a5 100644 --- a/lib/enums.dart +++ b/lib/enums.dart @@ -14,7 +14,7 @@ part 'src/enums/runtime.dart'; part 'src/enums/execution_method.dart'; part 'src/enums/name.dart'; part 'src/enums/message_status.dart'; -part 'src/enums/encryption.dart'; +part 'src/enums/smtp_encryption.dart'; part 'src/enums/compression.dart'; part 'src/enums/image_gravity.dart'; part 'src/enums/image_format.dart'; diff --git a/lib/services/account.dart b/lib/services/account.dart index fc887e87..bf51decd 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -208,7 +208,7 @@ class Account extends Service { /// Create 2FA Challenge /// - Future<models.MfaChallenge> create2FAChallenge({required enums.AuthenticationFactor factor}) async { + Future<models.MfaChallenge> createChallenge({required enums.AuthenticationFactor factor}) async { final String apiPath = '/account/mfa/challenge'; final Map<String, dynamic> apiParams = { @@ -673,27 +673,39 @@ class Account extends Service { /// about session /// limits](https://appwrite.io/docs/authentication-security#limits). /// - Future createOAuth2Session({required enums.OAuthProvider provider, String? success, String? failure, bool? token, List<String>? scopes}) async { + Future createOAuth2Session({required enums.OAuthProvider provider, String? success, String? failure, List<String>? scopes}) async { final String apiPath = '/account/sessions/oauth2/{provider}'.replaceAll('{provider}', provider.value); - final Map<String, dynamic> apiParams = { + final Map<String, dynamic> params = { 'success': success, 'failure': failure, -'token': token, 'scopes': scopes, - }; - - final Map<String, String> apiHeaders = { - 'content-type': 'application/json', - - }; - - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - - return res.data; - + '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); } /// Create session @@ -893,6 +905,57 @@ class Account extends Service { } + /// Create OAuth2 token + /// + /// 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<String>? scopes}) async { + final String apiPath = '/account/tokens/oauth2/{provider}'.replaceAll('{provider}', provider.value); + + final Map<String, dynamic> 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); + } + /// Create phone token /// /// Sends the user an SMS with a secret key for creating a session. If the diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 4fee4bde..41afd142 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -347,7 +347,7 @@ class Messaging extends Service { /// Create APNS provider /// /// Create a new Apple Push Notification service provider. - Future<models.Provider> createApnsProvider({required String providerId, required String name, String? authKey, String? authKeyId, String? teamId, String? bundleId, bool? enabled}) async { + Future<models.Provider> 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<String, dynamic> apiParams = { @@ -358,6 +358,7 @@ class Messaging extends Service { 'authKeyId': authKeyId, 'teamId': teamId, 'bundleId': bundleId, +'sandbox': sandbox, 'enabled': enabled, }; @@ -376,7 +377,7 @@ class Messaging extends Service { /// Update APNS provider /// /// Update a Apple Push Notification service provider by its unique ID. - Future<models.Provider> updateAPNSProvider({required String providerId, String? name, bool? enabled, String? authKey, String? authKeyId, String? teamId, String? bundleId}) async { + Future<models.Provider> 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<String, dynamic> apiParams = { @@ -387,6 +388,7 @@ class Messaging extends Service { 'authKeyId': authKeyId, 'teamId': teamId, 'bundleId': bundleId, +'sandbox': sandbox, }; @@ -430,7 +432,7 @@ class Messaging extends Service { /// Update FCM provider /// /// Update a Firebase Cloud Messaging provider by its unique ID. - Future<models.Provider> updateFCMProvider({required String providerId, String? name, bool? enabled, Map? serviceAccountJSON}) async { + Future<models.Provider> updateFcmProvider({required String providerId, String? name, bool? enabled, Map? serviceAccountJSON}) async { final String apiPath = '/messaging/providers/fcm/{providerId}'.replaceAll('{providerId}', providerId); final Map<String, dynamic> apiParams = { @@ -631,7 +633,7 @@ class Messaging extends Service { /// Create SMTP provider /// /// Create a new SMTP provider. - Future<models.Provider> createSmtpProvider({required String providerId, required String name, required String host, int? port, String? username, String? password, enums.Encryption? encryption, bool? autoTLS, String? mailer, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail, bool? enabled}) async { + Future<models.Provider> 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<String, dynamic> apiParams = { @@ -667,7 +669,7 @@ class Messaging extends Service { /// Update SMTP provider /// /// Update a SMTP provider by its unique ID. - Future<models.Provider> updateSmtpProvider({required String providerId, String? name, String? host, int? port, String? username, String? password, enums.Encryption? encryption, bool? autoTLS, String? mailer, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail, bool? enabled}) async { + Future<models.Provider> 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<String, dynamic> apiParams = { @@ -1086,12 +1088,13 @@ class Messaging extends Service { /// /// Update a topic by its unique ID. /// - Future<models.Topic> updateTopic({required String topicId, String? name}) async { + Future<models.Topic> updateTopic({required String topicId, String? name, List<String>? subscribe}) async { final String apiPath = '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); final Map<String, dynamic> apiParams = { 'name': name, +'subscribe': subscribe, }; diff --git a/lib/src/client.dart b/lib/src/client.dart index d3ce7f65..8dee2426 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -23,6 +23,9 @@ abstract class Client { bool selfSigned = false}) => createClient(endPoint: endPoint, selfSigned: selfSigned); + /// Handle OAuth2 session creation. + Future<String?> webAuth(Uri url); + /// Set self signed to [status]. /// /// If self signed is true, [Client] will ignore invalid certificates. @@ -56,11 +59,6 @@ abstract class Client { /// The user session to authenticate with Client setSession(value); - /// Set ForwardedFor - /// - /// The IP address of the client that made the request - Client setForwardedFor(value); - /// Set ForwardedUserAgent /// /// The user agent string of the client that made the request diff --git a/lib/src/client_base.dart b/lib/src/client_base.dart index a03d2adb..21992eb0 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -17,9 +17,6 @@ abstract class ClientBase implements Client { /// The user session to authenticate with @override ClientBase setSession(value); - /// The IP address of the client that made the request - @override - ClientBase setForwardedFor(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 699f7718..920853d3 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -33,7 +33,7 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '11.0.0-rc.4', + 'x-sdk-version': '11.0.0-rc.5', 'X-Appwrite-Response-Format' : '1.5.0', }; @@ -80,13 +80,6 @@ class ClientBrowser extends ClientBase with ClientMixin { addHeader('X-Appwrite-Session', value); return this; } - /// The IP address of the client that made the request - @override - ClientBrowser setForwardedFor(value) { - config['forwardedFor'] = value; - addHeader('X-Forwarded-For', value); - return this; - } /// The user agent string of the client that made the request @override ClientBrowser setForwardedUserAgent(value) { @@ -112,6 +105,14 @@ class ClientBrowser extends ClientBase with ClientMixin { return this; } + @override + Future<String?> webAuth(Uri url) async { + final request = http.Request('GET', url); + request.followRedirects = false; + final response = await _httpClient.send(request); + return response.headers['location']; + } + @override Future<Response> chunkedUpload({ required String path, diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index e0f31f8a..da8d3037 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -42,8 +42,8 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '11.0.0-rc.4', - 'user-agent' : 'AppwriteDartSDK/11.0.0-rc.4 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'x-sdk-version': '11.0.0-rc.5', + 'user-agent' : 'AppwriteDartSDK/11.0.0-rc.5 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', 'X-Appwrite-Response-Format' : '1.5.0', }; @@ -89,13 +89,6 @@ class ClientIO extends ClientBase with ClientMixin { config['session'] = value; addHeader('X-Appwrite-Session', value); return this; - } - /// The IP address of the client that made the request - @override - ClientIO setForwardedFor(value) { - config['forwardedFor'] = value; - addHeader('X-Forwarded-For', value); - return this; } /// The user agent string of the client that made the request @override @@ -220,6 +213,14 @@ class ClientIO extends ClientBase with ClientMixin { return res; } + @override + Future<String?> webAuth(Uri url) async { + final request = http.Request('GET', url); + request.followRedirects = false; + final response = await _httpClient.send(request); + return response.headers['location']; + } + @override Future<Response> call( HttpMethod method, { diff --git a/lib/src/enums/encryption.dart b/lib/src/enums/smtp_encryption.dart similarity index 79% rename from lib/src/enums/encryption.dart rename to lib/src/enums/smtp_encryption.dart index 17ccf9b7..c416f6b7 100644 --- a/lib/src/enums/encryption.dart +++ b/lib/src/enums/smtp_encryption.dart @@ -1,11 +1,11 @@ part of dart_appwrite.enums; -enum Encryption { +enum SmtpEncryption { none(value: 'none'), ssl(value: 'ssl'), tls(value: 'tls'); - const Encryption({ + const SmtpEncryption({ required this.value }); diff --git a/pubspec.yaml b/pubspec.yaml index 588b0b79..63915340 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: dart_appwrite -version: 11.0.0-rc.4 +version: 11.0.0-rc.5 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 diff --git a/test/services/account_test.dart b/test/services/account_test.dart index a3d245cd..db8a17f2 100644 --- a/test/services/account_test.dart +++ b/test/services/account_test.dart @@ -113,7 +113,7 @@ void main() { final response = await account.create( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', password: '', ); @@ -181,7 +181,7 @@ void main() { final response = await account.deleteIdentity( - identityId: '[IDENTITY_ID]', + identityId: '<IDENTITY_ID>', ); }); @@ -251,7 +251,7 @@ void main() { }); - test('test method create2FAChallenge()', () async { + test('test method createChallenge()', () async { final Map<String, dynamic> data = { '\$id': 'bb8ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', @@ -264,7 +264,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await account.create2FAChallenge( + final response = await account.createChallenge( factor: 'totp', ); expect(response, isA<models.MfaChallenge>()); @@ -280,8 +280,8 @@ void main() { final response = await account.updateChallenge( - challengeId: '[CHALLENGE_ID]', - otp: '[OTP]', + challengeId: '<CHALLENGE_ID>', + otp: '<OTP>', ); }); @@ -350,7 +350,7 @@ void main() { final response = await account.verifyAuthenticator( type: 'totp', - otp: '[OTP]', + otp: '<OTP>', ); expect(response, isA<models.User>()); @@ -384,7 +384,7 @@ void main() { final response = await account.deleteAuthenticator( type: 'totp', - otp: '[OTP]', + otp: '<OTP>', ); expect(response, isA<models.User>()); @@ -417,7 +417,7 @@ void main() { final response = await account.updateName( - name: '[NAME]', + name: '<NAME>', ); expect(response, isA<models.User>()); @@ -577,8 +577,8 @@ void main() { final response = await account.updateRecovery( - userId: '[USER_ID]', - secret: '[SECRET]', + userId: '<USER_ID>', + secret: '<SECRET>', password: '', ); expect(response, isA<models.Token>()); @@ -737,8 +737,8 @@ void main() { final response = await account.updateMagicURLSession( - userId: '[USER_ID]', - secret: '[SECRET]', + userId: '<USER_ID>', + secret: '<SECRET>', ); expect(response, isA<models.Session>()); @@ -793,8 +793,8 @@ void main() { final response = await account.createSession( - userId: '[USER_ID]', - secret: '[SECRET]', + userId: '<USER_ID>', + secret: '<SECRET>', ); expect(response, isA<models.Session>()); @@ -837,7 +837,7 @@ void main() { final response = await account.getSession( - sessionId: '[SESSION_ID]', + sessionId: '<SESSION_ID>', ); expect(response, isA<models.Session>()); @@ -880,7 +880,7 @@ void main() { final response = await account.updateSession( - sessionId: '[SESSION_ID]', + sessionId: '<SESSION_ID>', ); expect(response, isA<models.Session>()); @@ -895,7 +895,7 @@ void main() { final response = await account.deleteSession( - sessionId: '[SESSION_ID]', + sessionId: '<SESSION_ID>', ); }); @@ -947,7 +947,7 @@ void main() { final response = await account.createEmailToken( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', ); expect(response, isA<models.Token>()); @@ -970,13 +970,25 @@ void main() { final response = await account.createMagicURLToken( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', ); expect(response, isA<models.Token>()); }); + test('test method createOAuth2Token()', () async { + + when(client.webAuth( + Uri(), + )).thenAnswer((_) async => 'done'); + + + final response = await account.createOAuth2Token( + provider: 'amazon', + ); + }); + test('test method createPhoneToken()', () async { final Map<String, dynamic> data = { '\$id': 'bb8ea5c16897e', @@ -993,7 +1005,7 @@ void main() { final response = await account.createPhoneToken( - userId: '[USER_ID]', + userId: '<USER_ID>', phone: '+12065550100', ); expect(response, isA<models.Token>()); @@ -1038,8 +1050,8 @@ void main() { final response = await account.updateVerification( - userId: '[USER_ID]', - secret: '[SECRET]', + userId: '<USER_ID>', + secret: '<SECRET>', ); expect(response, isA<models.Token>()); @@ -1082,8 +1094,8 @@ void main() { final response = await account.updatePhoneVerification( - userId: '[USER_ID]', - secret: '[SECRET]', + userId: '<USER_ID>', + secret: '<SECRET>', ); expect(response, isA<models.Token>()); diff --git a/test/services/avatars_test.dart b/test/services/avatars_test.dart index db6ea9cd..aaf84313 100644 --- a/test/services/avatars_test.dart +++ b/test/services/avatars_test.dart @@ -145,7 +145,7 @@ void main() { final response = await avatars.getQR( - text: '[TEXT]', + text: '<TEXT>', ); expect(response, isA<Uint8List>()); diff --git a/test/services/databases_test.dart b/test/services/databases_test.dart index 400d800f..94369bce 100644 --- a/test/services/databases_test.dart +++ b/test/services/databases_test.dart @@ -86,8 +86,8 @@ void main() { final response = await databases.create( - databaseId: '[DATABASE_ID]', - name: '[NAME]', + databaseId: '<DATABASE_ID>', + name: '<NAME>', ); expect(response, isA<models.Database>()); @@ -108,7 +108,7 @@ void main() { final response = await databases.get( - databaseId: '[DATABASE_ID]', + databaseId: '<DATABASE_ID>', ); expect(response, isA<models.Database>()); @@ -129,8 +129,8 @@ void main() { final response = await databases.update( - databaseId: '[DATABASE_ID]', - name: '[NAME]', + databaseId: '<DATABASE_ID>', + name: '<NAME>', ); expect(response, isA<models.Database>()); @@ -145,7 +145,7 @@ void main() { final response = await databases.delete( - databaseId: '[DATABASE_ID]', + databaseId: '<DATABASE_ID>', ); }); @@ -161,7 +161,7 @@ void main() { final response = await databases.listCollections( - databaseId: '[DATABASE_ID]', + databaseId: '<DATABASE_ID>', ); expect(response, isA<models.CollectionList>()); @@ -187,9 +187,9 @@ void main() { final response = await databases.createCollection( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - name: '[NAME]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + name: '<NAME>', ); expect(response, isA<models.Collection>()); @@ -215,8 +215,8 @@ void main() { final response = await databases.getCollection( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', ); expect(response, isA<models.Collection>()); @@ -242,9 +242,9 @@ void main() { final response = await databases.updateCollection( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - name: '[NAME]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + name: '<NAME>', ); expect(response, isA<models.Collection>()); @@ -259,8 +259,8 @@ void main() { final response = await databases.deleteCollection( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', ); }); @@ -276,8 +276,8 @@ void main() { final response = await databases.listAttributes( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', ); expect(response, isA<models.AttributeList>()); @@ -298,8 +298,8 @@ void main() { final response = await databases.createBooleanAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', xrequired: true, ); @@ -322,8 +322,8 @@ void main() { final response = await databases.updateBooleanAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', xrequired: true, xdefault: true, @@ -348,8 +348,8 @@ void main() { final response = await databases.createDatetimeAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', xrequired: true, ); @@ -373,8 +373,8 @@ void main() { final response = await databases.updateDatetimeAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', xrequired: true, xdefault: '', @@ -399,8 +399,8 @@ void main() { final response = await databases.createEmailAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', xrequired: true, ); @@ -424,8 +424,8 @@ void main() { final response = await databases.updateEmailAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', xrequired: true, xdefault: 'email@example.com', @@ -451,8 +451,8 @@ void main() { final response = await databases.createEnumAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', elements: [], xrequired: true, @@ -478,12 +478,12 @@ void main() { final response = await databases.updateEnumAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', elements: [], xrequired: true, - xdefault: '[DEFAULT]', + xdefault: '<DEFAULT>', ); expect(response, isA<models.AttributeEnum>()); @@ -504,8 +504,8 @@ void main() { final response = await databases.createFloatAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', xrequired: true, ); @@ -528,8 +528,8 @@ void main() { final response = await databases.updateFloatAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', xrequired: true, min: 1.0, @@ -555,8 +555,8 @@ void main() { final response = await databases.createIntegerAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', xrequired: true, ); @@ -579,8 +579,8 @@ void main() { final response = await databases.updateIntegerAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', xrequired: true, min: 1, @@ -607,8 +607,8 @@ void main() { final response = await databases.createIpAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', xrequired: true, ); @@ -632,8 +632,8 @@ void main() { final response = await databases.updateIpAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', xrequired: true, xdefault: '', @@ -663,9 +663,9 @@ void main() { final response = await databases.createRelationshipAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - relatedCollectionId: '[RELATED_COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + relatedCollectionId: '<RELATED_COLLECTION_ID>', type: 'oneToOne', ); expect(response, isA<models.AttributeRelationship>()); @@ -688,8 +688,8 @@ void main() { final response = await databases.createStringAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', size: 1, xrequired: true, @@ -714,11 +714,11 @@ void main() { final response = await databases.updateStringAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', xrequired: true, - xdefault: '[DEFAULT]', + xdefault: '<DEFAULT>', ); expect(response, isA<models.AttributeString>()); @@ -740,8 +740,8 @@ void main() { final response = await databases.createUrlAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', xrequired: true, ); @@ -765,8 +765,8 @@ void main() { final response = await databases.updateUrlAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', xrequired: true, xdefault: 'https://example.com', @@ -784,8 +784,8 @@ void main() { final response = await databases.getAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', ); }); @@ -799,8 +799,8 @@ void main() { final response = await databases.deleteAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', ); }); @@ -826,8 +826,8 @@ void main() { final response = await databases.updateRelationshipAttribute( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', ); expect(response, isA<models.AttributeRelationship>()); @@ -846,8 +846,8 @@ void main() { final response = await databases.listDocuments( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', ); expect(response, isA<models.DocumentList>()); @@ -869,9 +869,9 @@ void main() { final response = await databases.createDocument( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - documentId: '[DOCUMENT_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', data: {}, ); expect(response, isA<models.Document>()); @@ -894,9 +894,9 @@ void main() { final response = await databases.getDocument( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - documentId: '[DOCUMENT_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', ); expect(response, isA<models.Document>()); @@ -918,9 +918,9 @@ void main() { final response = await databases.updateDocument( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - documentId: '[DOCUMENT_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', ); expect(response, isA<models.Document>()); @@ -935,9 +935,9 @@ void main() { final response = await databases.deleteDocument( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', - documentId: '[DOCUMENT_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', ); }); @@ -953,8 +953,8 @@ void main() { final response = await databases.listIndexes( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', ); expect(response, isA<models.IndexList>()); @@ -975,8 +975,8 @@ void main() { final response = await databases.createIndex( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', type: 'key', attributes: [], @@ -1000,8 +1000,8 @@ void main() { final response = await databases.getIndex( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', ); expect(response, isA<models.Index>()); @@ -1017,8 +1017,8 @@ void main() { final response = await databases.deleteIndex( - databaseId: '[DATABASE_ID]', - collectionId: '[COLLECTION_ID]', + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', key: '', ); }); diff --git a/test/services/functions_test.dart b/test/services/functions_test.dart index 119db32b..267db168 100644 --- a/test/services/functions_test.dart +++ b/test/services/functions_test.dart @@ -103,8 +103,8 @@ void main() { final response = await functions.create( - functionId: '[FUNCTION_ID]', - name: '[NAME]', + functionId: '<FUNCTION_ID>', + name: '<NAME>', runtime: 'node-14.5', ); expect(response, isA<models.Func>()); @@ -160,7 +160,7 @@ void main() { final response = await functions.get( - functionId: '[FUNCTION_ID]', + functionId: '<FUNCTION_ID>', ); expect(response, isA<models.Func>()); @@ -198,8 +198,8 @@ void main() { final response = await functions.update( - functionId: '[FUNCTION_ID]', - name: '[NAME]', + functionId: '<FUNCTION_ID>', + name: '<NAME>', ); expect(response, isA<models.Func>()); @@ -214,7 +214,7 @@ void main() { final response = await functions.delete( - functionId: '[FUNCTION_ID]', + functionId: '<FUNCTION_ID>', ); }); @@ -230,7 +230,7 @@ void main() { final response = await functions.listDeployments( - functionId: '[FUNCTION_ID]', + functionId: '<FUNCTION_ID>', ); expect(response, isA<models.DeploymentList>()); @@ -273,7 +273,7 @@ void main() { final response = await functions.createDeployment( - functionId: '[FUNCTION_ID]', + functionId: '<FUNCTION_ID>', code: InputFile.fromPath(path: './image.png'), activate: true, ); @@ -314,8 +314,8 @@ void main() { final response = await functions.getDeployment( - functionId: '[FUNCTION_ID]', - deploymentId: '[DEPLOYMENT_ID]', + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>', ); expect(response, isA<models.Deployment>()); @@ -353,8 +353,8 @@ void main() { final response = await functions.updateDeployment( - functionId: '[FUNCTION_ID]', - deploymentId: '[DEPLOYMENT_ID]', + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>', ); expect(response, isA<models.Func>()); @@ -369,8 +369,8 @@ void main() { final response = await functions.deleteDeployment( - functionId: '[FUNCTION_ID]', - deploymentId: '[DEPLOYMENT_ID]', + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>', ); }); @@ -383,9 +383,9 @@ void main() { final response = await functions.createBuild( - functionId: '[FUNCTION_ID]', - deploymentId: '[DEPLOYMENT_ID]', - buildId: '[BUILD_ID]', + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>', + buildId: '<BUILD_ID>', ); }); @@ -397,8 +397,8 @@ void main() { final response = await functions.downloadDeployment( - functionId: '[FUNCTION_ID]', - deploymentId: '[DEPLOYMENT_ID]', + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>', ); expect(response, isA<Uint8List>()); @@ -416,7 +416,7 @@ void main() { final response = await functions.listExecutions( - functionId: '[FUNCTION_ID]', + functionId: '<FUNCTION_ID>', ); expect(response, isA<models.ExecutionList>()); @@ -448,7 +448,7 @@ void main() { final response = await functions.createExecution( - functionId: '[FUNCTION_ID]', + functionId: '<FUNCTION_ID>', ); expect(response, isA<models.Execution>()); @@ -480,8 +480,8 @@ void main() { final response = await functions.getExecution( - functionId: '[FUNCTION_ID]', - executionId: '[EXECUTION_ID]', + functionId: '<FUNCTION_ID>', + executionId: '<EXECUTION_ID>', ); expect(response, isA<models.Execution>()); @@ -499,7 +499,7 @@ void main() { final response = await functions.listVariables( - functionId: '[FUNCTION_ID]', + functionId: '<FUNCTION_ID>', ); expect(response, isA<models.VariableList>()); @@ -522,9 +522,9 @@ void main() { final response = await functions.createVariable( - functionId: '[FUNCTION_ID]', - key: '[KEY]', - value: '[VALUE]', + functionId: '<FUNCTION_ID>', + key: '<KEY>', + value: '<VALUE>', ); expect(response, isA<models.Variable>()); @@ -547,8 +547,8 @@ void main() { final response = await functions.getVariable( - functionId: '[FUNCTION_ID]', - variableId: '[VARIABLE_ID]', + functionId: '<FUNCTION_ID>', + variableId: '<VARIABLE_ID>', ); expect(response, isA<models.Variable>()); @@ -571,9 +571,9 @@ void main() { final response = await functions.updateVariable( - functionId: '[FUNCTION_ID]', - variableId: '[VARIABLE_ID]', - key: '[KEY]', + functionId: '<FUNCTION_ID>', + variableId: '<VARIABLE_ID>', + key: '<KEY>', ); expect(response, isA<models.Variable>()); @@ -588,8 +588,8 @@ void main() { final response = await functions.deleteVariable( - functionId: '[FUNCTION_ID]', - variableId: '[VARIABLE_ID]', + functionId: '<FUNCTION_ID>', + variableId: '<VARIABLE_ID>', ); }); diff --git a/test/services/messaging_test.dart b/test/services/messaging_test.dart index a985baae..2b2bf8cd 100644 --- a/test/services/messaging_test.dart +++ b/test/services/messaging_test.dart @@ -91,9 +91,9 @@ void main() { final response = await messaging.createEmail( - messageId: '[MESSAGE_ID]', - subject: '[SUBJECT]', - content: '[CONTENT]', + messageId: '<MESSAGE_ID>', + subject: '<SUBJECT>', + content: '<CONTENT>', ); expect(response, isA<models.Message>()); @@ -119,7 +119,7 @@ void main() { final response = await messaging.updateEmail( - messageId: '[MESSAGE_ID]', + messageId: '<MESSAGE_ID>', ); expect(response, isA<models.Message>()); @@ -145,9 +145,9 @@ void main() { final response = await messaging.createPush( - messageId: '[MESSAGE_ID]', - title: '[TITLE]', - body: '[BODY]', + messageId: '<MESSAGE_ID>', + title: '<TITLE>', + body: '<BODY>', ); expect(response, isA<models.Message>()); @@ -173,7 +173,7 @@ void main() { final response = await messaging.updatePush( - messageId: '[MESSAGE_ID]', + messageId: '<MESSAGE_ID>', ); expect(response, isA<models.Message>()); @@ -199,8 +199,8 @@ void main() { final response = await messaging.createSms( - messageId: '[MESSAGE_ID]', - content: '[CONTENT]', + messageId: '<MESSAGE_ID>', + content: '<CONTENT>', ); expect(response, isA<models.Message>()); @@ -226,7 +226,7 @@ void main() { final response = await messaging.updateSms( - messageId: '[MESSAGE_ID]', + messageId: '<MESSAGE_ID>', ); expect(response, isA<models.Message>()); @@ -252,7 +252,7 @@ void main() { final response = await messaging.getMessage( - messageId: '[MESSAGE_ID]', + messageId: '<MESSAGE_ID>', ); expect(response, isA<models.Message>()); @@ -267,7 +267,7 @@ void main() { final response = await messaging.delete( - messageId: '[MESSAGE_ID]', + messageId: '<MESSAGE_ID>', ); }); @@ -283,7 +283,7 @@ void main() { final response = await messaging.listMessageLogs( - messageId: '[MESSAGE_ID]', + messageId: '<MESSAGE_ID>', ); expect(response, isA<models.LogList>()); @@ -301,7 +301,7 @@ void main() { final response = await messaging.listTargets( - messageId: '[MESSAGE_ID]', + messageId: '<MESSAGE_ID>', ); expect(response, isA<models.TargetList>()); @@ -342,14 +342,14 @@ void main() { final response = await messaging.createApnsProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', + providerId: '<PROVIDER_ID>', + name: '<NAME>', ); expect(response, isA<models.Provider>()); }); - test('test method updateAPNSProvider()', () async { + test('test method updateApnsProvider()', () async { final Map<String, dynamic> data = { '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', @@ -366,8 +366,8 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await messaging.updateAPNSProvider( - providerId: '[PROVIDER_ID]', + final response = await messaging.updateApnsProvider( + providerId: '<PROVIDER_ID>', ); expect(response, isA<models.Provider>()); @@ -391,14 +391,14 @@ void main() { final response = await messaging.createFcmProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', + providerId: '<PROVIDER_ID>', + name: '<NAME>', ); expect(response, isA<models.Provider>()); }); - test('test method updateFCMProvider()', () async { + test('test method updateFcmProvider()', () async { final Map<String, dynamic> data = { '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', @@ -415,8 +415,8 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await messaging.updateFCMProvider( - providerId: '[PROVIDER_ID]', + final response = await messaging.updateFcmProvider( + providerId: '<PROVIDER_ID>', ); expect(response, isA<models.Provider>()); @@ -440,8 +440,8 @@ void main() { final response = await messaging.createMailgunProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', + providerId: '<PROVIDER_ID>', + name: '<NAME>', ); expect(response, isA<models.Provider>()); @@ -465,7 +465,7 @@ void main() { final response = await messaging.updateMailgunProvider( - providerId: '[PROVIDER_ID]', + providerId: '<PROVIDER_ID>', ); expect(response, isA<models.Provider>()); @@ -489,8 +489,8 @@ void main() { final response = await messaging.createMsg91Provider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', + providerId: '<PROVIDER_ID>', + name: '<NAME>', ); expect(response, isA<models.Provider>()); @@ -514,7 +514,7 @@ void main() { final response = await messaging.updateMsg91Provider( - providerId: '[PROVIDER_ID]', + providerId: '<PROVIDER_ID>', ); expect(response, isA<models.Provider>()); @@ -538,8 +538,8 @@ void main() { final response = await messaging.createSendgridProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', + providerId: '<PROVIDER_ID>', + name: '<NAME>', ); expect(response, isA<models.Provider>()); @@ -563,7 +563,7 @@ void main() { final response = await messaging.updateSendgridProvider( - providerId: '[PROVIDER_ID]', + providerId: '<PROVIDER_ID>', ); expect(response, isA<models.Provider>()); @@ -587,9 +587,9 @@ void main() { final response = await messaging.createSmtpProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', - host: '[HOST]', + providerId: '<PROVIDER_ID>', + name: '<NAME>', + host: '<HOST>', ); expect(response, isA<models.Provider>()); @@ -613,7 +613,7 @@ void main() { final response = await messaging.updateSmtpProvider( - providerId: '[PROVIDER_ID]', + providerId: '<PROVIDER_ID>', ); expect(response, isA<models.Provider>()); @@ -637,8 +637,8 @@ void main() { final response = await messaging.createTelesignProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', + providerId: '<PROVIDER_ID>', + name: '<NAME>', ); expect(response, isA<models.Provider>()); @@ -662,7 +662,7 @@ void main() { final response = await messaging.updateTelesignProvider( - providerId: '[PROVIDER_ID]', + providerId: '<PROVIDER_ID>', ); expect(response, isA<models.Provider>()); @@ -686,8 +686,8 @@ void main() { final response = await messaging.createTextmagicProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', + providerId: '<PROVIDER_ID>', + name: '<NAME>', ); expect(response, isA<models.Provider>()); @@ -711,7 +711,7 @@ void main() { final response = await messaging.updateTextmagicProvider( - providerId: '[PROVIDER_ID]', + providerId: '<PROVIDER_ID>', ); expect(response, isA<models.Provider>()); @@ -735,8 +735,8 @@ void main() { final response = await messaging.createTwilioProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', + providerId: '<PROVIDER_ID>', + name: '<NAME>', ); expect(response, isA<models.Provider>()); @@ -760,7 +760,7 @@ void main() { final response = await messaging.updateTwilioProvider( - providerId: '[PROVIDER_ID]', + providerId: '<PROVIDER_ID>', ); expect(response, isA<models.Provider>()); @@ -784,8 +784,8 @@ void main() { final response = await messaging.createVonageProvider( - providerId: '[PROVIDER_ID]', - name: '[NAME]', + providerId: '<PROVIDER_ID>', + name: '<NAME>', ); expect(response, isA<models.Provider>()); @@ -809,7 +809,7 @@ void main() { final response = await messaging.updateVonageProvider( - providerId: '[PROVIDER_ID]', + providerId: '<PROVIDER_ID>', ); expect(response, isA<models.Provider>()); @@ -833,7 +833,7 @@ void main() { final response = await messaging.getProvider( - providerId: '[PROVIDER_ID]', + providerId: '<PROVIDER_ID>', ); expect(response, isA<models.Provider>()); @@ -848,7 +848,7 @@ void main() { final response = await messaging.deleteProvider( - providerId: '[PROVIDER_ID]', + providerId: '<PROVIDER_ID>', ); }); @@ -864,7 +864,7 @@ void main() { final response = await messaging.listProviderLogs( - providerId: '[PROVIDER_ID]', + providerId: '<PROVIDER_ID>', ); expect(response, isA<models.LogList>()); @@ -882,7 +882,7 @@ void main() { final response = await messaging.listSubscriberLogs( - subscriberId: '[SUBSCRIBER_ID]', + subscriberId: '<SUBSCRIBER_ID>', ); expect(response, isA<models.LogList>()); @@ -923,8 +923,8 @@ void main() { final response = await messaging.createTopic( - topicId: '[TOPIC_ID]', - name: '[NAME]', + topicId: '<TOPIC_ID>', + name: '<NAME>', ); expect(response, isA<models.Topic>()); @@ -948,7 +948,7 @@ void main() { final response = await messaging.getTopic( - topicId: '[TOPIC_ID]', + topicId: '<TOPIC_ID>', ); expect(response, isA<models.Topic>()); @@ -972,7 +972,7 @@ void main() { final response = await messaging.updateTopic( - topicId: '[TOPIC_ID]', + topicId: '<TOPIC_ID>', ); expect(response, isA<models.Topic>()); @@ -987,7 +987,7 @@ void main() { final response = await messaging.deleteTopic( - topicId: '[TOPIC_ID]', + topicId: '<TOPIC_ID>', ); }); @@ -1003,7 +1003,7 @@ void main() { final response = await messaging.listTopicLogs( - topicId: '[TOPIC_ID]', + topicId: '<TOPIC_ID>', ); expect(response, isA<models.LogList>()); @@ -1021,7 +1021,7 @@ void main() { final response = await messaging.listSubscribers( - topicId: '[TOPIC_ID]', + topicId: '<TOPIC_ID>', ); expect(response, isA<models.SubscriberList>()); @@ -1046,9 +1046,9 @@ void main() { final response = await messaging.createSubscriber( - topicId: '[TOPIC_ID]', - subscriberId: '[SUBSCRIBER_ID]', - targetId: '[TARGET_ID]', + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>', + targetId: '<TARGET_ID>', ); expect(response, isA<models.Subscriber>()); @@ -1073,8 +1073,8 @@ void main() { final response = await messaging.getSubscriber( - topicId: '[TOPIC_ID]', - subscriberId: '[SUBSCRIBER_ID]', + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>', ); expect(response, isA<models.Subscriber>()); @@ -1089,8 +1089,8 @@ void main() { final response = await messaging.deleteSubscriber( - topicId: '[TOPIC_ID]', - subscriberId: '[SUBSCRIBER_ID]', + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>', ); }); diff --git a/test/services/storage_test.dart b/test/services/storage_test.dart index 78ed21c7..c2a81fab 100644 --- a/test/services/storage_test.dart +++ b/test/services/storage_test.dart @@ -93,8 +93,8 @@ void main() { final response = await storage.createBucket( - bucketId: '[BUCKET_ID]', - name: '[NAME]', + bucketId: '<BUCKET_ID>', + name: '<NAME>', ); expect(response, isA<models.Bucket>()); @@ -122,7 +122,7 @@ void main() { final response = await storage.getBucket( - bucketId: '[BUCKET_ID]', + bucketId: '<BUCKET_ID>', ); expect(response, isA<models.Bucket>()); @@ -150,8 +150,8 @@ void main() { final response = await storage.updateBucket( - bucketId: '[BUCKET_ID]', - name: '[NAME]', + bucketId: '<BUCKET_ID>', + name: '<NAME>', ); expect(response, isA<models.Bucket>()); @@ -166,7 +166,7 @@ void main() { final response = await storage.deleteBucket( - bucketId: '[BUCKET_ID]', + bucketId: '<BUCKET_ID>', ); }); @@ -182,7 +182,7 @@ void main() { final response = await storage.listFiles( - bucketId: '[BUCKET_ID]', + bucketId: '<BUCKET_ID>', ); expect(response, isA<models.FileList>()); @@ -213,8 +213,8 @@ void main() { final response = await storage.createFile( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', file: InputFile.fromPath(path: './image.png'), ); expect(response, isA<models.File>()); @@ -242,8 +242,8 @@ void main() { final response = await storage.getFile( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', ); expect(response, isA<models.File>()); @@ -270,8 +270,8 @@ void main() { final response = await storage.updateFile( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', ); expect(response, isA<models.File>()); @@ -286,8 +286,8 @@ void main() { final response = await storage.deleteFile( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', ); }); @@ -299,8 +299,8 @@ void main() { final response = await storage.getFileDownload( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', ); expect(response, isA<Uint8List>()); @@ -314,8 +314,8 @@ void main() { final response = await storage.getFilePreview( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', ); expect(response, isA<Uint8List>()); @@ -329,8 +329,8 @@ void main() { final response = await storage.getFileView( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', ); expect(response, isA<Uint8List>()); diff --git a/test/services/teams_test.dart b/test/services/teams_test.dart index b84981f5..891610e1 100644 --- a/test/services/teams_test.dart +++ b/test/services/teams_test.dart @@ -87,8 +87,8 @@ void main() { final response = await teams.create( - teamId: '[TEAM_ID]', - name: '[NAME]', + teamId: '<TEAM_ID>', + name: '<NAME>', ); expect(response, isA<models.Team>()); @@ -110,7 +110,7 @@ void main() { final response = await teams.get( - teamId: '[TEAM_ID]', + teamId: '<TEAM_ID>', ); expect(response, isA<models.Team>()); @@ -132,8 +132,8 @@ void main() { final response = await teams.updateName( - teamId: '[TEAM_ID]', - name: '[NAME]', + teamId: '<TEAM_ID>', + name: '<NAME>', ); expect(response, isA<models.Team>()); @@ -148,7 +148,7 @@ void main() { final response = await teams.delete( - teamId: '[TEAM_ID]', + teamId: '<TEAM_ID>', ); }); @@ -164,7 +164,7 @@ void main() { final response = await teams.listMemberships( - teamId: '[TEAM_ID]', + teamId: '<TEAM_ID>', ); expect(response, isA<models.MembershipList>()); @@ -193,7 +193,7 @@ void main() { final response = await teams.createMembership( - teamId: '[TEAM_ID]', + teamId: '<TEAM_ID>', roles: [], ); expect(response, isA<models.Membership>()); @@ -223,8 +223,8 @@ void main() { final response = await teams.getMembership( - teamId: '[TEAM_ID]', - membershipId: '[MEMBERSHIP_ID]', + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', ); expect(response, isA<models.Membership>()); @@ -253,8 +253,8 @@ void main() { final response = await teams.updateMembership( - teamId: '[TEAM_ID]', - membershipId: '[MEMBERSHIP_ID]', + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', roles: [], ); expect(response, isA<models.Membership>()); @@ -270,8 +270,8 @@ void main() { final response = await teams.deleteMembership( - teamId: '[TEAM_ID]', - membershipId: '[MEMBERSHIP_ID]', + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', ); }); @@ -298,10 +298,10 @@ void main() { final response = await teams.updateMembershipStatus( - teamId: '[TEAM_ID]', - membershipId: '[MEMBERSHIP_ID]', - userId: '[USER_ID]', - secret: '[SECRET]', + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', + userId: '<USER_ID>', + secret: '<SECRET>', ); expect(response, isA<models.Membership>()); @@ -317,7 +317,7 @@ void main() { final response = await teams.getPrefs( - teamId: '[TEAM_ID]', + teamId: '<TEAM_ID>', ); expect(response, isA<models.Preferences>()); @@ -333,7 +333,7 @@ void main() { final response = await teams.updatePrefs( - teamId: '[TEAM_ID]', + teamId: '<TEAM_ID>', prefs: {}, ); expect(response, isA<models.Preferences>()); diff --git a/test/services/users_test.dart b/test/services/users_test.dart index 99d2f50f..fc8e2489 100644 --- a/test/services/users_test.dart +++ b/test/services/users_test.dart @@ -98,7 +98,7 @@ void main() { final response = await users.create( - userId: '[USER_ID]', + userId: '<USER_ID>', ); expect(response, isA<models.User>()); @@ -131,7 +131,7 @@ void main() { final response = await users.createArgon2User( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', password: 'password', ); @@ -166,7 +166,7 @@ void main() { final response = await users.createBcryptUser( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', password: 'password', ); @@ -200,7 +200,7 @@ void main() { final response = await users.deleteIdentity( - identityId: '[IDENTITY_ID]', + identityId: '<IDENTITY_ID>', ); }); @@ -231,7 +231,7 @@ void main() { final response = await users.createMD5User( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', password: 'password', ); @@ -266,7 +266,7 @@ void main() { final response = await users.createPHPassUser( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', password: 'password', ); @@ -301,10 +301,10 @@ void main() { final response = await users.createScryptUser( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', password: 'password', - passwordSalt: '[PASSWORD_SALT]', + passwordSalt: '<PASSWORD_SALT>', passwordCpu: 1, passwordMemory: 1, passwordParallel: 1, @@ -341,12 +341,12 @@ void main() { final response = await users.createScryptModifiedUser( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', password: 'password', - passwordSalt: '[PASSWORD_SALT]', - passwordSaltSeparator: '[PASSWORD_SALT_SEPARATOR]', - passwordSignerKey: '[PASSWORD_SIGNER_KEY]', + passwordSalt: '<PASSWORD_SALT>', + passwordSaltSeparator: '<PASSWORD_SALT_SEPARATOR>', + passwordSignerKey: '<PASSWORD_SIGNER_KEY>', ); expect(response, isA<models.User>()); @@ -379,7 +379,7 @@ void main() { final response = await users.createSHAUser( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', password: 'password', ); @@ -414,7 +414,7 @@ void main() { final response = await users.get( - userId: '[USER_ID]', + userId: '<USER_ID>', ); expect(response, isA<models.User>()); @@ -429,7 +429,7 @@ void main() { final response = await users.delete( - userId: '[USER_ID]', + userId: '<USER_ID>', ); }); @@ -460,7 +460,7 @@ void main() { final response = await users.updateEmail( - userId: '[USER_ID]', + userId: '<USER_ID>', email: 'email@example.com', ); expect(response, isA<models.User>()); @@ -494,7 +494,7 @@ void main() { final response = await users.updateLabels( - userId: '[USER_ID]', + userId: '<USER_ID>', labels: [], ); expect(response, isA<models.User>()); @@ -513,7 +513,7 @@ void main() { final response = await users.listLogs( - userId: '[USER_ID]', + userId: '<USER_ID>', ); expect(response, isA<models.LogList>()); @@ -531,7 +531,7 @@ void main() { final response = await users.listMemberships( - userId: '[USER_ID]', + userId: '<USER_ID>', ); expect(response, isA<models.MembershipList>()); @@ -564,7 +564,7 @@ void main() { final response = await users.updateMfa( - userId: '[USER_ID]', + userId: '<USER_ID>', mfa: true, ); expect(response, isA<models.User>()); @@ -584,7 +584,7 @@ void main() { final response = await users.listFactors( - userId: '[USER_ID]', + userId: '<USER_ID>', ); expect(response, isA<models.MfaFactors>()); @@ -617,9 +617,9 @@ void main() { final response = await users.deleteAuthenticator( - userId: '[USER_ID]', + userId: '<USER_ID>', type: 'totp', - otp: '[OTP]', + otp: '<OTP>', ); expect(response, isA<models.User>()); @@ -652,8 +652,8 @@ void main() { final response = await users.updateName( - userId: '[USER_ID]', - name: '[NAME]', + userId: '<USER_ID>', + name: '<NAME>', ); expect(response, isA<models.User>()); @@ -686,7 +686,7 @@ void main() { final response = await users.updatePassword( - userId: '[USER_ID]', + userId: '<USER_ID>', password: '', ); expect(response, isA<models.User>()); @@ -720,7 +720,7 @@ void main() { final response = await users.updatePhone( - userId: '[USER_ID]', + userId: '<USER_ID>', number: '+12065550100', ); expect(response, isA<models.User>()); @@ -737,7 +737,7 @@ void main() { final response = await users.getPrefs( - userId: '[USER_ID]', + userId: '<USER_ID>', ); expect(response, isA<models.Preferences>()); @@ -753,7 +753,7 @@ void main() { final response = await users.updatePrefs( - userId: '[USER_ID]', + userId: '<USER_ID>', prefs: {}, ); expect(response, isA<models.Preferences>()); @@ -772,7 +772,7 @@ void main() { final response = await users.listSessions( - userId: '[USER_ID]', + userId: '<USER_ID>', ); expect(response, isA<models.SessionList>()); @@ -815,7 +815,7 @@ void main() { final response = await users.createSession( - userId: '[USER_ID]', + userId: '<USER_ID>', ); expect(response, isA<models.Session>()); @@ -830,7 +830,7 @@ void main() { final response = await users.deleteSessions( - userId: '[USER_ID]', + userId: '<USER_ID>', ); }); @@ -843,8 +843,8 @@ void main() { final response = await users.deleteSession( - userId: '[USER_ID]', - sessionId: '[SESSION_ID]', + userId: '<USER_ID>', + sessionId: '<SESSION_ID>', ); }); @@ -875,7 +875,7 @@ void main() { final response = await users.updateStatus( - userId: '[USER_ID]', + userId: '<USER_ID>', status: true, ); expect(response, isA<models.User>()); @@ -894,7 +894,7 @@ void main() { final response = await users.listTargets( - userId: '[USER_ID]', + userId: '<USER_ID>', ); expect(response, isA<models.TargetList>()); @@ -917,10 +917,10 @@ void main() { final response = await users.createTarget( - userId: '[USER_ID]', - targetId: '[TARGET_ID]', + userId: '<USER_ID>', + targetId: '<TARGET_ID>', providerType: 'email', - identifier: '[IDENTIFIER]', + identifier: '<IDENTIFIER>', ); expect(response, isA<models.Target>()); @@ -943,8 +943,8 @@ void main() { final response = await users.getTarget( - userId: '[USER_ID]', - targetId: '[TARGET_ID]', + userId: '<USER_ID>', + targetId: '<TARGET_ID>', ); expect(response, isA<models.Target>()); @@ -967,8 +967,8 @@ void main() { final response = await users.updateTarget( - userId: '[USER_ID]', - targetId: '[TARGET_ID]', + userId: '<USER_ID>', + targetId: '<TARGET_ID>', ); expect(response, isA<models.Target>()); @@ -983,8 +983,8 @@ void main() { final response = await users.deleteTarget( - userId: '[USER_ID]', - targetId: '[TARGET_ID]', + userId: '<USER_ID>', + targetId: '<TARGET_ID>', ); }); @@ -1004,7 +1004,7 @@ void main() { final response = await users.createToken( - userId: '[USER_ID]', + userId: '<USER_ID>', ); expect(response, isA<models.Token>()); @@ -1037,7 +1037,7 @@ void main() { final response = await users.updateEmailVerification( - userId: '[USER_ID]', + userId: '<USER_ID>', emailVerification: true, ); expect(response, isA<models.User>()); @@ -1071,7 +1071,7 @@ void main() { final response = await users.updatePhoneVerification( - userId: '[USER_ID]', + userId: '<USER_ID>', phoneVerification: true, ); expect(response, isA<models.User>()); From bd8ae15b4f3790a920256476b7592d093dcd014b Mon Sep 17 00:00:00 2001 From: Jake Barnby <jakeb994@gmail.com> Date: Tue, 27 Feb 2024 20:35:43 +1300 Subject: [PATCH 5/7] Release candidate for 1.5.x --- README.md | 2 +- docs/examples/account/add-authenticator.md | 16 ++-- .../account/create-anonymous-session.md | 12 +-- docs/examples/account/create-challenge.md | 14 +--- .../account/create-email-password-session.md | 16 ++-- docs/examples/account/create-email-token.md | 18 ++--- docs/examples/account/create-j-w-t.md | 12 +-- .../account/create-magic-u-r-l-token.md | 20 ++--- .../examples/account/create-o-auth2session.md | 20 ----- docs/examples/account/create-o-auth2token.md | 20 ++--- docs/examples/account/create-phone-token.md | 16 ++-- .../account/create-phone-verification.md | 14 +--- docs/examples/account/create-recovery.md | 18 ++--- docs/examples/account/create-session.md | 16 ++-- docs/examples/account/create-verification.md | 16 ++-- docs/examples/account/create.md | 20 ++--- docs/examples/account/delete-authenticator.md | 18 ++--- docs/examples/account/delete-identity.md | 16 ++-- docs/examples/account/delete-session.md | 16 ++-- docs/examples/account/delete-sessions.md | 14 +--- docs/examples/account/get-prefs.md | 14 +--- docs/examples/account/get-session.md | 16 ++-- docs/examples/account/get.md | 14 +--- docs/examples/account/list-factors.md | 14 +--- docs/examples/account/list-identities.md | 16 ++-- docs/examples/account/list-logs.md | 16 ++-- docs/examples/account/list-sessions.md | 14 +--- docs/examples/account/update-challenge.md | 18 ++--- docs/examples/account/update-email.md | 18 ++--- docs/examples/account/update-m-f-a.md | 16 ++-- .../account/update-magic-u-r-l-session.md | 16 ++-- docs/examples/account/update-name.md | 16 ++-- docs/examples/account/update-password.md | 18 ++--- docs/examples/account/update-phone-session.md | 12 +++ .../account/update-phone-verification.md | 18 ++--- docs/examples/account/update-phone.md | 18 ++--- docs/examples/account/update-prefs.md | 16 ++-- docs/examples/account/update-recovery.md | 20 ++--- docs/examples/account/update-session.md | 16 ++-- docs/examples/account/update-status.md | 14 +--- docs/examples/account/update-verification.md | 18 ++--- docs/examples/account/verify-authenticator.md | 18 ++--- docs/examples/avatars/get-browser.md | 22 ++---- docs/examples/avatars/get-credit-card.md | 22 ++---- docs/examples/avatars/get-favicon.md | 16 ++-- docs/examples/avatars/get-flag.md | 22 ++---- docs/examples/avatars/get-image.md | 20 ++--- docs/examples/avatars/get-initials.md | 22 ++---- docs/examples/avatars/get-q-r.md | 22 ++---- .../databases/create-boolean-attribute.md | 26 +++---- docs/examples/databases/create-collection.md | 26 +++---- .../databases/create-datetime-attribute.md | 26 +++---- docs/examples/databases/create-document.md | 24 +++--- .../databases/create-email-attribute.md | 26 +++---- .../databases/create-enum-attribute.md | 28 +++---- .../databases/create-float-attribute.md | 30 +++----- docs/examples/databases/create-index.md | 26 +++---- .../databases/create-integer-attribute.md | 30 +++----- .../examples/databases/create-ip-attribute.md | 26 +++---- .../create-relationship-attribute.md | 30 +++----- .../databases/create-string-attribute.md | 30 +++----- .../databases/create-url-attribute.md | 26 +++---- docs/examples/databases/create.md | 20 ++--- docs/examples/databases/delete-attribute.md | 20 ++--- docs/examples/databases/delete-collection.md | 18 ++--- docs/examples/databases/delete-document.md | 20 ++--- docs/examples/databases/delete-index.md | 20 ++--- docs/examples/databases/delete.md | 16 ++-- docs/examples/databases/get-attribute.md | 20 ++--- docs/examples/databases/get-collection.md | 18 ++--- docs/examples/databases/get-document.md | 22 ++---- docs/examples/databases/get-index.md | 20 ++--- docs/examples/databases/get.md | 16 ++-- docs/examples/databases/list-attributes.md | 20 ++--- docs/examples/databases/list-collections.md | 20 ++--- docs/examples/databases/list-documents.md | 20 ++--- docs/examples/databases/list-indexes.md | 20 ++--- docs/examples/databases/list.md | 18 ++--- .../databases/update-boolean-attribute.md | 24 +++--- docs/examples/databases/update-collection.md | 26 +++---- .../databases/update-datetime-attribute.md | 24 +++--- docs/examples/databases/update-document.md | 24 +++--- .../databases/update-email-attribute.md | 24 +++--- .../databases/update-enum-attribute.md | 26 +++---- .../databases/update-float-attribute.md | 28 +++---- .../databases/update-integer-attribute.md | 28 +++---- .../examples/databases/update-ip-attribute.md | 24 +++--- .../update-relationship-attribute.md | 22 ++---- .../databases/update-string-attribute.md | 24 +++--- .../databases/update-url-attribute.md | 24 +++--- docs/examples/databases/update.md | 20 ++--- docs/examples/functions/create-build.md | 20 ++--- docs/examples/functions/create-deployment.md | 24 +++--- docs/examples/functions/create-execution.md | 26 +++---- docs/examples/functions/create-variable.md | 20 ++--- docs/examples/functions/create.md | 54 ++++++-------- docs/examples/functions/delete-deployment.md | 18 ++--- docs/examples/functions/delete-variable.md | 18 ++--- docs/examples/functions/delete.md | 16 ++-- .../examples/functions/download-deployment.md | 18 ++--- docs/examples/functions/get-deployment.md | 18 ++--- docs/examples/functions/get-execution.md | 18 ++--- docs/examples/functions/get-variable.md | 18 ++--- docs/examples/functions/get.md | 16 ++-- docs/examples/functions/list-deployments.md | 20 ++--- docs/examples/functions/list-executions.md | 20 ++--- docs/examples/functions/list-runtimes.md | 14 +--- docs/examples/functions/list-variables.md | 16 ++-- docs/examples/functions/list.md | 18 ++--- docs/examples/functions/update-deployment.md | 18 ++--- docs/examples/functions/update-variable.md | 22 ++---- docs/examples/functions/update.md | 46 +++++------- docs/examples/graphql/mutation.md | 16 ++-- docs/examples/graphql/query.md | 16 ++-- docs/examples/health/get-antivirus.md | 14 +--- docs/examples/health/get-cache.md | 14 +--- docs/examples/health/get-certificate.md | 16 ++-- docs/examples/health/get-d-b.md | 14 +--- docs/examples/health/get-failed-jobs.md | 18 ++--- docs/examples/health/get-pub-sub.md | 14 +--- docs/examples/health/get-queue-builds.md | 16 ++-- .../examples/health/get-queue-certificates.md | 16 ++-- docs/examples/health/get-queue-databases.md | 18 ++--- docs/examples/health/get-queue-deletes.md | 16 ++-- docs/examples/health/get-queue-functions.md | 16 ++-- docs/examples/health/get-queue-logs.md | 16 ++-- docs/examples/health/get-queue-mails.md | 16 ++-- docs/examples/health/get-queue-messaging.md | 16 ++-- docs/examples/health/get-queue-migrations.md | 16 ++-- docs/examples/health/get-queue-webhooks.md | 16 ++-- docs/examples/health/get-queue.md | 14 +--- docs/examples/health/get-storage-local.md | 14 +--- docs/examples/health/get-time.md | 14 +--- docs/examples/health/get.md | 14 +--- docs/examples/locale/get.md | 14 +--- docs/examples/locale/list-codes.md | 14 +--- docs/examples/locale/list-continents.md | 14 +--- docs/examples/locale/list-countries-e-u.md | 14 +--- docs/examples/locale/list-countries-phones.md | 14 +--- docs/examples/locale/list-countries.md | 14 +--- docs/examples/locale/list-currencies.md | 14 +--- docs/examples/locale/list-languages.md | 14 +--- .../messaging/create-apns-provider.md | 30 +++----- docs/examples/messaging/create-email.md | 38 ++++------ .../examples/messaging/create-fcm-provider.md | 22 ++---- .../messaging/create-mailgun-provider.md | 34 ++++----- .../messaging/create-msg91provider.md | 26 +++---- docs/examples/messaging/create-push.md | 46 +++++------- .../messaging/create-sendgrid-provider.md | 30 +++----- docs/examples/messaging/create-sms.md | 28 +++---- .../messaging/create-smtp-provider.md | 42 +++++------ docs/examples/messaging/create-subscriber.md | 20 ++--- .../messaging/create-telesign-provider.md | 26 +++---- .../messaging/create-textmagic-provider.md | 26 +++---- docs/examples/messaging/create-topic.md | 20 ++--- .../messaging/create-twilio-provider.md | 26 +++---- .../messaging/create-vonage-provider.md | 26 +++---- docs/examples/messaging/delete-provider.md | 16 ++-- docs/examples/messaging/delete-subscriber.md | 18 ++--- docs/examples/messaging/delete-topic.md | 16 ++-- docs/examples/messaging/delete.md | 16 ++-- docs/examples/messaging/get-message.md | 16 ++-- docs/examples/messaging/get-provider.md | 16 ++-- docs/examples/messaging/get-subscriber.md | 18 ++--- docs/examples/messaging/get-topic.md | 16 ++-- docs/examples/messaging/list-message-logs.md | 18 ++--- docs/examples/messaging/list-messages.md | 18 ++--- docs/examples/messaging/list-provider-logs.md | 18 ++--- docs/examples/messaging/list-providers.md | 18 ++--- .../messaging/list-subscriber-logs.md | 18 ++--- docs/examples/messaging/list-subscribers.md | 20 ++--- docs/examples/messaging/list-targets.md | 18 ++--- docs/examples/messaging/list-topic-logs.md | 18 ++--- docs/examples/messaging/list-topics.md | 18 ++--- .../messaging/update-apns-provider.md | 30 +++----- docs/examples/messaging/update-email.md | 36 ++++----- .../examples/messaging/update-fcm-provider.md | 22 ++---- .../messaging/update-mailgun-provider.md | 34 ++++----- .../messaging/update-msg91provider.md | 26 +++---- docs/examples/messaging/update-push.md | 46 +++++------- .../messaging/update-sendgrid-provider.md | 30 +++----- docs/examples/messaging/update-sms.md | 28 +++---- .../messaging/update-smtp-provider.md | 42 +++++------ .../messaging/update-telesign-provider.md | 26 +++---- .../messaging/update-textmagic-provider.md | 26 +++---- docs/examples/messaging/update-topic.md | 20 ++--- .../messaging/update-twilio-provider.md | 26 +++---- .../messaging/update-vonage-provider.md | 26 +++---- docs/examples/storage/create-bucket.md | 34 ++++----- docs/examples/storage/create-file.md | 22 ++---- docs/examples/storage/delete-bucket.md | 16 ++-- docs/examples/storage/delete-file.md | 18 ++--- docs/examples/storage/get-bucket.md | 16 ++-- docs/examples/storage/get-file-download.md | 18 ++--- docs/examples/storage/get-file-preview.md | 40 +++++----- docs/examples/storage/get-file-view.md | 18 ++--- docs/examples/storage/get-file.md | 18 ++--- docs/examples/storage/list-buckets.md | 18 ++--- docs/examples/storage/list-files.md | 20 ++--- docs/examples/storage/update-bucket.md | 34 ++++----- docs/examples/storage/update-file.md | 22 ++---- docs/examples/teams/create-membership.md | 28 +++---- docs/examples/teams/create.md | 20 ++--- docs/examples/teams/delete-membership.md | 18 ++--- docs/examples/teams/delete.md | 16 ++-- docs/examples/teams/get-membership.md | 18 ++--- docs/examples/teams/get-prefs.md | 16 ++-- docs/examples/teams/get.md | 16 ++-- docs/examples/teams/list-memberships.md | 20 ++--- docs/examples/teams/list.md | 18 ++--- .../teams/update-membership-status.md | 22 ++---- docs/examples/teams/update-membership.md | 20 ++--- docs/examples/teams/update-name.md | 18 ++--- docs/examples/teams/update-prefs.md | 18 ++--- docs/examples/users/create-argon2user.md | 22 ++---- docs/examples/users/create-bcrypt-user.md | 22 ++---- docs/examples/users/create-m-d5user.md | 22 ++---- docs/examples/users/create-p-h-pass-user.md | 22 ++---- docs/examples/users/create-s-h-a-user.md | 24 +++--- .../users/create-scrypt-modified-user.md | 28 +++---- docs/examples/users/create-scrypt-user.md | 32 ++++---- docs/examples/users/create-session.md | 16 ++-- docs/examples/users/create-target.md | 26 +++---- docs/examples/users/create-token.md | 20 ++--- docs/examples/users/create.md | 24 +++--- docs/examples/users/delete-authenticator.md | 19 ++--- docs/examples/users/delete-identity.md | 16 ++-- docs/examples/users/delete-session.md | 18 ++--- docs/examples/users/delete-sessions.md | 16 ++-- docs/examples/users/delete-target.md | 18 ++--- docs/examples/users/delete.md | 16 ++-- docs/examples/users/get-prefs.md | 16 ++-- docs/examples/users/get-target.md | 18 ++--- docs/examples/users/get.md | 16 ++-- docs/examples/users/list-factors.md | 16 ++-- docs/examples/users/list-identities.md | 18 ++--- docs/examples/users/list-logs.md | 18 ++--- docs/examples/users/list-memberships.md | 16 ++-- docs/examples/users/list-sessions.md | 16 ++-- docs/examples/users/list-targets.md | 18 ++--- docs/examples/users/list.md | 18 ++--- .../users/update-email-verification.md | 18 ++--- docs/examples/users/update-email.md | 18 ++--- docs/examples/users/update-labels.md | 18 ++--- docs/examples/users/update-mfa.md | 18 ++--- docs/examples/users/update-name.md | 18 ++--- docs/examples/users/update-password.md | 18 ++--- .../users/update-phone-verification.md | 18 ++--- docs/examples/users/update-phone.md | 18 ++--- docs/examples/users/update-prefs.md | 18 ++--- docs/examples/users/update-status.md | 18 ++--- docs/examples/users/update-target.md | 24 +++--- lib/enums.dart | 1 - lib/services/account.dart | 74 ++++++++----------- lib/services/databases.dart | 17 +++++ lib/services/health.dart | 2 + lib/services/messaging.dart | 57 +++++++------- lib/services/users.dart | 13 +++- lib/src/client_browser.dart | 2 +- lib/src/client_io.dart | 4 +- lib/src/enums/index_type.dart | 3 +- lib/src/enums/message_status.dart | 15 ---- pubspec.yaml | 2 +- test/services/account_test.dart | 44 +++++++++-- test/services/messaging_test.dart | 14 ++-- test/services/users_test.dart | 1 - test/src/models/message_test.dart | 4 +- 267 files changed, 1957 insertions(+), 3433 deletions(-) delete mode 100644 docs/examples/account/create-o-auth2session.md create mode 100644 docs/examples/account/update-phone-session.md delete mode 100644 lib/src/enums/message_status.dart diff --git a/README.md b/README.md index 7a4c8f61..558241a2 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - dart_appwrite: ^11.0.0-rc.5 + dart_appwrite: ^11.0.0-rc.6 ``` You can install packages from the command line: diff --git a/docs/examples/account/add-authenticator.md b/docs/examples/account/add-authenticator.md index f047a4de..da87a6d0 100644 --- a/docs/examples/account/add-authenticator.md +++ b/docs/examples/account/add-authenticator.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.addAuthenticator( - type: AuthenticatorType.totp, +MfaType result = await account.addAuthenticator( + type: AuthenticatorType.totp, ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index a173aaaa..200b49ee 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -1,15 +1,9 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2'); // Your project ID + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID Account account = Account(client); -Future result = account.createAnonymousSession(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +Session result = await account.createAnonymousSession(); diff --git a/docs/examples/account/create-challenge.md b/docs/examples/account/create-challenge.md index 953bb93b..758915e7 100644 --- a/docs/examples/account/create-challenge.md +++ b/docs/examples/account/create-challenge.md @@ -1,17 +1,11 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2'); // Your project ID + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID Account account = Account(client); -Future result = account.createChallenge( - factor: AuthenticationFactor.totp, +MfaChallenge result = await account.createChallenge( + factor: AuthenticationFactor.totp, ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index 56b4e66f..9e07cd81 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2'); // Your project ID + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID Account account = Account(client); -Future result = account.createEmailPasswordSession( - email: 'email@example.com', - password: 'password', +Session result = await account.createEmailPasswordSession( + email: 'email@example.com', + password: 'password', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index 7c1e45f1..70870d93 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2'); // Your project ID + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID Account account = Account(client); -Future result = account.createEmailToken( - userId: '<USER_ID>', - email: 'email@example.com', - phrase: false, // (optional) +Token result = await account.createEmailToken( + userId: '<USER_ID>', + email: 'email@example.com', + phrase: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-j-w-t.md index 1551beaf..4e452abe 100644 --- a/docs/examples/account/create-j-w-t.md +++ b/docs/examples/account/create-j-w-t.md @@ -1,15 +1,9 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2'); // Your project ID + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID Account account = Account(client); -Future result = account.createJWT(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +Jwt result = await account.createJWT(); diff --git a/docs/examples/account/create-magic-u-r-l-token.md b/docs/examples/account/create-magic-u-r-l-token.md index 7dcda1fd..ac60b0df 100644 --- a/docs/examples/account/create-magic-u-r-l-token.md +++ b/docs/examples/account/create-magic-u-r-l-token.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2'); // Your project ID + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID Account account = Account(client); -Future result = account.createMagicURLToken( - userId: '<USER_ID>', - email: 'email@example.com', - url: 'https://example.com', // (optional) - phrase: false, // (optional) +Token result = await account.createMagicURLToken( + userId: '<USER_ID>', + email: 'email@example.com', + url: 'https://example.com', // (optional) + phrase: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/create-o-auth2session.md b/docs/examples/account/create-o-auth2session.md deleted file mode 100644 index 993733ca..00000000 --- a/docs/examples/account/create-o-auth2session.md +++ /dev/null @@ -1,20 +0,0 @@ -import 'package:dart_appwrite/dart_appwrite.dart'; - -Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2'); // Your project ID - -Account account = Account(client); - -Future result = account.createOAuth2Session( - provider: OAuthProvider.amazon, - success: 'https://example.com', // (optional) - failure: 'https://example.com', // (optional) - scopes: [], // (optional) -); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/create-o-auth2token.md b/docs/examples/account/create-o-auth2token.md index 47030526..2d33ad39 100644 --- a/docs/examples/account/create-o-auth2token.md +++ b/docs/examples/account/create-o-auth2token.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2'); // Your project ID + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID Account account = Account(client); -Future result = account.createOAuth2Token( - provider: OAuthProvider.amazon, - success: 'https://example.com', // (optional) - failure: 'https://example.com', // (optional) - scopes: [], // (optional) +await account.createOAuth2Token( + provider: OAuthProvider.amazon, + success: 'https://example.com', // (optional) + failure: 'https://example.com', // (optional) + scopes: [], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index 819a2cfd..8653ad00 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2'); // Your project ID + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID Account account = Account(client); -Future result = account.createPhoneToken( - userId: '<USER_ID>', - phone: '+12065550100', +Token result = await account.createPhoneToken( + userId: '<USER_ID>', + phone: '+12065550100', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index 080739ac..40d6f2fc 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.createPhoneVerification(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +Token result = await account.createPhoneVerification(); diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index 24695ed3..0b0584da 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.createRecovery( - email: 'email@example.com', - url: 'https://example.com', +Token result = await account.createRecovery( + email: 'email@example.com', + url: 'https://example.com', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index b6c91087..a85be647 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2'); // Your project ID + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID Account account = Account(client); -Future result = account.createSession( - userId: '<USER_ID>', - secret: '<SECRET>', +Session result = await account.createSession( + userId: '<USER_ID>', + secret: '<SECRET>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index b0a93203..4ec54dc1 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.createVerification( - url: 'https://example.com', +Token result = await account.createVerification( + url: 'https://example.com', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index 98511105..ac630d1b 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2'); // Your project ID + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID Account account = Account(client); -Future result = account.create( - userId: '<USER_ID>', - email: 'email@example.com', - password: '', - name: '<NAME>', // (optional) +User result = await account.create( + userId: '<USER_ID>', + email: 'email@example.com', + password: '', + name: '<NAME>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/delete-authenticator.md b/docs/examples/account/delete-authenticator.md index 8332c2f0..2b7f4111 100644 --- a/docs/examples/account/delete-authenticator.md +++ b/docs/examples/account/delete-authenticator.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.deleteAuthenticator( - type: AuthenticatorType.totp, - otp: '<OTP>', +await account.deleteAuthenticator( + type: AuthenticatorType.totp, + otp: '<OTP>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index 67d5fa86..4982e13a 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.deleteIdentity( - identityId: '<IDENTITY_ID>', +await account.deleteIdentity( + identityId: '<IDENTITY_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index 752ca381..eb740f19 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.deleteSession( - sessionId: '<SESSION_ID>', +await account.deleteSession( + sessionId: '<SESSION_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index d6e0829c..e42f1618 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.deleteSessions(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +await account.deleteSessions(); diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index ea93ce6f..4f5ad7c9 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.getPrefs(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +Preferences result = await account.getPrefs(); diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index 5b9f9a8b..e2423d67 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.getSession( - sessionId: '<SESSION_ID>', +Session result = await account.getSession( + sessionId: '<SESSION_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index 135e8ed4..86a80747 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.get(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +User result = await account.get(); diff --git a/docs/examples/account/list-factors.md b/docs/examples/account/list-factors.md index 6926b7bc..2f2b0062 100644 --- a/docs/examples/account/list-factors.md +++ b/docs/examples/account/list-factors.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.listFactors(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +MfaFactors result = await account.listFactors(); diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index 287c7bb8..bcd36718 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.listIdentities( - queries: [], // (optional) +IdentityList result = await account.listIdentities( + queries: [], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index 81e51d47..a45ddf29 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.listLogs( - queries: [], // (optional) +LogList result = await account.listLogs( + queries: [], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index a7e6f76e..7469ba55 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.listSessions(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +SessionList result = await account.listSessions(); diff --git a/docs/examples/account/update-challenge.md b/docs/examples/account/update-challenge.md index dee58f53..9c322072 100644 --- a/docs/examples/account/update-challenge.md +++ b/docs/examples/account/update-challenge.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.updateChallenge( - challengeId: '<CHALLENGE_ID>', - otp: '<OTP>', + result = await account.updateChallenge( + challengeId: '<CHALLENGE_ID>', + otp: '<OTP>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index b5e0a0e2..325b764a 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.updateEmail( - email: 'email@example.com', - password: 'password', +User result = await account.updateEmail( + email: 'email@example.com', + password: 'password', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/update-m-f-a.md b/docs/examples/account/update-m-f-a.md index 621e5a88..102525e3 100644 --- a/docs/examples/account/update-m-f-a.md +++ b/docs/examples/account/update-m-f-a.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.updateMFA( - mfa: false, +User result = await account.updateMFA( + mfa: false, ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-u-r-l-session.md index 52b05dc0..535d26d7 100644 --- a/docs/examples/account/update-magic-u-r-l-session.md +++ b/docs/examples/account/update-magic-u-r-l-session.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2'); // Your project ID + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID Account account = Account(client); -Future result = account.updateMagicURLSession( - userId: '<USER_ID>', - secret: '<SECRET>', +Session result = await account.updateMagicURLSession( + userId: '<USER_ID>', + secret: '<SECRET>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index 38fd7ea1..bf05b276 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.updateName( - name: '<NAME>', +User result = await account.updateName( + name: '<NAME>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index 3b211a7f..92d53fad 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.updatePassword( - password: '', - oldPassword: 'password', // (optional) +User result = await account.updatePassword( + password: '', + oldPassword: 'password', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md new file mode 100644 index 00000000..2586a893 --- /dev/null +++ b/docs/examples/account/update-phone-session.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('5df5acd0d48c2'); // Your project ID + +Account account = Account(client); + +Session result = await account.updatePhoneSession( + userId: '<USER_ID>', + secret: '<SECRET>', +); diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index 7d88fb39..a7789677 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.updatePhoneVerification( - userId: '<USER_ID>', - secret: '<SECRET>', +Token result = await account.updatePhoneVerification( + userId: '<USER_ID>', + secret: '<SECRET>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index a723eda1..9613bda8 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.updatePhone( - phone: '+12065550100', - password: 'password', +User result = await account.updatePhone( + phone: '+12065550100', + password: 'password', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index 22ce6c8a..1ef69ee9 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.updatePrefs( - prefs: {}, +User result = await account.updatePrefs( + prefs: {}, ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index 3f13119b..c0923c18 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.updateRecovery( - userId: '<USER_ID>', - secret: '<SECRET>', - password: '', +Token result = await account.updateRecovery( + userId: '<USER_ID>', + secret: '<SECRET>', + password: '', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index 55e96f36..624b006d 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.updateSession( - sessionId: '<SESSION_ID>', +Session result = await account.updateSession( + sessionId: '<SESSION_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index ecc636ca..211421c1 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.updateStatus(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +User result = await account.updateStatus(); diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index f9fcf0a5..e0e25187 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.updateVerification( - userId: '<USER_ID>', - secret: '<SECRET>', +Token result = await account.updateVerification( + userId: '<USER_ID>', + secret: '<SECRET>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/account/verify-authenticator.md b/docs/examples/account/verify-authenticator.md index 8b70c77c..839acf00 100644 --- a/docs/examples/account/verify-authenticator.md +++ b/docs/examples/account/verify-authenticator.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Account account = Account(client); -Future result = account.verifyAuthenticator( - type: AuthenticatorType.totp, - otp: '<OTP>', +User result = await account.verifyAuthenticator( + type: AuthenticatorType.totp, + otp: '<OTP>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index d87bb8ad..4ad79d37 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -1,21 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Avatars avatars = Avatars(client); -Future result = avatars.getBrowser( - code: Browser.avantBrowser, - width: 0, // (optional) - height: 0, // (optional) - quality: 0, // (optional) +UInt8List result = await avatars.getBrowser( + code: Browser.avantBrowser, + width: 0, // (optional) + height: 0, // (optional) + quality: 0, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index 82ecb1ba..95f84b62 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -1,21 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Avatars avatars = Avatars(client); -Future result = avatars.getCreditCard( - code: CreditCard.americanExpress, - width: 0, // (optional) - height: 0, // (optional) - quality: 0, // (optional) +UInt8List result = await avatars.getCreditCard( + code: CreditCard.americanExpress, + width: 0, // (optional) + height: 0, // (optional) + quality: 0, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index 855a1716..5fc30514 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Avatars avatars = Avatars(client); -Future result = avatars.getFavicon( - url: 'https://example.com', +UInt8List result = await avatars.getFavicon( + url: 'https://example.com', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index 474cc7ef..3f7a10db 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -1,21 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Avatars avatars = Avatars(client); -Future result = avatars.getFlag( - code: Flag.afghanistan, - width: 0, // (optional) - height: 0, // (optional) - quality: 0, // (optional) +UInt8List result = await avatars.getFlag( + code: Flag.afghanistan, + width: 0, // (optional) + height: 0, // (optional) + quality: 0, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index af6aaca0..f1d911ee 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Avatars avatars = Avatars(client); -Future result = avatars.getImage( - url: 'https://example.com', - width: 0, // (optional) - height: 0, // (optional) +UInt8List result = await avatars.getImage( + url: 'https://example.com', + width: 0, // (optional) + height: 0, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 8a2c0a5f..da2849c8 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -1,21 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Avatars avatars = Avatars(client); -Future result = avatars.getInitials( - name: '<NAME>', // (optional) - width: 0, // (optional) - height: 0, // (optional) - background: '', // (optional) +UInt8List result = await avatars.getInitials( + name: '<NAME>', // (optional) + width: 0, // (optional) + height: 0, // (optional) + background: '', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md index 43c67c4f..97d31d53 100644 --- a/docs/examples/avatars/get-q-r.md +++ b/docs/examples/avatars/get-q-r.md @@ -1,21 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Avatars avatars = Avatars(client); -Future result = avatars.getQR( - text: '<TEXT>', - size: 1, // (optional) - margin: 0, // (optional) - download: false, // (optional) +UInt8List result = await avatars.getQR( + text: '<TEXT>', + size: 1, // (optional) + margin: 0, // (optional) + download: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index 44e9b11d..4c707302 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.createBooleanAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - xrequired: false, - xdefault: false, // (optional) - array: false, // (optional) +AttributeBoolean result = await databases.createBooleanAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + xrequired: false, + xdefault: false, // (optional) + array: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index e3236a99..2a6d8e93 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.createCollection( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - name: '<NAME>', - permissions: ["read("any")"], // (optional) - documentSecurity: false, // (optional) - enabled: false, // (optional) +Collection result = await databases.createCollection( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + name: '<NAME>', + permissions: ["read("any")"], // (optional) + documentSecurity: false, // (optional) + enabled: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index 0511096b..6d44a263 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.createDatetimeAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - xrequired: false, - xdefault: '', // (optional) - array: false, // (optional) +AttributeDatetime result = await databases.createDatetimeAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + xrequired: false, + xdefault: '', // (optional) + array: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index d648a5cd..b9d5eb0d 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -1,22 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Databases databases = Databases(client); -Future result = databases.createDocument( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - documentId: '<DOCUMENT_ID>', - data: {}, - permissions: ["read("any")"], // (optional) +Document result = await databases.createDocument( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', + data: {}, + permissions: ["read("any")"], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index 6684f8ee..15bf0129 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.createEmailAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - xrequired: false, - xdefault: 'email@example.com', // (optional) - array: false, // (optional) +AttributeEmail result = await databases.createEmailAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + xrequired: false, + xdefault: 'email@example.com', // (optional) + array: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index 6c04fa42..f1df262d 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -1,24 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.createEnumAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - elements: [], - xrequired: false, - xdefault: '<DEFAULT>', // (optional) - array: false, // (optional) +AttributeEnum result = await databases.createEnumAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + elements: [], + xrequired: false, + xdefault: '<DEFAULT>', // (optional) + array: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index 6ca871d2..548962a2 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -1,25 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.createFloatAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - xrequired: false, - min: 0, // (optional) - max: 0, // (optional) - xdefault: 0, // (optional) - array: false, // (optional) +AttributeFloat result = await databases.createFloatAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + xrequired: false, + min: 0, // (optional) + max: 0, // (optional) + xdefault: 0, // (optional) + array: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index 3aeab976..7c978466 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.createIndex( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - type: IndexType.key, - attributes: [], - orders: [], // (optional) +Index result = await databases.createIndex( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + type: IndexType.key, + attributes: [], + orders: [], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index b707bffb..2449950d 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -1,25 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.createIntegerAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - xrequired: false, - min: 0, // (optional) - max: 0, // (optional) - xdefault: 0, // (optional) - array: false, // (optional) +AttributeInteger result = await databases.createIntegerAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + xrequired: false, + min: 0, // (optional) + max: 0, // (optional) + xdefault: 0, // (optional) + array: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index 46081ba1..05aa298c 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.createIpAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - xrequired: false, - xdefault: '', // (optional) - array: false, // (optional) +AttributeIp result = await databases.createIpAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + xrequired: false, + xdefault: '', // (optional) + array: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index a9a2ed3f..f838747c 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -1,25 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.createRelationshipAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - relatedCollectionId: '<RELATED_COLLECTION_ID>', - type: RelationshipType.oneToOne, - twoWay: false, // (optional) - key: '', // (optional) - twoWayKey: '', // (optional) - onDelete: RelationMutate.cascade, // (optional) +AttributeRelationship result = await databases.createRelationshipAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + relatedCollectionId: '<RELATED_COLLECTION_ID>', + type: RelationshipType.oneToOne, + twoWay: false, // (optional) + key: '', // (optional) + twoWayKey: '', // (optional) + onDelete: RelationMutate.cascade, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index ba80f761..d4a47541 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -1,25 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.createStringAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - size: 1, - xrequired: false, - xdefault: '<DEFAULT>', // (optional) - array: false, // (optional) - encrypt: false, // (optional) +AttributeString result = await databases.createStringAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + size: 1, + xrequired: false, + xdefault: '<DEFAULT>', // (optional) + array: false, // (optional) + encrypt: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index b59ccf33..f427bba5 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.createUrlAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - xrequired: false, - xdefault: 'https://example.com', // (optional) - array: false, // (optional) +AttributeUrl result = await databases.createUrlAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + xrequired: false, + xdefault: 'https://example.com', // (optional) + array: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index 0d36c66c..01cd75c3 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.create( - databaseId: '<DATABASE_ID>', - name: '<NAME>', - enabled: false, // (optional) +Database result = await databases.create( + databaseId: '<DATABASE_ID>', + name: '<NAME>', + enabled: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index 2a6c38c4..605220c4 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.deleteAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', +await databases.deleteAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md index bfaab82a..4243c8b9 100644 --- a/docs/examples/databases/delete-collection.md +++ b/docs/examples/databases/delete-collection.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.deleteCollection( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', +await databases.deleteCollection( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index 145e48a4..8e1b233f 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Databases databases = Databases(client); -Future result = databases.deleteDocument( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - documentId: '<DOCUMENT_ID>', +await databases.deleteDocument( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index ba3a101e..df5a195a 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.deleteIndex( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', +await databases.deleteIndex( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md index 9567c357..5325af3f 100644 --- a/docs/examples/databases/delete.md +++ b/docs/examples/databases/delete.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.delete( - databaseId: '<DATABASE_ID>', +await databases.delete( + databaseId: '<DATABASE_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index 1d2958ef..fc6129ea 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.getAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', + result = await databases.getAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md index 160855bf..606018bc 100644 --- a/docs/examples/databases/get-collection.md +++ b/docs/examples/databases/get-collection.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.getCollection( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', +Collection result = await databases.getCollection( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index 645f7ffa..17b2ca6c 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -1,21 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Databases databases = Databases(client); -Future result = databases.getDocument( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - documentId: '<DOCUMENT_ID>', - queries: [], // (optional) +Document result = await databases.getDocument( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', + queries: [], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index effbd3c7..0dac7f52 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.getIndex( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', +Index result = await databases.getIndex( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md index 39b05699..c0878b8f 100644 --- a/docs/examples/databases/get.md +++ b/docs/examples/databases/get.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.get( - databaseId: '<DATABASE_ID>', +Database result = await databases.get( + databaseId: '<DATABASE_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index c1b14c7b..fe51fc1f 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.listAttributes( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - queries: [], // (optional) +AttributeList result = await databases.listAttributes( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + queries: [], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index be6d9645..de25c407 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.listCollections( - databaseId: '<DATABASE_ID>', - queries: [], // (optional) - search: '<SEARCH>', // (optional) +CollectionList result = await databases.listCollections( + databaseId: '<DATABASE_ID>', + queries: [], // (optional) + search: '<SEARCH>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 0db86d54..d3caa082 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Databases databases = Databases(client); -Future result = databases.listDocuments( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - queries: [], // (optional) +DocumentList result = await databases.listDocuments( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + queries: [], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index 0c3eff92..a5c616c8 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.listIndexes( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - queries: [], // (optional) +IndexList result = await databases.listIndexes( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + queries: [], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index a2e07420..23d68304 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.list( - queries: [], // (optional) - search: '<SEARCH>', // (optional) +DatabaseList result = await databases.list( + queries: [], // (optional) + search: '<SEARCH>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index a0f46b0d..fe88c9e8 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -1,22 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.updateBooleanAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - xrequired: false, - xdefault: false, +AttributeBoolean result = await databases.updateBooleanAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + xrequired: false, + xdefault: false, ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index c731d51b..a8c95b2a 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.updateCollection( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - name: '<NAME>', - permissions: ["read("any")"], // (optional) - documentSecurity: false, // (optional) - enabled: false, // (optional) +Collection result = await databases.updateCollection( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + name: '<NAME>', + permissions: ["read("any")"], // (optional) + documentSecurity: false, // (optional) + enabled: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index aabf1a1f..d4bba103 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -1,22 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.updateDatetimeAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - xrequired: false, - xdefault: '', +AttributeDatetime result = await databases.updateDatetimeAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + xrequired: false, + xdefault: '', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 3340172e..eccc98e9 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -1,22 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Databases databases = Databases(client); -Future result = databases.updateDocument( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - documentId: '<DOCUMENT_ID>', - data: {}, // (optional) - permissions: ["read("any")"], // (optional) +Document result = await databases.updateDocument( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', + data: {}, // (optional) + permissions: ["read("any")"], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index c5f0f605..a5c72c9f 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -1,22 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.updateEmailAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - xrequired: false, - xdefault: 'email@example.com', +AttributeEmail result = await databases.updateEmailAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + xrequired: false, + xdefault: 'email@example.com', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index b55acd86..a3ebfe57 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.updateEnumAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - elements: [], - xrequired: false, - xdefault: '<DEFAULT>', +AttributeEnum result = await databases.updateEnumAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + elements: [], + xrequired: false, + xdefault: '<DEFAULT>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index 8454438a..fe86fa69 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -1,24 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.updateFloatAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - xrequired: false, - min: 0, - max: 0, - xdefault: 0, +AttributeFloat result = await databases.updateFloatAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + xrequired: false, + min: 0, + max: 0, + xdefault: 0, ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 801205dd..49a0b186 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -1,24 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.updateIntegerAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - xrequired: false, - min: 0, - max: 0, - xdefault: 0, +AttributeInteger result = await databases.updateIntegerAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + xrequired: false, + min: 0, + max: 0, + xdefault: 0, ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index eac2e034..3549d5c1 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -1,22 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.updateIpAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - xrequired: false, - xdefault: '', +AttributeIp result = await databases.updateIpAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + xrequired: false, + xdefault: '', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index 680224b6..e6dea661 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -1,21 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.updateRelationshipAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - onDelete: RelationMutate.cascade, // (optional) +AttributeRelationship result = await databases.updateRelationshipAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + onDelete: RelationMutate.cascade, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index 52589932..cb2a4b64 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -1,22 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.updateStringAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - xrequired: false, - xdefault: '<DEFAULT>', +AttributeString result = await databases.updateStringAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + xrequired: false, + xdefault: '<DEFAULT>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index 9b86359d..4042ed5e 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -1,22 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.updateUrlAttribute( - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - xrequired: false, - xdefault: 'https://example.com', +AttributeUrl result = await databases.updateUrlAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + xrequired: false, + xdefault: 'https://example.com', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index 6a094c90..ad8a76ee 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Databases databases = Databases(client); -Future result = databases.update( - databaseId: '<DATABASE_ID>', - name: '<NAME>', - enabled: false, // (optional) +Database result = await databases.update( + databaseId: '<DATABASE_ID>', + name: '<NAME>', + enabled: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/create-build.md b/docs/examples/functions/create-build.md index ba7d87f3..a90dc7ca 100644 --- a/docs/examples/functions/create-build.md +++ b/docs/examples/functions/create-build.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.createBuild( - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>', - buildId: '<BUILD_ID>', + result = await functions.createBuild( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>', + buildId: '<BUILD_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index 68276da7..dd32c609 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -1,22 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.createDeployment( - functionId: '<FUNCTION_ID>', - code: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'), - activate: false, - entrypoint: '<ENTRYPOINT>', // (optional) - commands: '<COMMANDS>', // (optional) +Deployment result = await functions.createDeployment( + functionId: '<FUNCTION_ID>', + code: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'), + activate: false, + entrypoint: '<ENTRYPOINT>', // (optional) + commands: '<COMMANDS>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index 66f09bcb..8d3eb744 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Functions functions = Functions(client); -Future result = functions.createExecution( - functionId: '<FUNCTION_ID>', - body: '<BODY>', // (optional) - xasync: false, // (optional) - path: '<PATH>', // (optional) - method: ExecutionMethod.gET, // (optional) - headers: {}, // (optional) +Execution result = await functions.createExecution( + functionId: '<FUNCTION_ID>', + body: '<BODY>', // (optional) + xasync: false, // (optional) + path: '<PATH>', // (optional) + method: ExecutionMethod.gET, // (optional) + headers: {}, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index f05f4a0d..7b4f0623 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.createVariable( - functionId: '<FUNCTION_ID>', - key: '<KEY>', - value: '<VALUE>', +Variable result = await functions.createVariable( + functionId: '<FUNCTION_ID>', + key: '<KEY>', + value: '<VALUE>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 1b9ad5f3..18e2d3e4 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -1,37 +1,31 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.create( - functionId: '<FUNCTION_ID>', - name: '<NAME>', - runtime: .node145, - execute: ["any"], // (optional) - events: [], // (optional) - schedule: '', // (optional) - timeout: 1, // (optional) - enabled: false, // (optional) - logging: false, // (optional) - entrypoint: '<ENTRYPOINT>', // (optional) - commands: '<COMMANDS>', // (optional) - installationId: '<INSTALLATION_ID>', // (optional) - providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // (optional) - providerBranch: '<PROVIDER_BRANCH>', // (optional) - providerSilentMode: false, // (optional) - providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // (optional) - templateRepository: '<TEMPLATE_REPOSITORY>', // (optional) - templateOwner: '<TEMPLATE_OWNER>', // (optional) - templateRootDirectory: '<TEMPLATE_ROOT_DIRECTORY>', // (optional) - templateBranch: '<TEMPLATE_BRANCH>', // (optional) +Func result = await functions.create( + functionId: '<FUNCTION_ID>', + name: '<NAME>', + runtime: .node145, + execute: ["any"], // (optional) + events: [], // (optional) + schedule: '', // (optional) + timeout: 1, // (optional) + enabled: false, // (optional) + logging: false, // (optional) + entrypoint: '<ENTRYPOINT>', // (optional) + commands: '<COMMANDS>', // (optional) + installationId: '<INSTALLATION_ID>', // (optional) + providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // (optional) + providerBranch: '<PROVIDER_BRANCH>', // (optional) + providerSilentMode: false, // (optional) + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // (optional) + templateRepository: '<TEMPLATE_REPOSITORY>', // (optional) + templateOwner: '<TEMPLATE_OWNER>', // (optional) + templateRootDirectory: '<TEMPLATE_ROOT_DIRECTORY>', // (optional) + templateBranch: '<TEMPLATE_BRANCH>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md index b9a5288a..a50d9e44 100644 --- a/docs/examples/functions/delete-deployment.md +++ b/docs/examples/functions/delete-deployment.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.deleteDeployment( - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>', +await functions.deleteDeployment( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md index 2558ac76..d677576e 100644 --- a/docs/examples/functions/delete-variable.md +++ b/docs/examples/functions/delete-variable.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.deleteVariable( - functionId: '<FUNCTION_ID>', - variableId: '<VARIABLE_ID>', +await functions.deleteVariable( + functionId: '<FUNCTION_ID>', + variableId: '<VARIABLE_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md index b6df6142..bca7d189 100644 --- a/docs/examples/functions/delete.md +++ b/docs/examples/functions/delete.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.delete( - functionId: '<FUNCTION_ID>', +await functions.delete( + functionId: '<FUNCTION_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/download-deployment.md b/docs/examples/functions/download-deployment.md index a28d3725..40e39a28 100644 --- a/docs/examples/functions/download-deployment.md +++ b/docs/examples/functions/download-deployment.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.downloadDeployment( - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>', +UInt8List result = await functions.downloadDeployment( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md index ce60b991..007e8486 100644 --- a/docs/examples/functions/get-deployment.md +++ b/docs/examples/functions/get-deployment.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.getDeployment( - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>', +Deployment result = await functions.getDeployment( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index d3d57291..856b92b3 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Functions functions = Functions(client); -Future result = functions.getExecution( - functionId: '<FUNCTION_ID>', - executionId: '<EXECUTION_ID>', +Execution result = await functions.getExecution( + functionId: '<FUNCTION_ID>', + executionId: '<EXECUTION_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md index c69bcf27..23285727 100644 --- a/docs/examples/functions/get-variable.md +++ b/docs/examples/functions/get-variable.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.getVariable( - functionId: '<FUNCTION_ID>', - variableId: '<VARIABLE_ID>', +Variable result = await functions.getVariable( + functionId: '<FUNCTION_ID>', + variableId: '<VARIABLE_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md index 95bb8422..b6d8c4ce 100644 --- a/docs/examples/functions/get.md +++ b/docs/examples/functions/get.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.get( - functionId: '<FUNCTION_ID>', +Func result = await functions.get( + functionId: '<FUNCTION_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index b59b8d50..c9fbc11b 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.listDeployments( - functionId: '<FUNCTION_ID>', - queries: [], // (optional) - search: '<SEARCH>', // (optional) +DeploymentList result = await functions.listDeployments( + functionId: '<FUNCTION_ID>', + queries: [], // (optional) + search: '<SEARCH>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index b33af63c..3b0af609 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Functions functions = Functions(client); -Future result = functions.listExecutions( - functionId: '<FUNCTION_ID>', - queries: [], // (optional) - search: '<SEARCH>', // (optional) +ExecutionList result = await functions.listExecutions( + functionId: '<FUNCTION_ID>', + queries: [], // (optional) + search: '<SEARCH>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md index b67db078..199ccce5 100644 --- a/docs/examples/functions/list-runtimes.md +++ b/docs/examples/functions/list-runtimes.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.listRuntimes(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +RuntimeList result = await functions.listRuntimes(); diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index 2952a10c..4c8396bb 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.listVariables( - functionId: '<FUNCTION_ID>', +VariableList result = await functions.listVariables( + functionId: '<FUNCTION_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index c614684f..d44b40ab 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.list( - queries: [], // (optional) - search: '<SEARCH>', // (optional) +FunctionList result = await functions.list( + queries: [], // (optional) + search: '<SEARCH>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/update-deployment.md b/docs/examples/functions/update-deployment.md index ecec8262..78d5061c 100644 --- a/docs/examples/functions/update-deployment.md +++ b/docs/examples/functions/update-deployment.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.updateDeployment( - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>', +Func result = await functions.updateDeployment( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index 6e819e46..d534be3f 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -1,21 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.updateVariable( - functionId: '<FUNCTION_ID>', - variableId: '<VARIABLE_ID>', - key: '<KEY>', - value: '<VALUE>', // (optional) +Variable result = await functions.updateVariable( + functionId: '<FUNCTION_ID>', + variableId: '<VARIABLE_ID>', + key: '<KEY>', + value: '<VALUE>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 818e8837..bc069a06 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -1,33 +1,27 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Functions functions = Functions(client); -Future result = functions.update( - functionId: '<FUNCTION_ID>', - name: '<NAME>', - runtime: .node145, // (optional) - execute: ["any"], // (optional) - events: [], // (optional) - schedule: '', // (optional) - timeout: 1, // (optional) - enabled: false, // (optional) - logging: false, // (optional) - entrypoint: '<ENTRYPOINT>', // (optional) - commands: '<COMMANDS>', // (optional) - installationId: '<INSTALLATION_ID>', // (optional) - providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // (optional) - providerBranch: '<PROVIDER_BRANCH>', // (optional) - providerSilentMode: false, // (optional) - providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // (optional) +Func result = await functions.update( + functionId: '<FUNCTION_ID>', + name: '<NAME>', + runtime: .node145, // (optional) + execute: ["any"], // (optional) + events: [], // (optional) + schedule: '', // (optional) + timeout: 1, // (optional) + enabled: false, // (optional) + logging: false, // (optional) + entrypoint: '<ENTRYPOINT>', // (optional) + commands: '<COMMANDS>', // (optional) + installationId: '<INSTALLATION_ID>', // (optional) + providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // (optional) + providerBranch: '<PROVIDER_BRANCH>', // (optional) + providerSilentMode: false, // (optional) + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index 56015d2a..75ba4cb0 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Graphql graphql = Graphql(client); -Future result = graphql.mutation( - query: {}, +Any result = await graphql.mutation( + query: {}, ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index 39fa1cab..b69a6da1 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Graphql graphql = Graphql(client); -Future result = graphql.query( - query: {}, +Any result = await graphql.query( + query: {}, ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md index 782fd9de..2c68b241 100644 --- a/docs/examples/health/get-antivirus.md +++ b/docs/examples/health/get-antivirus.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getAntivirus(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +HealthAntivirus result = await health.getAntivirus(); diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md index 83869cbf..b379ce53 100644 --- a/docs/examples/health/get-cache.md +++ b/docs/examples/health/get-cache.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getCache(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +HealthStatus result = await health.getCache(); diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md index 9396be0f..bd5c94e6 100644 --- a/docs/examples/health/get-certificate.md +++ b/docs/examples/health/get-certificate.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getCertificate( - domain: '', // (optional) +HealthCertificate result = await health.getCertificate( + domain: '', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/health/get-d-b.md b/docs/examples/health/get-d-b.md index d5408a43..3363a249 100644 --- a/docs/examples/health/get-d-b.md +++ b/docs/examples/health/get-d-b.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getDB(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +HealthStatus result = await health.getDB(); diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md index 66cd91f2..5e241f02 100644 --- a/docs/examples/health/get-failed-jobs.md +++ b/docs/examples/health/get-failed-jobs.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getFailedJobs( - name: .v1Database, - threshold: 0, // (optional) +HealthQueue result = await health.getFailedJobs( + name: .v1Database, + threshold: 0, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md index a1487cb6..c683c975 100644 --- a/docs/examples/health/get-pub-sub.md +++ b/docs/examples/health/get-pub-sub.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getPubSub(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +HealthStatus result = await health.getPubSub(); diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md index 65968de9..ba71783e 100644 --- a/docs/examples/health/get-queue-builds.md +++ b/docs/examples/health/get-queue-builds.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getQueueBuilds( - threshold: 0, // (optional) +HealthQueue result = await health.getQueueBuilds( + threshold: 0, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md index 701a79a7..1f2f44e2 100644 --- a/docs/examples/health/get-queue-certificates.md +++ b/docs/examples/health/get-queue-certificates.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getQueueCertificates( - threshold: 0, // (optional) +HealthQueue result = await health.getQueueCertificates( + threshold: 0, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md index b175a775..d10f47c2 100644 --- a/docs/examples/health/get-queue-databases.md +++ b/docs/examples/health/get-queue-databases.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getQueueDatabases( - name: '<NAME>', // (optional) - threshold: 0, // (optional) +HealthQueue result = await health.getQueueDatabases( + name: '<NAME>', // (optional) + threshold: 0, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md index ca203267..340e107c 100644 --- a/docs/examples/health/get-queue-deletes.md +++ b/docs/examples/health/get-queue-deletes.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getQueueDeletes( - threshold: 0, // (optional) +HealthQueue result = await health.getQueueDeletes( + threshold: 0, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md index bb8eb652..73e7d145 100644 --- a/docs/examples/health/get-queue-functions.md +++ b/docs/examples/health/get-queue-functions.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getQueueFunctions( - threshold: 0, // (optional) +HealthQueue result = await health.getQueueFunctions( + threshold: 0, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md index 4fd1afe0..f901273e 100644 --- a/docs/examples/health/get-queue-logs.md +++ b/docs/examples/health/get-queue-logs.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getQueueLogs( - threshold: 0, // (optional) +HealthQueue result = await health.getQueueLogs( + threshold: 0, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md index f5c04439..a0f14292 100644 --- a/docs/examples/health/get-queue-mails.md +++ b/docs/examples/health/get-queue-mails.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getQueueMails( - threshold: 0, // (optional) +HealthQueue result = await health.getQueueMails( + threshold: 0, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md index f2e5159f..d4e09f95 100644 --- a/docs/examples/health/get-queue-messaging.md +++ b/docs/examples/health/get-queue-messaging.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getQueueMessaging( - threshold: 0, // (optional) +HealthQueue result = await health.getQueueMessaging( + threshold: 0, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md index ac76f681..42d8aa10 100644 --- a/docs/examples/health/get-queue-migrations.md +++ b/docs/examples/health/get-queue-migrations.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getQueueMigrations( - threshold: 0, // (optional) +HealthQueue result = await health.getQueueMigrations( + threshold: 0, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md index 4ebe33af..d1d4c3ef 100644 --- a/docs/examples/health/get-queue-webhooks.md +++ b/docs/examples/health/get-queue-webhooks.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getQueueWebhooks( - threshold: 0, // (optional) +HealthQueue result = await health.getQueueWebhooks( + threshold: 0, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/health/get-queue.md b/docs/examples/health/get-queue.md index 56d804e6..87f72f4b 100644 --- a/docs/examples/health/get-queue.md +++ b/docs/examples/health/get-queue.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getQueue(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +HealthStatus result = await health.getQueue(); diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md index b2e4dbab..22232c00 100644 --- a/docs/examples/health/get-storage-local.md +++ b/docs/examples/health/get-storage-local.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getStorageLocal(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +HealthStatus result = await health.getStorageLocal(); diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md index 6d55ac2d..51f865cf 100644 --- a/docs/examples/health/get-time.md +++ b/docs/examples/health/get-time.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.getTime(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +HealthTime result = await health.getTime(); diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md index cb3c9c3a..ebabd7fd 100644 --- a/docs/examples/health/get.md +++ b/docs/examples/health/get.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Health health = Health(client); -Future result = health.get(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +HealthStatus result = await health.get(); diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index 84debf0e..12dd0749 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Locale locale = Locale(client); -Future result = locale.get(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +Locale result = await locale.get(); diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index 5ca9c62a..40a62a93 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Locale locale = Locale(client); -Future result = locale.listCodes(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +LocaleCodeList result = await locale.listCodes(); diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index 3d9fa7ea..5adf67a8 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Locale locale = Locale(client); -Future result = locale.listContinents(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +ContinentList result = await locale.listContinents(); diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-e-u.md index a51c92c0..14890ae4 100644 --- a/docs/examples/locale/list-countries-e-u.md +++ b/docs/examples/locale/list-countries-e-u.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Locale locale = Locale(client); -Future result = locale.listCountriesEU(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +CountryList result = await locale.listCountriesEU(); diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index 402a5d8a..a4764593 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Locale locale = Locale(client); -Future result = locale.listCountriesPhones(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +PhoneList result = await locale.listCountriesPhones(); diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index 2bae8194..5cc508b9 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Locale locale = Locale(client); -Future result = locale.listCountries(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +CountryList result = await locale.listCountries(); diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index c8694c65..afb4cf49 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Locale locale = Locale(client); -Future result = locale.listCurrencies(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +CurrencyList result = await locale.listCurrencies(); diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index 8f704106..2a83e2d7 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -1,16 +1,10 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Locale locale = Locale(client); -Future result = locale.listLanguages(); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); +LanguageList result = await locale.listLanguages(); diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md index 91552e7b..fa6b867e 100644 --- a/docs/examples/messaging/create-apns-provider.md +++ b/docs/examples/messaging/create-apns-provider.md @@ -1,25 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.createApnsProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', - authKey: '<AUTH_KEY>', // (optional) - authKeyId: '<AUTH_KEY_ID>', // (optional) - teamId: '<TEAM_ID>', // (optional) - bundleId: '<BUNDLE_ID>', // (optional) - sandbox: false, // (optional) - enabled: false, // (optional) +Provider result = await messaging.createApnsProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + authKey: '<AUTH_KEY>', // (optional) + authKeyId: '<AUTH_KEY_ID>', // (optional) + teamId: '<TEAM_ID>', // (optional) + bundleId: '<BUNDLE_ID>', // (optional) + sandbox: false, // (optional) + enabled: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md index 1fdaf411..56b542ee 100644 --- a/docs/examples/messaging/create-email.md +++ b/docs/examples/messaging/create-email.md @@ -1,29 +1,23 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.createEmail( - messageId: '<MESSAGE_ID>', - subject: '<SUBJECT>', - content: '<CONTENT>', - topics: [], // (optional) - users: [], // (optional) - targets: [], // (optional) - cc: [], // (optional) - bcc: [], // (optional) - attachments: [], // (optional) - status: MessageStatus.draft, // (optional) - html: false, // (optional) - scheduledAt: '', // (optional) +Message result = await messaging.createEmail( + messageId: '<MESSAGE_ID>', + subject: '<SUBJECT>', + content: '<CONTENT>', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + cc: [], // (optional) + bcc: [], // (optional) + attachments: [], // (optional) + draft: false, // (optional) + html: false, // (optional) + scheduledAt: '', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md index d73d9371..2f14a3db 100644 --- a/docs/examples/messaging/create-fcm-provider.md +++ b/docs/examples/messaging/create-fcm-provider.md @@ -1,21 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.createFcmProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', - serviceAccountJSON: {}, // (optional) - enabled: false, // (optional) +Provider result = await messaging.createFcmProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + serviceAccountJSON: {}, // (optional) + enabled: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md index 29ecbec7..c4187120 100644 --- a/docs/examples/messaging/create-mailgun-provider.md +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -1,27 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.createMailgunProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', - apiKey: '<API_KEY>', // (optional) - domain: '<DOMAIN>', // (optional) - isEuRegion: false, // (optional) - fromName: '<FROM_NAME>', // (optional) - fromEmail: 'email@example.com', // (optional) - replyToName: '<REPLY_TO_NAME>', // (optional) - replyToEmail: 'email@example.com', // (optional) - enabled: false, // (optional) +Provider result = await messaging.createMailgunProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + apiKey: '<API_KEY>', // (optional) + domain: '<DOMAIN>', // (optional) + isEuRegion: false, // (optional) + fromName: '<FROM_NAME>', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '<REPLY_TO_NAME>', // (optional) + replyToEmail: 'email@example.com', // (optional) + enabled: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/create-msg91provider.md b/docs/examples/messaging/create-msg91provider.md index 6de77c4c..95c508fa 100644 --- a/docs/examples/messaging/create-msg91provider.md +++ b/docs/examples/messaging/create-msg91provider.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.createMsg91Provider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // (optional) - senderId: '<SENDER_ID>', // (optional) - authKey: '<AUTH_KEY>', // (optional) - enabled: false, // (optional) +Provider result = await messaging.createMsg91Provider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // (optional) + senderId: '<SENDER_ID>', // (optional) + authKey: '<AUTH_KEY>', // (optional) + enabled: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index 1981f695..0249485f 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -1,33 +1,27 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.createPush( - messageId: '<MESSAGE_ID>', - title: '<TITLE>', - body: '<BODY>', - topics: [], // (optional) - users: [], // (optional) - targets: [], // (optional) - data: {}, // (optional) - action: '<ACTION>', // (optional) - image: '[ID1:ID2]', // (optional) - icon: '<ICON>', // (optional) - sound: '<SOUND>', // (optional) - color: '<COLOR>', // (optional) - tag: '<TAG>', // (optional) - badge: '<BADGE>', // (optional) - status: MessageStatus.draft, // (optional) - scheduledAt: '', // (optional) +Message result = await messaging.createPush( + messageId: '<MESSAGE_ID>', + title: '<TITLE>', + body: '<BODY>', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + data: {}, // (optional) + action: '<ACTION>', // (optional) + image: '[ID1:ID2]', // (optional) + icon: '<ICON>', // (optional) + sound: '<SOUND>', // (optional) + color: '<COLOR>', // (optional) + tag: '<TAG>', // (optional) + badge: '<BADGE>', // (optional) + draft: false, // (optional) + scheduledAt: '', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md index 254da707..7194fd6f 100644 --- a/docs/examples/messaging/create-sendgrid-provider.md +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -1,25 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.createSendgridProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', - apiKey: '<API_KEY>', // (optional) - fromName: '<FROM_NAME>', // (optional) - fromEmail: 'email@example.com', // (optional) - replyToName: '<REPLY_TO_NAME>', // (optional) - replyToEmail: 'email@example.com', // (optional) - enabled: false, // (optional) +Provider result = await messaging.createSendgridProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + apiKey: '<API_KEY>', // (optional) + fromName: '<FROM_NAME>', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '<REPLY_TO_NAME>', // (optional) + replyToEmail: 'email@example.com', // (optional) + enabled: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md index 637c5e80..ed672610 100644 --- a/docs/examples/messaging/create-sms.md +++ b/docs/examples/messaging/create-sms.md @@ -1,24 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.createSms( - messageId: '<MESSAGE_ID>', - content: '<CONTENT>', - topics: [], // (optional) - users: [], // (optional) - targets: [], // (optional) - status: MessageStatus.draft, // (optional) - scheduledAt: '', // (optional) +Message result = await messaging.createSms( + messageId: '<MESSAGE_ID>', + content: '<CONTENT>', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + draft: false, // (optional) + scheduledAt: '', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index abc18a3a..7eb8f907 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -1,31 +1,25 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.createSmtpProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', - host: '<HOST>', - port: 1, // (optional) - username: '<USERNAME>', // (optional) - password: '<PASSWORD>', // (optional) - encryption: SmtpEncryption.none, // (optional) - autoTLS: false, // (optional) - mailer: '<MAILER>', // (optional) - fromName: '<FROM_NAME>', // (optional) - fromEmail: 'email@example.com', // (optional) - replyToName: '<REPLY_TO_NAME>', // (optional) - replyToEmail: 'email@example.com', // (optional) - enabled: false, // (optional) +Provider result = await messaging.createSmtpProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + host: '<HOST>', + port: 1, // (optional) + username: '<USERNAME>', // (optional) + password: '<PASSWORD>', // (optional) + encryption: SmtpEncryption.none, // (optional) + autoTLS: false, // (optional) + mailer: '<MAILER>', // (optional) + fromName: '<FROM_NAME>', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '<REPLY_TO_NAME>', // (optional) + replyToEmail: 'email@example.com', // (optional) + enabled: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md index c743814a..d7e31385 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...'); // Your secret JSON Web Token + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...'); // Your secret JSON Web Token Messaging messaging = Messaging(client); -Future result = messaging.createSubscriber( - topicId: '<TOPIC_ID>', - subscriberId: '<SUBSCRIBER_ID>', - targetId: '<TARGET_ID>', +Subscriber result = await messaging.createSubscriber( + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>', + targetId: '<TARGET_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md index 31f60823..b5c475ca 100644 --- a/docs/examples/messaging/create-telesign-provider.md +++ b/docs/examples/messaging/create-telesign-provider.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.createTelesignProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // (optional) - customerId: '<CUSTOMER_ID>', // (optional) - apiKey: '<API_KEY>', // (optional) - enabled: false, // (optional) +Provider result = await messaging.createTelesignProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // (optional) + customerId: '<CUSTOMER_ID>', // (optional) + apiKey: '<API_KEY>', // (optional) + enabled: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md index 22e149bd..5b40a6ab 100644 --- a/docs/examples/messaging/create-textmagic-provider.md +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.createTextmagicProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // (optional) - username: '<USERNAME>', // (optional) - apiKey: '<API_KEY>', // (optional) - enabled: false, // (optional) +Provider result = await messaging.createTextmagicProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // (optional) + username: '<USERNAME>', // (optional) + apiKey: '<API_KEY>', // (optional) + enabled: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md index cf8614cc..f7352857 100644 --- a/docs/examples/messaging/create-topic.md +++ b/docs/examples/messaging/create-topic.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.createTopic( - topicId: '<TOPIC_ID>', - name: '<NAME>', - subscribe: ["any"], // (optional) +Topic result = await messaging.createTopic( + topicId: '<TOPIC_ID>', + name: '<NAME>', + subscribe: ["any"], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md index e0cfc4d6..050e06a3 100644 --- a/docs/examples/messaging/create-twilio-provider.md +++ b/docs/examples/messaging/create-twilio-provider.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.createTwilioProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // (optional) - accountSid: '<ACCOUNT_SID>', // (optional) - authToken: '<AUTH_TOKEN>', // (optional) - enabled: false, // (optional) +Provider result = await messaging.createTwilioProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // (optional) + accountSid: '<ACCOUNT_SID>', // (optional) + authToken: '<AUTH_TOKEN>', // (optional) + enabled: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md index 6a5f855e..31e3e829 100644 --- a/docs/examples/messaging/create-vonage-provider.md +++ b/docs/examples/messaging/create-vonage-provider.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.createVonageProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // (optional) - apiKey: '<API_KEY>', // (optional) - apiSecret: '<API_SECRET>', // (optional) - enabled: false, // (optional) +Provider result = await messaging.createVonageProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // (optional) + apiKey: '<API_KEY>', // (optional) + apiSecret: '<API_SECRET>', // (optional) + enabled: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md index 0c3282c4..1761eb8d 100644 --- a/docs/examples/messaging/delete-provider.md +++ b/docs/examples/messaging/delete-provider.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.deleteProvider( - providerId: '<PROVIDER_ID>', +await messaging.deleteProvider( + providerId: '<PROVIDER_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md index af22f593..7a098dda 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...'); // Your secret JSON Web Token + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...'); // Your secret JSON Web Token Messaging messaging = Messaging(client); -Future result = messaging.deleteSubscriber( - topicId: '<TOPIC_ID>', - subscriberId: '<SUBSCRIBER_ID>', +await messaging.deleteSubscriber( + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md index 586842d6..7455d50b 100644 --- a/docs/examples/messaging/delete-topic.md +++ b/docs/examples/messaging/delete-topic.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.deleteTopic( - topicId: '<TOPIC_ID>', +await messaging.deleteTopic( + topicId: '<TOPIC_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md index eaaa70c1..549c5eb0 100644 --- a/docs/examples/messaging/delete.md +++ b/docs/examples/messaging/delete.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.delete( - messageId: '<MESSAGE_ID>', +await messaging.delete( + messageId: '<MESSAGE_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md index b189b37f..a89f8030 100644 --- a/docs/examples/messaging/get-message.md +++ b/docs/examples/messaging/get-message.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.getMessage( - messageId: '<MESSAGE_ID>', +Message result = await messaging.getMessage( + messageId: '<MESSAGE_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md index a9614959..3b1f2338 100644 --- a/docs/examples/messaging/get-provider.md +++ b/docs/examples/messaging/get-provider.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.getProvider( - providerId: '<PROVIDER_ID>', +Provider result = await messaging.getProvider( + providerId: '<PROVIDER_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md index 22447162..33caa761 100644 --- a/docs/examples/messaging/get-subscriber.md +++ b/docs/examples/messaging/get-subscriber.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.getSubscriber( - topicId: '<TOPIC_ID>', - subscriberId: '<SUBSCRIBER_ID>', +Subscriber result = await messaging.getSubscriber( + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md index f256312b..d90aea0c 100644 --- a/docs/examples/messaging/get-topic.md +++ b/docs/examples/messaging/get-topic.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.getTopic( - topicId: '<TOPIC_ID>', +Topic result = await messaging.getTopic( + topicId: '<TOPIC_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md index b85765e4..c3f6a27e 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/messaging/list-message-logs.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.listMessageLogs( - messageId: '<MESSAGE_ID>', - queries: [], // (optional) +LogList result = await messaging.listMessageLogs( + messageId: '<MESSAGE_ID>', + queries: [], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md index 923bbaaa..6532f0f9 100644 --- a/docs/examples/messaging/list-messages.md +++ b/docs/examples/messaging/list-messages.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.listMessages( - queries: [], // (optional) - search: '<SEARCH>', // (optional) +MessageList result = await messaging.listMessages( + queries: [], // (optional) + search: '<SEARCH>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md index 44138988..a21afd48 100644 --- a/docs/examples/messaging/list-provider-logs.md +++ b/docs/examples/messaging/list-provider-logs.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.listProviderLogs( - providerId: '<PROVIDER_ID>', - queries: [], // (optional) +LogList result = await messaging.listProviderLogs( + providerId: '<PROVIDER_ID>', + queries: [], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md index 0da36c0a..072cb32c 100644 --- a/docs/examples/messaging/list-providers.md +++ b/docs/examples/messaging/list-providers.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.listProviders( - queries: [], // (optional) - search: '<SEARCH>', // (optional) +ProviderList result = await messaging.listProviders( + queries: [], // (optional) + search: '<SEARCH>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md index 1ff41617..993b0936 100644 --- a/docs/examples/messaging/list-subscriber-logs.md +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.listSubscriberLogs( - subscriberId: '<SUBSCRIBER_ID>', - queries: [], // (optional) +LogList result = await messaging.listSubscriberLogs( + subscriberId: '<SUBSCRIBER_ID>', + queries: [], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md index c30fdcdb..87a2e79e 100644 --- a/docs/examples/messaging/list-subscribers.md +++ b/docs/examples/messaging/list-subscribers.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.listSubscribers( - topicId: '<TOPIC_ID>', - queries: [], // (optional) - search: '<SEARCH>', // (optional) +SubscriberList result = await messaging.listSubscribers( + topicId: '<TOPIC_ID>', + queries: [], // (optional) + search: '<SEARCH>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md index 88c652d5..e3e95823 100644 --- a/docs/examples/messaging/list-targets.md +++ b/docs/examples/messaging/list-targets.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.listTargets( - messageId: '<MESSAGE_ID>', - queries: [], // (optional) +TargetList result = await messaging.listTargets( + messageId: '<MESSAGE_ID>', + queries: [], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md index e58597b5..232d6ecc 100644 --- a/docs/examples/messaging/list-topic-logs.md +++ b/docs/examples/messaging/list-topic-logs.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.listTopicLogs( - topicId: '<TOPIC_ID>', - queries: [], // (optional) +LogList result = await messaging.listTopicLogs( + topicId: '<TOPIC_ID>', + queries: [], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md index e050daae..53893749 100644 --- a/docs/examples/messaging/list-topics.md +++ b/docs/examples/messaging/list-topics.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.listTopics( - queries: [], // (optional) - search: '<SEARCH>', // (optional) +TopicList result = await messaging.listTopics( + queries: [], // (optional) + search: '<SEARCH>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md index 5ec0a40f..9c13397b 100644 --- a/docs/examples/messaging/update-apns-provider.md +++ b/docs/examples/messaging/update-apns-provider.md @@ -1,25 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.updateApnsProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // (optional) - enabled: false, // (optional) - authKey: '<AUTH_KEY>', // (optional) - authKeyId: '<AUTH_KEY_ID>', // (optional) - teamId: '<TEAM_ID>', // (optional) - bundleId: '<BUNDLE_ID>', // (optional) - sandbox: false, // (optional) +Provider result = await messaging.updateApnsProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + enabled: false, // (optional) + authKey: '<AUTH_KEY>', // (optional) + authKeyId: '<AUTH_KEY_ID>', // (optional) + teamId: '<TEAM_ID>', // (optional) + bundleId: '<BUNDLE_ID>', // (optional) + sandbox: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index 00e00415..c4c6173a 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -1,28 +1,22 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.updateEmail( - messageId: '<MESSAGE_ID>', - topics: [], // (optional) - users: [], // (optional) - targets: [], // (optional) - subject: '<SUBJECT>', // (optional) - content: '<CONTENT>', // (optional) - status: MessageStatus.draft, // (optional) - html: false, // (optional) - cc: [], // (optional) - bcc: [], // (optional) - scheduledAt: '', // (optional) +Message result = await messaging.updateEmail( + messageId: '<MESSAGE_ID>', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + subject: '<SUBJECT>', // (optional) + content: '<CONTENT>', // (optional) + draft: false, // (optional) + html: false, // (optional) + cc: [], // (optional) + bcc: [], // (optional) + scheduledAt: '', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md index b48892af..ec2ff349 100644 --- a/docs/examples/messaging/update-fcm-provider.md +++ b/docs/examples/messaging/update-fcm-provider.md @@ -1,21 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.updateFcmProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // (optional) - enabled: false, // (optional) - serviceAccountJSON: {}, // (optional) +Provider result = await messaging.updateFcmProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + enabled: false, // (optional) + serviceAccountJSON: {}, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md index fbae717a..ddf4ef4a 100644 --- a/docs/examples/messaging/update-mailgun-provider.md +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -1,27 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.updateMailgunProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // (optional) - apiKey: '<API_KEY>', // (optional) - domain: '<DOMAIN>', // (optional) - isEuRegion: false, // (optional) - enabled: false, // (optional) - fromName: '<FROM_NAME>', // (optional) - fromEmail: 'email@example.com', // (optional) - replyToName: '<REPLY_TO_NAME>', // (optional) - replyToEmail: '<REPLY_TO_EMAIL>', // (optional) +Provider result = await messaging.updateMailgunProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + apiKey: '<API_KEY>', // (optional) + domain: '<DOMAIN>', // (optional) + isEuRegion: false, // (optional) + enabled: false, // (optional) + fromName: '<FROM_NAME>', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '<REPLY_TO_NAME>', // (optional) + replyToEmail: '<REPLY_TO_EMAIL>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/update-msg91provider.md b/docs/examples/messaging/update-msg91provider.md index 79876e94..6966b15e 100644 --- a/docs/examples/messaging/update-msg91provider.md +++ b/docs/examples/messaging/update-msg91provider.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.updateMsg91Provider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // (optional) - enabled: false, // (optional) - senderId: '<SENDER_ID>', // (optional) - authKey: '<AUTH_KEY>', // (optional) - from: '<FROM>', // (optional) +Provider result = await messaging.updateMsg91Provider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + enabled: false, // (optional) + senderId: '<SENDER_ID>', // (optional) + authKey: '<AUTH_KEY>', // (optional) + from: '<FROM>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index dad44dbd..7b01b5c3 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -1,33 +1,27 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.updatePush( - messageId: '<MESSAGE_ID>', - topics: [], // (optional) - users: [], // (optional) - targets: [], // (optional) - title: '<TITLE>', // (optional) - body: '<BODY>', // (optional) - data: {}, // (optional) - action: '<ACTION>', // (optional) - image: '[ID1:ID2]', // (optional) - icon: '<ICON>', // (optional) - sound: '<SOUND>', // (optional) - color: '<COLOR>', // (optional) - tag: '<TAG>', // (optional) - badge: 0, // (optional) - status: MessageStatus.draft, // (optional) - scheduledAt: '', // (optional) +Message result = await messaging.updatePush( + messageId: '<MESSAGE_ID>', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + title: '<TITLE>', // (optional) + body: '<BODY>', // (optional) + data: {}, // (optional) + action: '<ACTION>', // (optional) + image: '[ID1:ID2]', // (optional) + icon: '<ICON>', // (optional) + sound: '<SOUND>', // (optional) + color: '<COLOR>', // (optional) + tag: '<TAG>', // (optional) + badge: 0, // (optional) + draft: false, // (optional) + scheduledAt: '', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md index 3284a603..f23d0369 100644 --- a/docs/examples/messaging/update-sendgrid-provider.md +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -1,25 +1,19 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.updateSendgridProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // (optional) - enabled: false, // (optional) - apiKey: '<API_KEY>', // (optional) - fromName: '<FROM_NAME>', // (optional) - fromEmail: 'email@example.com', // (optional) - replyToName: '<REPLY_TO_NAME>', // (optional) - replyToEmail: '<REPLY_TO_EMAIL>', // (optional) +Provider result = await messaging.updateSendgridProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + enabled: false, // (optional) + apiKey: '<API_KEY>', // (optional) + fromName: '<FROM_NAME>', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '<REPLY_TO_NAME>', // (optional) + replyToEmail: '<REPLY_TO_EMAIL>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md index aabb1805..054da060 100644 --- a/docs/examples/messaging/update-sms.md +++ b/docs/examples/messaging/update-sms.md @@ -1,24 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.updateSms( - messageId: '<MESSAGE_ID>', - topics: [], // (optional) - users: [], // (optional) - targets: [], // (optional) - content: '<CONTENT>', // (optional) - status: MessageStatus.draft, // (optional) - scheduledAt: '', // (optional) +Message result = await messaging.updateSms( + messageId: '<MESSAGE_ID>', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + content: '<CONTENT>', // (optional) + draft: false, // (optional) + scheduledAt: '', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index 7e369e4f..5d3fff93 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -1,31 +1,25 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.updateSmtpProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // (optional) - host: '<HOST>', // (optional) - port: 1, // (optional) - username: '<USERNAME>', // (optional) - password: '<PASSWORD>', // (optional) - encryption: SmtpEncryption.none, // (optional) - autoTLS: false, // (optional) - mailer: '<MAILER>', // (optional) - fromName: '<FROM_NAME>', // (optional) - fromEmail: 'email@example.com', // (optional) - replyToName: '<REPLY_TO_NAME>', // (optional) - replyToEmail: '<REPLY_TO_EMAIL>', // (optional) - enabled: false, // (optional) +Provider result = await messaging.updateSmtpProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + host: '<HOST>', // (optional) + port: 1, // (optional) + username: '<USERNAME>', // (optional) + password: '<PASSWORD>', // (optional) + encryption: SmtpEncryption.none, // (optional) + autoTLS: false, // (optional) + mailer: '<MAILER>', // (optional) + fromName: '<FROM_NAME>', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '<REPLY_TO_NAME>', // (optional) + replyToEmail: '<REPLY_TO_EMAIL>', // (optional) + enabled: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md index e19fdcfe..d347df24 100644 --- a/docs/examples/messaging/update-telesign-provider.md +++ b/docs/examples/messaging/update-telesign-provider.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.updateTelesignProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // (optional) - enabled: false, // (optional) - customerId: '<CUSTOMER_ID>', // (optional) - apiKey: '<API_KEY>', // (optional) - from: '<FROM>', // (optional) +Provider result = await messaging.updateTelesignProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + enabled: false, // (optional) + customerId: '<CUSTOMER_ID>', // (optional) + apiKey: '<API_KEY>', // (optional) + from: '<FROM>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md index 16843cd7..ef0be218 100644 --- a/docs/examples/messaging/update-textmagic-provider.md +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.updateTextmagicProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // (optional) - enabled: false, // (optional) - username: '<USERNAME>', // (optional) - apiKey: '<API_KEY>', // (optional) - from: '<FROM>', // (optional) +Provider result = await messaging.updateTextmagicProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + enabled: false, // (optional) + username: '<USERNAME>', // (optional) + apiKey: '<API_KEY>', // (optional) + from: '<FROM>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md index eae39824..29bda3d6 100644 --- a/docs/examples/messaging/update-topic.md +++ b/docs/examples/messaging/update-topic.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.updateTopic( - topicId: '<TOPIC_ID>', - name: '<NAME>', // (optional) - subscribe: ["any"], // (optional) +Topic result = await messaging.updateTopic( + topicId: '<TOPIC_ID>', + name: '<NAME>', // (optional) + subscribe: ["any"], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md index b65a1deb..7eb7cbf4 100644 --- a/docs/examples/messaging/update-twilio-provider.md +++ b/docs/examples/messaging/update-twilio-provider.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.updateTwilioProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // (optional) - enabled: false, // (optional) - accountSid: '<ACCOUNT_SID>', // (optional) - authToken: '<AUTH_TOKEN>', // (optional) - from: '<FROM>', // (optional) +Provider result = await messaging.updateTwilioProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + enabled: false, // (optional) + accountSid: '<ACCOUNT_SID>', // (optional) + authToken: '<AUTH_TOKEN>', // (optional) + from: '<FROM>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md index 692171d3..9965229a 100644 --- a/docs/examples/messaging/update-vonage-provider.md +++ b/docs/examples/messaging/update-vonage-provider.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Messaging messaging = Messaging(client); -Future result = messaging.updateVonageProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // (optional) - enabled: false, // (optional) - apiKey: '<API_KEY>', // (optional) - apiSecret: '<API_SECRET>', // (optional) - from: '<FROM>', // (optional) +Provider result = await messaging.updateVonageProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + enabled: false, // (optional) + apiKey: '<API_KEY>', // (optional) + apiSecret: '<API_SECRET>', // (optional) + from: '<FROM>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index aae1ab5c..4cdc5b56 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -1,27 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Storage storage = Storage(client); -Future result = storage.createBucket( - bucketId: '<BUCKET_ID>', - name: '<NAME>', - permissions: ["read("any")"], // (optional) - fileSecurity: false, // (optional) - enabled: false, // (optional) - maximumFileSize: 1, // (optional) - allowedFileExtensions: [], // (optional) - compression: .none, // (optional) - encryption: false, // (optional) - antivirus: false, // (optional) +Bucket result = await storage.createBucket( + bucketId: '<BUCKET_ID>', + name: '<NAME>', + permissions: ["read("any")"], // (optional) + fileSecurity: false, // (optional) + enabled: false, // (optional) + maximumFileSize: 1, // (optional) + allowedFileExtensions: [], // (optional) + compression: .none, // (optional) + encryption: false, // (optional) + antivirus: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index 565d213e..fb46c84c 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -2,21 +2,15 @@ import 'dart:io'; import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Storage storage = Storage(client); -Future result = storage.createFile( - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - file: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'), - permissions: ["read("any")"], // (optional) +File result = await storage.createFile( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + file: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'), + permissions: ["read("any")"], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md index 2e6de8ac..28b8a5ff 100644 --- a/docs/examples/storage/delete-bucket.md +++ b/docs/examples/storage/delete-bucket.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Storage storage = Storage(client); -Future result = storage.deleteBucket( - bucketId: '<BUCKET_ID>', +await storage.deleteBucket( + bucketId: '<BUCKET_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index 8027e44f..b50ebce4 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Storage storage = Storage(client); -Future result = storage.deleteFile( - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', +await storage.deleteFile( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md index 293194d7..b425a9f8 100644 --- a/docs/examples/storage/get-bucket.md +++ b/docs/examples/storage/get-bucket.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Storage storage = Storage(client); -Future result = storage.getBucket( - bucketId: '<BUCKET_ID>', +Bucket result = await storage.getBucket( + bucketId: '<BUCKET_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index 1929b87d..06612637 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Storage storage = Storage(client); -Future result = storage.getFileDownload( - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', +UInt8List result = await storage.getFileDownload( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index ebda5c50..70a23321 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -1,30 +1,24 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Storage storage = Storage(client); -Future result = storage.getFilePreview( - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - width: 0, // (optional) - height: 0, // (optional) - gravity: ImageGravity.center, // (optional) - quality: 0, // (optional) - borderWidth: 0, // (optional) - borderColor: '', // (optional) - borderRadius: 0, // (optional) - opacity: 0, // (optional) - rotation: -360, // (optional) - background: '', // (optional) - output: ImageFormat.jpg, // (optional) +UInt8List result = await storage.getFilePreview( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + width: 0, // (optional) + height: 0, // (optional) + gravity: ImageGravity.center, // (optional) + quality: 0, // (optional) + borderWidth: 0, // (optional) + borderColor: '', // (optional) + borderRadius: 0, // (optional) + opacity: 0, // (optional) + rotation: -360, // (optional) + background: '', // (optional) + output: ImageFormat.jpg, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index bd4679b7..fa147105 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Storage storage = Storage(client); -Future result = storage.getFileView( - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', +UInt8List result = await storage.getFileView( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index 96651d1e..c5ca6182 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Storage storage = Storage(client); -Future result = storage.getFile( - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', +File result = await storage.getFile( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index c13dc42a..d5e26a2c 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Storage storage = Storage(client); -Future result = storage.listBuckets( - queries: [], // (optional) - search: '<SEARCH>', // (optional) +BucketList result = await storage.listBuckets( + queries: [], // (optional) + search: '<SEARCH>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index 3dbb96de..45555f22 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Storage storage = Storage(client); -Future result = storage.listFiles( - bucketId: '<BUCKET_ID>', - queries: [], // (optional) - search: '<SEARCH>', // (optional) +FileList result = await storage.listFiles( + bucketId: '<BUCKET_ID>', + queries: [], // (optional) + search: '<SEARCH>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index 6292a1a8..20215767 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -1,27 +1,21 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Storage storage = Storage(client); -Future result = storage.updateBucket( - bucketId: '<BUCKET_ID>', - name: '<NAME>', - permissions: ["read("any")"], // (optional) - fileSecurity: false, // (optional) - enabled: false, // (optional) - maximumFileSize: 1, // (optional) - allowedFileExtensions: [], // (optional) - compression: .none, // (optional) - encryption: false, // (optional) - antivirus: false, // (optional) +Bucket result = await storage.updateBucket( + bucketId: '<BUCKET_ID>', + name: '<NAME>', + permissions: ["read("any")"], // (optional) + fileSecurity: false, // (optional) + enabled: false, // (optional) + maximumFileSize: 1, // (optional) + allowedFileExtensions: [], // (optional) + compression: .none, // (optional) + encryption: false, // (optional) + antivirus: false, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index 601542c6..5801bfd4 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -1,21 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Storage storage = Storage(client); -Future result = storage.updateFile( - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - name: '<NAME>', // (optional) - permissions: ["read("any")"], // (optional) +File result = await storage.updateFile( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + name: '<NAME>', // (optional) + permissions: ["read("any")"], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index c7c132c4..679a9c02 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -1,24 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Teams teams = Teams(client); -Future result = teams.createMembership( - teamId: '<TEAM_ID>', - roles: [], - email: 'email@example.com', // (optional) - userId: '<USER_ID>', // (optional) - phone: '+12065550100', // (optional) - url: 'https://example.com', // (optional) - name: '<NAME>', // (optional) +Membership result = await teams.createMembership( + teamId: '<TEAM_ID>', + roles: [], + email: 'email@example.com', // (optional) + userId: '<USER_ID>', // (optional) + phone: '+12065550100', // (optional) + url: 'https://example.com', // (optional) + name: '<NAME>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index 9ab7fc4b..1606dfb9 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Teams teams = Teams(client); -Future result = teams.create( - teamId: '<TEAM_ID>', - name: '<NAME>', - roles: [], // (optional) +Team result = await teams.create( + teamId: '<TEAM_ID>', + name: '<NAME>', + roles: [], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index 56e20b01..f4396100 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Teams teams = Teams(client); -Future result = teams.deleteMembership( - teamId: '<TEAM_ID>', - membershipId: '<MEMBERSHIP_ID>', +await teams.deleteMembership( + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index 06e1630b..c41fbd98 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Teams teams = Teams(client); -Future result = teams.delete( - teamId: '<TEAM_ID>', +await teams.delete( + teamId: '<TEAM_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index c16a7eb5..5b8b51f4 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Teams teams = Teams(client); -Future result = teams.getMembership( - teamId: '<TEAM_ID>', - membershipId: '<MEMBERSHIP_ID>', +Membership result = await teams.getMembership( + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index ca5b8d44..4038c092 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Teams teams = Teams(client); -Future result = teams.getPrefs( - teamId: '<TEAM_ID>', +Preferences result = await teams.getPrefs( + teamId: '<TEAM_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index 849b0735..677c7084 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Teams teams = Teams(client); -Future result = teams.get( - teamId: '<TEAM_ID>', +Team result = await teams.get( + teamId: '<TEAM_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index ad519276..6c1da3f7 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Teams teams = Teams(client); -Future result = teams.listMemberships( - teamId: '<TEAM_ID>', - queries: [], // (optional) - search: '<SEARCH>', // (optional) +MembershipList result = await teams.listMemberships( + teamId: '<TEAM_ID>', + queries: [], // (optional) + search: '<SEARCH>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index 2f0aeb1a..09a4548c 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Teams teams = Teams(client); -Future result = teams.list( - queries: [], // (optional) - search: '<SEARCH>', // (optional) +TeamList result = await teams.list( + queries: [], // (optional) + search: '<SEARCH>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index bb5046f6..befb753c 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -1,21 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Teams teams = Teams(client); -Future result = teams.updateMembershipStatus( - teamId: '<TEAM_ID>', - membershipId: '<MEMBERSHIP_ID>', - userId: '<USER_ID>', - secret: '<SECRET>', +Membership result = await teams.updateMembershipStatus( + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', + userId: '<USER_ID>', + secret: '<SECRET>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index f7092721..5e976887 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Teams teams = Teams(client); -Future result = teams.updateMembership( - teamId: '<TEAM_ID>', - membershipId: '<MEMBERSHIP_ID>', - roles: [], +Membership result = await teams.updateMembership( + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', + roles: [], ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index 9c066ab2..93e2e3c2 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Teams teams = Teams(client); -Future result = teams.updateName( - teamId: '<TEAM_ID>', - name: '<NAME>', +Team result = await teams.updateName( + teamId: '<TEAM_ID>', + name: '<NAME>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index 644f146c..22c13dac 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setSession(''); // The user session to authenticate with + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with Teams teams = Teams(client); -Future result = teams.updatePrefs( - teamId: '<TEAM_ID>', - prefs: {}, +Preferences result = await teams.updatePrefs( + teamId: '<TEAM_ID>', + prefs: {}, ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/create-argon2user.md b/docs/examples/users/create-argon2user.md index 6b7c36b7..080e66a5 100644 --- a/docs/examples/users/create-argon2user.md +++ b/docs/examples/users/create-argon2user.md @@ -1,21 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.createArgon2User( - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>', // (optional) +User result = await users.createArgon2User( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md index 02d0c9c6..afddc2c9 100644 --- a/docs/examples/users/create-bcrypt-user.md +++ b/docs/examples/users/create-bcrypt-user.md @@ -1,21 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.createBcryptUser( - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>', // (optional) +User result = await users.createBcryptUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/create-m-d5user.md b/docs/examples/users/create-m-d5user.md index 771d3bac..05a9cc19 100644 --- a/docs/examples/users/create-m-d5user.md +++ b/docs/examples/users/create-m-d5user.md @@ -1,21 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.createMD5User( - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>', // (optional) +User result = await users.createMD5User( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/create-p-h-pass-user.md b/docs/examples/users/create-p-h-pass-user.md index 03576ab4..952584d4 100644 --- a/docs/examples/users/create-p-h-pass-user.md +++ b/docs/examples/users/create-p-h-pass-user.md @@ -1,21 +1,15 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.createPHPassUser( - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>', // (optional) +User result = await users.createPHPassUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/create-s-h-a-user.md b/docs/examples/users/create-s-h-a-user.md index 35c34f07..9b29c5b8 100644 --- a/docs/examples/users/create-s-h-a-user.md +++ b/docs/examples/users/create-s-h-a-user.md @@ -1,22 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.createSHAUser( - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - passwordVersion: PasswordHash.sha1, // (optional) - name: '<NAME>', // (optional) +User result = await users.createSHAUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordVersion: PasswordHash.sha1, // (optional) + name: '<NAME>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md index b6ff5304..967fc380 100644 --- a/docs/examples/users/create-scrypt-modified-user.md +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -1,24 +1,18 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.createScryptModifiedUser( - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - passwordSalt: '<PASSWORD_SALT>', - passwordSaltSeparator: '<PASSWORD_SALT_SEPARATOR>', - passwordSignerKey: '<PASSWORD_SIGNER_KEY>', - name: '<NAME>', // (optional) +User result = await users.createScryptModifiedUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordSalt: '<PASSWORD_SALT>', + passwordSaltSeparator: '<PASSWORD_SALT_SEPARATOR>', + passwordSignerKey: '<PASSWORD_SIGNER_KEY>', + name: '<NAME>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index 32fe2162..ba4fce84 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -1,26 +1,20 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.createScryptUser( - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - passwordSalt: '<PASSWORD_SALT>', - passwordCpu: 0, - passwordMemory: 0, - passwordParallel: 0, - passwordLength: 0, - name: '<NAME>', // (optional) +User result = await users.createScryptUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordSalt: '<PASSWORD_SALT>', + passwordCpu: 0, + passwordMemory: 0, + passwordParallel: 0, + passwordLength: 0, + name: '<NAME>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md index 617a79a5..8efc2d95 100644 --- a/docs/examples/users/create-session.md +++ b/docs/examples/users/create-session.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.createSession( - userId: '<USER_ID>', +Session result = await users.createSession( + userId: '<USER_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md index 4478efac..630afbfc 100644 --- a/docs/examples/users/create-target.md +++ b/docs/examples/users/create-target.md @@ -1,23 +1,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.createTarget( - userId: '<USER_ID>', - targetId: '<TARGET_ID>', - providerType: MessagingProviderType.email, - identifier: '<IDENTIFIER>', - providerId: '<PROVIDER_ID>', // (optional) - name: '<NAME>', // (optional) +Target result = await users.createTarget( + userId: '<USER_ID>', + targetId: '<TARGET_ID>', + providerType: MessagingProviderType.email, + identifier: '<IDENTIFIER>', + providerId: '<PROVIDER_ID>', // (optional) + name: '<NAME>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md index db7648e2..51a9892a 100644 --- a/docs/examples/users/create-token.md +++ b/docs/examples/users/create-token.md @@ -1,20 +1,14 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.createToken( - userId: '<USER_ID>', - length: 4, // (optional) - expire: 60, // (optional) +Token result = await users.createToken( + userId: '<USER_ID>', + length: 4, // (optional) + expire: 60, // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index d36dc92b..8faa909e 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -1,22 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.create( - userId: '<USER_ID>', - email: 'email@example.com', // (optional) - phone: '+12065550100', // (optional) - password: '', // (optional) - name: '<NAME>', // (optional) +User result = await users.create( + userId: '<USER_ID>', + email: 'email@example.com', // (optional) + phone: '+12065550100', // (optional) + password: '', // (optional) + name: '<NAME>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/delete-authenticator.md b/docs/examples/users/delete-authenticator.md index 2cd70f5a..62eac589 100644 --- a/docs/examples/users/delete-authenticator.md +++ b/docs/examples/users/delete-authenticator.md @@ -1,20 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.deleteAuthenticator( - userId: '<USER_ID>', - type: AuthenticatorType.totp, - otp: '<OTP>', +await users.deleteAuthenticator( + userId: '<USER_ID>', + type: AuthenticatorType.totp, ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md index b35e1e6d..3ad24e32 100644 --- a/docs/examples/users/delete-identity.md +++ b/docs/examples/users/delete-identity.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.deleteIdentity( - identityId: '<IDENTITY_ID>', +await users.deleteIdentity( + identityId: '<IDENTITY_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md index 7173be72..4cca314f 100644 --- a/docs/examples/users/delete-session.md +++ b/docs/examples/users/delete-session.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.deleteSession( - userId: '<USER_ID>', - sessionId: '<SESSION_ID>', +await users.deleteSession( + userId: '<USER_ID>', + sessionId: '<SESSION_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md index 57bacc38..df0c5f1d 100644 --- a/docs/examples/users/delete-sessions.md +++ b/docs/examples/users/delete-sessions.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.deleteSessions( - userId: '<USER_ID>', +await users.deleteSessions( + userId: '<USER_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md index e1a4427c..34283a1c 100644 --- a/docs/examples/users/delete-target.md +++ b/docs/examples/users/delete-target.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.deleteTarget( - userId: '<USER_ID>', - targetId: '<TARGET_ID>', +await users.deleteTarget( + userId: '<USER_ID>', + targetId: '<TARGET_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md index 8d8b8dbc..6801e13b 100644 --- a/docs/examples/users/delete.md +++ b/docs/examples/users/delete.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.delete( - userId: '<USER_ID>', +await users.delete( + userId: '<USER_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md index 29826d14..54da404a 100644 --- a/docs/examples/users/get-prefs.md +++ b/docs/examples/users/get-prefs.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.getPrefs( - userId: '<USER_ID>', +Preferences result = await users.getPrefs( + userId: '<USER_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md index 0c6d8924..4f1f1b4b 100644 --- a/docs/examples/users/get-target.md +++ b/docs/examples/users/get-target.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.getTarget( - userId: '<USER_ID>', - targetId: '<TARGET_ID>', +Target result = await users.getTarget( + userId: '<USER_ID>', + targetId: '<TARGET_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md index 1326523a..d57f9800 100644 --- a/docs/examples/users/get.md +++ b/docs/examples/users/get.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.get( - userId: '<USER_ID>', +User result = await users.get( + userId: '<USER_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/list-factors.md b/docs/examples/users/list-factors.md index 4a53f77a..7071dce1 100644 --- a/docs/examples/users/list-factors.md +++ b/docs/examples/users/list-factors.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.listFactors( - userId: '<USER_ID>', +MfaFactors result = await users.listFactors( + userId: '<USER_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index 3283741a..d811428a 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.listIdentities( - queries: [], // (optional) - search: '<SEARCH>', // (optional) +IdentityList result = await users.listIdentities( + queries: [], // (optional) + search: '<SEARCH>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index 7df28f84..539710ac 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.listLogs( - userId: '<USER_ID>', - queries: [], // (optional) +LogList result = await users.listLogs( + userId: '<USER_ID>', + queries: [], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index df40f979..bc1bf36b 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.listMemberships( - userId: '<USER_ID>', +MembershipList result = await users.listMemberships( + userId: '<USER_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index 74bb4b01..108fd279 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -1,18 +1,12 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.listSessions( - userId: '<USER_ID>', +SessionList result = await users.listSessions( + userId: '<USER_ID>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md index a02c4468..a4831fef 100644 --- a/docs/examples/users/list-targets.md +++ b/docs/examples/users/list-targets.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.listTargets( - userId: '<USER_ID>', - queries: [], // (optional) +TargetList result = await users.listTargets( + userId: '<USER_ID>', + queries: [], // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 5faf585d..6da9d811 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.list( - queries: [], // (optional) - search: '<SEARCH>', // (optional) +UserList result = await users.list( + queries: [], // (optional) + search: '<SEARCH>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md index e207cce8..8f373b9f 100644 --- a/docs/examples/users/update-email-verification.md +++ b/docs/examples/users/update-email-verification.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.updateEmailVerification( - userId: '<USER_ID>', - emailVerification: false, +User result = await users.updateEmailVerification( + userId: '<USER_ID>', + emailVerification: false, ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md index bf623ec6..5391891c 100644 --- a/docs/examples/users/update-email.md +++ b/docs/examples/users/update-email.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.updateEmail( - userId: '<USER_ID>', - email: 'email@example.com', +User result = await users.updateEmail( + userId: '<USER_ID>', + email: 'email@example.com', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md index 984f4d35..115e0e8e 100644 --- a/docs/examples/users/update-labels.md +++ b/docs/examples/users/update-labels.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.updateLabels( - userId: '<USER_ID>', - labels: [], +User result = await users.updateLabels( + userId: '<USER_ID>', + labels: [], ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md index 73519810..be50cb6f 100644 --- a/docs/examples/users/update-mfa.md +++ b/docs/examples/users/update-mfa.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.updateMfa( - userId: '<USER_ID>', - mfa: false, +User result = await users.updateMfa( + userId: '<USER_ID>', + mfa: false, ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md index 3714671c..bd39acd1 100644 --- a/docs/examples/users/update-name.md +++ b/docs/examples/users/update-name.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.updateName( - userId: '<USER_ID>', - name: '<NAME>', +User result = await users.updateName( + userId: '<USER_ID>', + name: '<NAME>', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index 48a77124..532f4c66 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.updatePassword( - userId: '<USER_ID>', - password: '', +User result = await users.updatePassword( + userId: '<USER_ID>', + password: '', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md index 948750be..f7784743 100644 --- a/docs/examples/users/update-phone-verification.md +++ b/docs/examples/users/update-phone-verification.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.updatePhoneVerification( - userId: '<USER_ID>', - phoneVerification: false, +User result = await users.updatePhoneVerification( + userId: '<USER_ID>', + phoneVerification: false, ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md index ba9c2d85..684cd1dc 100644 --- a/docs/examples/users/update-phone.md +++ b/docs/examples/users/update-phone.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.updatePhone( - userId: '<USER_ID>', - number: '+12065550100', +User result = await users.updatePhone( + userId: '<USER_ID>', + number: '+12065550100', ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md index 98454b79..1ee538f8 100644 --- a/docs/examples/users/update-prefs.md +++ b/docs/examples/users/update-prefs.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.updatePrefs( - userId: '<USER_ID>', - prefs: {}, +Preferences result = await users.updatePrefs( + userId: '<USER_ID>', + prefs: {}, ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md index ac07d08d..82b57cf1 100644 --- a/docs/examples/users/update-status.md +++ b/docs/examples/users/update-status.md @@ -1,19 +1,13 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.updateStatus( - userId: '<USER_ID>', - status: false, +User result = await users.updateStatus( + userId: '<USER_ID>', + status: false, ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md index 8e66a371..07134393 100644 --- a/docs/examples/users/update-target.md +++ b/docs/examples/users/update-target.md @@ -1,22 +1,16 @@ import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key Users users = Users(client); -Future result = users.updateTarget( - userId: '<USER_ID>', - targetId: '<TARGET_ID>', - identifier: '<IDENTIFIER>', // (optional) - providerId: '<PROVIDER_ID>', // (optional) - name: '<NAME>', // (optional) +Target result = await users.updateTarget( + userId: '<USER_ID>', + targetId: '<TARGET_ID>', + identifier: '<IDENTIFIER>', // (optional) + providerId: '<PROVIDER_ID>', // (optional) + name: '<NAME>', // (optional) ); - -result.then((response) { - print(response); -}).catchError((error) { - print(error.response); -}); diff --git a/lib/enums.dart b/lib/enums.dart index 5c06f8a5..9a5b7967 100644 --- a/lib/enums.dart +++ b/lib/enums.dart @@ -13,7 +13,6 @@ part 'src/enums/index_type.dart'; part 'src/enums/runtime.dart'; part 'src/enums/execution_method.dart'; part 'src/enums/name.dart'; -part 'src/enums/message_status.dart'; part 'src/enums/smtp_encryption.dart'; part 'src/enums/compression.dart'; part 'src/enums/image_gravity.dart'; diff --git a/lib/services/account.dart b/lib/services/account.dart index bf51decd..05935bfd 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -186,6 +186,7 @@ class Account extends Service { /// Update MFA /// + /// Enable or disable MFA on an account. Future<models.User> updateMFA({required bool mfa}) async { final String apiPath = '/account/mfa'; @@ -230,6 +231,7 @@ class Account extends Service { /// Create MFA Challenge (confirmation) /// + /// Complete the MFA challenge by providing the one-time password. Future updateChallenge({required String challengeId, required String otp}) async { final String apiPath = '/account/mfa/challenge'; @@ -253,6 +255,7 @@ class Account extends Service { /// List Factors /// + /// List the factors available on the account to be used as a MFA challange. Future<models.MfaFactors> listFactors() async { final String apiPath = '/account/mfa/factors'; @@ -274,6 +277,10 @@ class Account extends Service { /// Add Authenticator /// + /// Add an authenticator app to be used as an MFA factor. Verify the + /// authenticator using the [verify + /// authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator) + /// method. Future<models.MfaType> addAuthenticator({required enums.AuthenticatorType type}) async { final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type.value); @@ -295,6 +302,9 @@ class Account extends Service { /// Verify Authenticator /// + /// Verify an authenticator app after adding it using the [add + /// authenticator](/docs/references/cloud/client-web/account#addAuthenticator) + /// method. Future<models.User> verifyAuthenticator({required enums.AuthenticatorType type, required String otp}) async { final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type.value); @@ -317,6 +327,7 @@ class Account extends Service { /// Delete Authenticator /// + /// Delete an authenticator for a user by ID. Future<models.User> deleteAuthenticator({required enums.AuthenticatorType type, required String otp}) async { final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type.value); @@ -629,7 +640,7 @@ class Account extends Service { } - /// Create session (deprecated) + /// Update magic URL session /// /// Use this endpoint to create a session from token. Provide the **userId** /// and **secret** parameters from the successful response of authentication @@ -655,57 +666,30 @@ class Account extends Service { } - /// Create OAuth2 session + /// Update phone session /// - /// 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 there is already an active session, the new session will be attached to - /// the logged-in account. If there are no active sessions, the server will - /// attempt to look for a user with the same email address as the email - /// received from the OAuth2 provider and attach the new session to the - /// existing user. If no matching user is found - the server will create a new - /// 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 createOAuth2Session({required enums.OAuthProvider provider, String? success, String? failure, List<String>? scopes}) async { - final String apiPath = '/account/sessions/oauth2/{provider}'.replaceAll('{provider}', provider.value); - - final Map<String, dynamic> params = { - 'success': success, -'failure': failure, -'scopes': scopes, + /// 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<models.Session> updatePhoneSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/phone'; + final Map<String, dynamic> apiParams = { - 'project': client.config['project'], + 'userId': userId, +'secret': secret, + }; - final List query = []; + final Map<String, String> apiHeaders = { + 'content-type': 'application/json', - 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('&') - ); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Session.fromMap(res.data); - return client.webAuth(url); } /// Create session @@ -757,7 +741,7 @@ class Account extends Service { } - /// Update (or renew) a session + /// Update (or renew) session /// /// Extend session's expiry to increase it's lifespan. Extending a session is /// useful when session length is short such as 5 minutes. diff --git a/lib/services/databases.dart b/lib/services/databases.dart index ebcd3399..546c92e5 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -255,6 +255,7 @@ class Databases extends Service { /// List attributes /// + /// List attributes in the collection. Future<models.AttributeList> listAttributes({required String databaseId, required String collectionId, List<String>? queries}) async { final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); @@ -304,6 +305,8 @@ class Databases extends Service { /// Update boolean attribute /// + /// Update a boolean attribute. Changing the `default` value will not update + /// already existing documents. Future<models.AttributeBoolean> updateBooleanAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required bool? xdefault}) async { final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); @@ -327,6 +330,7 @@ class Databases extends Service { /// Create datetime attribute /// + /// Create a date time attribute according to the ISO 8601 standard. Future<models.AttributeDatetime> 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); @@ -352,6 +356,8 @@ class Databases extends Service { /// Update dateTime attribute /// + /// Update a date time attribute. Changing the `default` value will not update + /// already existing documents. Future<models.AttributeDatetime> updateDatetimeAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault}) async { final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); @@ -428,6 +434,9 @@ class Databases extends Service { /// Create enum attribute /// + /// Create an enumeration attribute. The `elements` param acts as a white-list + /// of accepted values for this attribute. + /// Future<models.AttributeEnum> createEnumAttribute({required String databaseId, required String collectionId, required String key, required List<String> elements, required bool xrequired, String? xdefault, bool? array}) async { final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); @@ -788,6 +797,7 @@ class Databases extends Service { /// Get attribute /// + /// 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); @@ -809,6 +819,7 @@ class Databases extends Service { /// Delete attribute /// + /// 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); @@ -978,6 +989,7 @@ class Databases extends Service { /// List indexes /// + /// List indexes in the collection. Future<models.IndexList> listIndexes({required String databaseId, required String collectionId, List<String>? queries}) async { final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); @@ -1000,6 +1012,9 @@ class Databases extends Service { /// Create index /// + /// 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<models.Index> createIndex({required String databaseId, required String collectionId, required String key, required enums.IndexType type, required List<String> attributes, List<String>? orders}) async { final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); @@ -1025,6 +1040,7 @@ class Databases extends Service { /// Get index /// + /// Get index by ID. Future<models.Index> 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); @@ -1046,6 +1062,7 @@ class Databases extends Service { /// Delete index /// + /// 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); diff --git a/lib/services/health.dart b/lib/services/health.dart index 59eaac60..4e3f9027 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -286,6 +286,8 @@ class Health extends Service { /// Get functions queue /// + /// Get the number of function executions that are waiting to be processed in + /// the Appwrite internal queue server. Future<models.HealthQueue> getQueueFunctions({int? threshold}) async { final String apiPath = '/health/queue/functions'; diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 41afd142..7067ded5 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -29,10 +29,10 @@ class Messaging extends Service { } - /// Create an email + /// Create email /// /// Create a new email message. - Future<models.Message> createEmail({required String messageId, required String subject, required String content, List<String>? topics, List<String>? users, List<String>? targets, List<String>? cc, List<String>? bcc, List<String>? attachments, enums.MessageStatus? status, bool? html, String? scheduledAt}) async { + Future<models.Message> createEmail({required String messageId, required String subject, required String content, List<String>? topics, List<String>? users, List<String>? targets, List<String>? cc, List<String>? bcc, List<String>? attachments, bool? draft, bool? html, String? scheduledAt}) async { final String apiPath = '/messaging/messages/email'; final Map<String, dynamic> apiParams = { @@ -46,7 +46,7 @@ class Messaging extends Service { 'cc': cc, 'bcc': bcc, 'attachments': attachments, -'status': status, +'draft': draft, 'html': html, 'scheduledAt': scheduledAt, @@ -63,11 +63,11 @@ class Messaging extends Service { } - /// Update an email + /// Update email /// /// Update an email message by its unique ID. /// - Future<models.Message> updateEmail({required String messageId, List<String>? topics, List<String>? users, List<String>? targets, String? subject, String? content, enums.MessageStatus? status, bool? html, List<String>? cc, List<String>? bcc, String? scheduledAt}) async { + Future<models.Message> updateEmail({required String messageId, List<String>? topics, List<String>? users, List<String>? targets, String? subject, String? content, bool? draft, bool? html, List<String>? cc, List<String>? bcc, String? scheduledAt}) async { final String apiPath = '/messaging/messages/email/{messageId}'.replaceAll('{messageId}', messageId); final Map<String, dynamic> apiParams = { @@ -77,7 +77,7 @@ class Messaging extends Service { 'targets': targets, 'subject': subject, 'content': content, -'status': status, +'draft': draft, 'html': html, 'cc': cc, 'bcc': bcc, @@ -96,10 +96,10 @@ class Messaging extends Service { } - /// Create a push notification + /// Create push notification /// /// Create a new push notification. - Future<models.Message> createPush({required String messageId, required String title, required String body, List<String>? topics, List<String>? users, List<String>? targets, Map? data, String? action, String? image, String? icon, String? sound, String? color, String? tag, String? badge, enums.MessageStatus? status, String? scheduledAt}) async { + Future<models.Message> createPush({required String messageId, required String title, required String body, List<String>? topics, List<String>? users, List<String>? targets, Map? data, String? action, String? image, String? icon, String? sound, String? color, String? tag, String? badge, bool? draft, String? scheduledAt}) async { final String apiPath = '/messaging/messages/push'; final Map<String, dynamic> apiParams = { @@ -118,7 +118,7 @@ class Messaging extends Service { 'color': color, 'tag': tag, 'badge': badge, -'status': status, +'draft': draft, 'scheduledAt': scheduledAt, }; @@ -134,11 +134,11 @@ class Messaging extends Service { } - /// Update a push notification + /// Update push notification /// /// Update a push notification by its unique ID. /// - Future<models.Message> updatePush({required String messageId, List<String>? topics, List<String>? users, List<String>? targets, String? title, String? body, Map? data, String? action, String? image, String? icon, String? sound, String? color, String? tag, int? badge, enums.MessageStatus? status, String? scheduledAt}) async { + Future<models.Message> updatePush({required String messageId, List<String>? topics, List<String>? users, List<String>? 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}) async { final String apiPath = '/messaging/messages/push/{messageId}'.replaceAll('{messageId}', messageId); final Map<String, dynamic> apiParams = { @@ -156,7 +156,7 @@ class Messaging extends Service { 'color': color, 'tag': tag, 'badge': badge, -'status': status, +'draft': draft, 'scheduledAt': scheduledAt, }; @@ -172,10 +172,10 @@ class Messaging extends Service { } - /// Create an SMS + /// Create SMS /// /// Create a new SMS message. - Future<models.Message> createSms({required String messageId, required String content, List<String>? topics, List<String>? users, List<String>? targets, enums.MessageStatus? status, String? scheduledAt}) async { + Future<models.Message> createSms({required String messageId, required String content, List<String>? topics, List<String>? users, List<String>? targets, bool? draft, String? scheduledAt}) async { final String apiPath = '/messaging/messages/sms'; final Map<String, dynamic> apiParams = { @@ -185,7 +185,7 @@ class Messaging extends Service { 'topics': topics, 'users': users, 'targets': targets, -'status': status, +'draft': draft, 'scheduledAt': scheduledAt, }; @@ -201,11 +201,11 @@ class Messaging extends Service { } - /// Update an SMS + /// Update SMS /// /// Update an email message by its unique ID. /// - Future<models.Message> updateSms({required String messageId, List<String>? topics, List<String>? users, List<String>? targets, String? content, enums.MessageStatus? status, String? scheduledAt}) async { + Future<models.Message> updateSms({required String messageId, List<String>? topics, List<String>? users, List<String>? targets, String? content, bool? draft, String? scheduledAt}) async { final String apiPath = '/messaging/messages/sms/{messageId}'.replaceAll('{messageId}', messageId); final Map<String, dynamic> apiParams = { @@ -214,7 +214,7 @@ class Messaging extends Service { 'users': users, 'targets': targets, 'content': content, -'status': status, +'draft': draft, 'scheduledAt': scheduledAt, }; @@ -230,7 +230,7 @@ class Messaging extends Service { } - /// Get a message + /// Get message /// /// Get a message by its unique ID. /// @@ -253,8 +253,10 @@ class Messaging extends Service { } - /// Delete a message + /// Delete message /// + /// 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); @@ -574,6 +576,7 @@ class Messaging extends Service { /// Create Sendgrid provider /// + /// Create a new Sendgrid provider. Future<models.Provider> 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'; @@ -1036,7 +1039,7 @@ class Messaging extends Service { } - /// Create a topic + /// Create topic /// /// Create a new topic. Future<models.Topic> createTopic({required String topicId, required String name, List<String>? subscribe}) async { @@ -1061,7 +1064,7 @@ class Messaging extends Service { } - /// Get a topic + /// Get topic /// /// Get a topic by its unique ID. /// @@ -1084,7 +1087,7 @@ class Messaging extends Service { } - /// Update a topic + /// Update topic /// /// Update a topic by its unique ID. /// @@ -1109,7 +1112,7 @@ class Messaging extends Service { } - /// Delete a topic + /// Delete topic /// /// Delete a topic by its unique ID. Future deleteTopic({required String topicId}) async { @@ -1178,7 +1181,7 @@ class Messaging extends Service { } - /// Create a subscriber + /// Create subscriber /// /// Create a new subscriber. Future<models.Subscriber> createSubscriber({required String topicId, required String subscriberId, required String targetId}) async { @@ -1202,7 +1205,7 @@ class Messaging extends Service { } - /// Get a subscriber + /// Get subscriber /// /// Get a subscriber by its unique ID. /// @@ -1225,7 +1228,7 @@ class Messaging extends Service { } - /// Delete a subscriber + /// Delete subscriber /// /// Delete a subscriber by its unique ID. Future deleteSubscriber({required String topicId, required String subscriberId}) async { diff --git a/lib/services/users.dart b/lib/services/users.dart index 5c3a6fa4..0f23dd2e 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -462,6 +462,7 @@ class Users extends Service { /// Update MFA /// + /// Enable or disable MFA on a user account. Future<models.User> updateMfa({required String userId, required bool mfa}) async { final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); @@ -484,6 +485,7 @@ class Users extends Service { /// List Factors /// + /// List the factors available on the account to be used as a MFA challange. Future<models.MfaFactors> listFactors({required String userId}) async { final String apiPath = '/users/{userId}/mfa/factors'.replaceAll('{userId}', userId); @@ -505,13 +507,13 @@ class Users extends Service { /// Delete Authenticator /// - Future<models.User> deleteAuthenticator({required String userId, required enums.AuthenticatorType type, required String otp}) async { + /// Delete an authenticator app. + Future<models.User> deleteAuthenticator({required String userId, required enums.AuthenticatorType type}) async { final String apiPath = '/users/{userId}/mfa/{type}'.replaceAll('{userId}', userId).replaceAll('{type}', type.value); final Map<String, dynamic> apiParams = { - 'otp': otp, - + }; final Map<String, String> apiHeaders = { @@ -760,6 +762,7 @@ class Users extends Service { /// List User Targets /// + /// List the messaging targets that are associated with a user. Future<models.TargetList> listTargets({required String userId, List<String>? queries}) async { final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); @@ -782,6 +785,7 @@ class Users extends Service { /// Create User Target /// + /// Create a messaging target. Future<models.Target> 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); @@ -808,6 +812,7 @@ class Users extends Service { /// Get User Target /// + /// Get a user's push notification target by ID. Future<models.Target> getTarget({required String userId, required String targetId}) async { final String apiPath = '/users/{userId}/targets/{targetId}'.replaceAll('{userId}', userId).replaceAll('{targetId}', targetId); @@ -829,6 +834,7 @@ class Users extends Service { /// Update User target /// + /// Update a messaging target. Future<models.Target> 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); @@ -853,6 +859,7 @@ class Users extends Service { /// Delete user target /// + /// 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); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index 920853d3..d332331e 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -33,7 +33,7 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '11.0.0-rc.5', + 'x-sdk-version': '11.0.0-rc.6', 'X-Appwrite-Response-Format' : '1.5.0', }; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index da8d3037..d677a9ee 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -42,8 +42,8 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '11.0.0-rc.5', - 'user-agent' : 'AppwriteDartSDK/11.0.0-rc.5 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'x-sdk-version': '11.0.0-rc.6', + 'user-agent' : 'AppwriteDartSDK/11.0.0-rc.6 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', 'X-Appwrite-Response-Format' : '1.5.0', }; diff --git a/lib/src/enums/index_type.dart b/lib/src/enums/index_type.dart index 8a9e6436..57449bc0 100644 --- a/lib/src/enums/index_type.dart +++ b/lib/src/enums/index_type.dart @@ -3,8 +3,7 @@ part of dart_appwrite.enums; enum IndexType { key(value: 'key'), fulltext(value: 'fulltext'), - unique(value: 'unique'), - spatial(value: 'spatial'); + unique(value: 'unique'); const IndexType({ required this.value diff --git a/lib/src/enums/message_status.dart b/lib/src/enums/message_status.dart deleted file mode 100644 index 6be52ace..00000000 --- a/lib/src/enums/message_status.dart +++ /dev/null @@ -1,15 +0,0 @@ -part of dart_appwrite.enums; - -enum MessageStatus { - draft(value: 'draft'), - scheduled(value: 'scheduled'), - processing(value: 'processing'); - - const MessageStatus({ - required this.value - }); - - final String value; - - String toJson() => value; -} \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 63915340..aca431a2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: dart_appwrite -version: 11.0.0-rc.5 +version: 11.0.0-rc.6 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 diff --git a/test/services/account_test.dart b/test/services/account_test.dart index db8a17f2..502889fc 100644 --- a/test/services/account_test.dart +++ b/test/services/account_test.dart @@ -744,16 +744,48 @@ void main() { }); - test('test method createOAuth2Session()', () async { + test('test method updatePhoneSession()', () async { + final Map<String, dynamic> data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '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',}; - when(client.webAuth( - Uri(), - )).thenAnswer((_) async => 'done'); + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); - final response = await account.createOAuth2Session( - provider: 'amazon', + + final response = await account.updatePhoneSession( + userId: '<USER_ID>', + secret: '<SECRET>', ); + expect(response, isA<models.Session>()); + }); test('test method createSession()', () async { diff --git a/test/services/messaging_test.dart b/test/services/messaging_test.dart index 2b2bf8cd..31db4acb 100644 --- a/test/services/messaging_test.dart +++ b/test/services/messaging_test.dart @@ -82,7 +82,7 @@ void main() { 'targets': [], 'deliveredTotal': 1, 'data': <String, dynamic>{}, - 'status': 'Message status can be one of the following: processing, sent, cancelled, failed.',}; + 'status': 'Message status can be one of the following: draft, processing, scheduled, sent, or failed.',}; when(client.call( @@ -110,7 +110,7 @@ void main() { 'targets': [], 'deliveredTotal': 1, 'data': <String, dynamic>{}, - 'status': 'Message status can be one of the following: processing, sent, cancelled, failed.',}; + 'status': 'Message status can be one of the following: draft, processing, scheduled, sent, or failed.',}; when(client.call( @@ -136,7 +136,7 @@ void main() { 'targets': [], 'deliveredTotal': 1, 'data': <String, dynamic>{}, - 'status': 'Message status can be one of the following: processing, sent, cancelled, failed.',}; + 'status': 'Message status can be one of the following: draft, processing, scheduled, sent, or failed.',}; when(client.call( @@ -164,7 +164,7 @@ void main() { 'targets': [], 'deliveredTotal': 1, 'data': <String, dynamic>{}, - 'status': 'Message status can be one of the following: processing, sent, cancelled, failed.',}; + 'status': 'Message status can be one of the following: draft, processing, scheduled, sent, or failed.',}; when(client.call( @@ -190,7 +190,7 @@ void main() { 'targets': [], 'deliveredTotal': 1, 'data': <String, dynamic>{}, - 'status': 'Message status can be one of the following: processing, sent, cancelled, failed.',}; + 'status': 'Message status can be one of the following: draft, processing, scheduled, sent, or failed.',}; when(client.call( @@ -217,7 +217,7 @@ void main() { 'targets': [], 'deliveredTotal': 1, 'data': <String, dynamic>{}, - 'status': 'Message status can be one of the following: processing, sent, cancelled, failed.',}; + 'status': 'Message status can be one of the following: draft, processing, scheduled, sent, or failed.',}; when(client.call( @@ -243,7 +243,7 @@ void main() { 'targets': [], 'deliveredTotal': 1, 'data': <String, dynamic>{}, - 'status': 'Message status can be one of the following: processing, sent, cancelled, failed.',}; + 'status': 'Message status can be one of the following: draft, processing, scheduled, sent, or failed.',}; when(client.call( diff --git a/test/services/users_test.dart b/test/services/users_test.dart index fc8e2489..987003cd 100644 --- a/test/services/users_test.dart +++ b/test/services/users_test.dart @@ -619,7 +619,6 @@ void main() { final response = await users.deleteAuthenticator( userId: '<USER_ID>', type: 'totp', - otp: '<OTP>', ); expect(response, isA<models.User>()); diff --git a/test/src/models/message_test.dart b/test/src/models/message_test.dart index 1658f8d3..44125833 100644 --- a/test/src/models/message_test.dart +++ b/test/src/models/message_test.dart @@ -15,7 +15,7 @@ void main() { targets: [], deliveredTotal: 1, data: {}, - status: 'Message status can be one of the following: processing, sent, cancelled, failed.', + status: 'Message status can be one of the following: draft, processing, scheduled, sent, or failed.', ); final map = model.toMap(); @@ -30,7 +30,7 @@ void main() { expect(result.targets, []); expect(result.deliveredTotal, 1); expect(result.data, {}); - expect(result.status, 'Message status can be one of the following: processing, sent, cancelled, failed.'); + expect(result.status, 'Message status can be one of the following: draft, processing, scheduled, sent, or failed.'); }); }); } From ae73f63c9f714608b816d94dcf198bf5a4693182 Mon Sep 17 00:00:00 2001 From: Jake Barnby <jakeb994@gmail.com> Date: Fri, 8 Mar 2024 10:46:55 +0100 Subject: [PATCH 6/7] Appwite 1.5 support --- README.md | 4 +- ...ticator.md => create-mfa-authenticator.md} | 2 +- ...e-challenge.md => create-mfa-challenge.md} | 4 +- .../account/create-mfa-recovery-codes.md | 10 + ...ticator.md => delete-mfa-authenticator.md} | 2 +- .../account/get-mfa-recovery-codes.md | 10 + .../{list-factors.md => list-mfa-factors.md} | 2 +- ...ticator.md => update-mfa-authenticator.md} | 2 +- ...e-challenge.md => update-mfa-challenge.md} | 2 +- .../account/update-mfa-recovery-codes.md | 10 + docs/examples/health/get-queue-usage.md | 12 ++ docs/examples/health/get-storage.md | 10 + .../users/create-mfa-recovery-codes.md | 12 ++ ...ticator.md => delete-mfa-authenticator.md} | 2 +- docs/examples/users/get-mfa-recovery-codes.md | 12 ++ .../{list-factors.md => list-mfa-factors.md} | 2 +- .../users/update-mfa-recovery-codes.md | 12 ++ lib/enums.dart | 2 +- lib/models.dart | 1 + lib/services/account.dart | 150 ++++++++++--- lib/services/health.dart | 70 +++++++ lib/services/users.dart | 89 +++++++- lib/src/client_browser.dart | 2 +- lib/src/client_io.dart | 4 +- lib/src/enums/authentication_factor.dart | 5 +- lib/src/enums/flag.dart | 2 +- lib/src/enums/name.dart | 1 + lib/src/enums/runtime.dart | 8 + lib/src/models/mfa_recovery_codes.dart | 23 ++ lib/src/models/mfa_type.dart | 5 - lib/src/models/session.dart | 5 + lib/src/models/user.dart | 5 - pubspec.yaml | 2 +- test/services/account_test.dart | 197 +++++++++++------- test/services/health_test.dart | 50 +++++ test/services/users_test.dart | 115 ++++++---- test/src/models/mfa_recovery_codes_test.dart | 18 ++ test/src/models/mfa_type_test.dart | 2 - test/src/models/session_test.dart | 2 + test/src/models/user_test.dart | 2 - 40 files changed, 679 insertions(+), 191 deletions(-) rename docs/examples/account/{add-authenticator.md => create-mfa-authenticator.md} (85%) rename docs/examples/account/{create-challenge.md => create-mfa-challenge.md} (71%) create mode 100644 docs/examples/account/create-mfa-recovery-codes.md rename docs/examples/account/{delete-authenticator.md => delete-mfa-authenticator.md} (90%) create mode 100644 docs/examples/account/get-mfa-recovery-codes.md rename docs/examples/account/{list-factors.md => list-mfa-factors.md} (85%) rename docs/examples/account/{verify-authenticator.md => update-mfa-authenticator.md} (87%) rename docs/examples/account/{update-challenge.md => update-mfa-challenge.md} (88%) create mode 100644 docs/examples/account/update-mfa-recovery-codes.md create mode 100644 docs/examples/health/get-queue-usage.md create mode 100644 docs/examples/health/get-storage.md create mode 100644 docs/examples/users/create-mfa-recovery-codes.md rename docs/examples/users/{delete-authenticator.md => delete-mfa-authenticator.md} (91%) create mode 100644 docs/examples/users/get-mfa-recovery-codes.md rename docs/examples/users/{list-factors.md => list-mfa-factors.md} (87%) create mode 100644 docs/examples/users/update-mfa-recovery-codes.md create mode 100644 lib/src/models/mfa_recovery_codes.dart create mode 100644 test/src/models/mfa_recovery_codes_test.dart diff --git a/README.md b/README.md index 558241a2..e21a7a73 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Appwrite is an open-source backend as a service server that abstract and simplif -![Appwrite](https://appwrite.io/images/github.png) +![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png) ## Installation @@ -23,7 +23,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - dart_appwrite: ^11.0.0-rc.6 + dart_appwrite: ^11.0.0 ``` You can install packages from the command line: diff --git a/docs/examples/account/add-authenticator.md b/docs/examples/account/create-mfa-authenticator.md similarity index 85% rename from docs/examples/account/add-authenticator.md rename to docs/examples/account/create-mfa-authenticator.md index da87a6d0..a920b475 100644 --- a/docs/examples/account/add-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.addAuthenticator( +MfaType result = await account.createMfaAuthenticator( type: AuthenticatorType.totp, ); diff --git a/docs/examples/account/create-challenge.md b/docs/examples/account/create-mfa-challenge.md similarity index 71% rename from docs/examples/account/create-challenge.md rename to docs/examples/account/create-mfa-challenge.md index 758915e7..f7e24ff9 100644 --- a/docs/examples/account/create-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.createChallenge( - factor: AuthenticationFactor.totp, +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 new file mode 100644 index 00000000..d44817e5 --- /dev/null +++ b/docs/examples/account/create-mfa-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('5df5acd0d48c2') // 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-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md similarity index 90% rename from docs/examples/account/delete-authenticator.md rename to docs/examples/account/delete-mfa-authenticator.md index 2b7f4111..cbeb5cde 100644 --- a/docs/examples/account/delete-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -7,7 +7,7 @@ Client client = Client() Account account = Account(client); -await account.deleteAuthenticator( +await account.deleteMfaAuthenticator( type: AuthenticatorType.totp, otp: '<OTP>', ); diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 00000000..b378ee7f --- /dev/null +++ b/docs/examples/account/get-mfa-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('5df5acd0d48c2') // 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-factors.md b/docs/examples/account/list-mfa-factors.md similarity index 85% rename from docs/examples/account/list-factors.md rename to docs/examples/account/list-mfa-factors.md index 2f2b0062..1a8a4166 100644 --- a/docs/examples/account/list-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.listFactors(); +MfaFactors result = await account.listMfaFactors(); diff --git a/docs/examples/account/verify-authenticator.md b/docs/examples/account/update-mfa-authenticator.md similarity index 87% rename from docs/examples/account/verify-authenticator.md rename to docs/examples/account/update-mfa-authenticator.md index 839acf00..f7d585ec 100644 --- a/docs/examples/account/verify-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.verifyAuthenticator( +User result = await account.updateMfaAuthenticator( type: AuthenticatorType.totp, otp: '<OTP>', ); diff --git a/docs/examples/account/update-challenge.md b/docs/examples/account/update-mfa-challenge.md similarity index 88% rename from docs/examples/account/update-challenge.md rename to docs/examples/account/update-mfa-challenge.md index 9c322072..024ac9d6 100644 --- a/docs/examples/account/update-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -7,7 +7,7 @@ Client client = Client() Account account = Account(client); - result = await account.updateChallenge( + result = await account.updateMfaChallenge( challengeId: '<CHALLENGE_ID>', otp: '<OTP>', ); diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 00000000..78991437 --- /dev/null +++ b/docs/examples/account/update-mfa-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('5df5acd0d48c2') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +MfaRecoveryCodes result = await account.updateMfaRecoveryCodes(); diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md new file mode 100644 index 00000000..2d08bb75 --- /dev/null +++ b/docs/examples/health/get-queue-usage.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('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + +Health health = Health(client); + +HealthQueue result = await health.getQueueUsage( + threshold: 0, // (optional) +); diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md new file mode 100644 index 00000000..f02b535b --- /dev/null +++ b/docs/examples/health/get-storage.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('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + +Health health = Health(client); + +HealthStatus result = await health.getStorage(); diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md new file mode 100644 index 00000000..15cc9c10 --- /dev/null +++ b/docs/examples/users/create-mfa-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('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + +Users users = Users(client); + +MfaRecoveryCodes result = await users.createMfaRecoveryCodes( + userId: '<USER_ID>', +); diff --git a/docs/examples/users/delete-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md similarity index 91% rename from docs/examples/users/delete-authenticator.md rename to docs/examples/users/delete-mfa-authenticator.md index 62eac589..8c67955d 100644 --- a/docs/examples/users/delete-authenticator.md +++ b/docs/examples/users/delete-mfa-authenticator.md @@ -7,7 +7,7 @@ Client client = Client() Users users = Users(client); -await users.deleteAuthenticator( +await users.deleteMfaAuthenticator( userId: '<USER_ID>', type: AuthenticatorType.totp, ); diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md new file mode 100644 index 00000000..95f5543a --- /dev/null +++ b/docs/examples/users/get-mfa-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('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + +Users users = Users(client); + +MfaRecoveryCodes result = await users.getMfaRecoveryCodes( + userId: '<USER_ID>', +); diff --git a/docs/examples/users/list-factors.md b/docs/examples/users/list-mfa-factors.md similarity index 87% rename from docs/examples/users/list-factors.md rename to docs/examples/users/list-mfa-factors.md index 7071dce1..b70fcc55 100644 --- a/docs/examples/users/list-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.listFactors( +MfaFactors result = await users.listMfaFactors( userId: '<USER_ID>', ); diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md new file mode 100644 index 00000000..15f0f6b6 --- /dev/null +++ b/docs/examples/users/update-mfa-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('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + +Users users = Users(client); + +MfaRecoveryCodes result = await users.updateMfaRecoveryCodes( + userId: '<USER_ID>', +); diff --git a/lib/enums.dart b/lib/enums.dart index 9a5b7967..1e858220 100644 --- a/lib/enums.dart +++ b/lib/enums.dart @@ -1,8 +1,8 @@ /// Appwrite Enums library dart_appwrite.enums; -part 'src/enums/authentication_factor.dart'; part 'src/enums/authenticator_type.dart'; +part 'src/enums/authentication_factor.dart'; part 'src/enums/o_auth_provider.dart'; part 'src/enums/browser.dart'; part 'src/enums/credit_card.dart'; diff --git a/lib/models.dart b/lib/models.dart index 578b4d04..62b5946a 100644 --- a/lib/models.dart +++ b/lib/models.dart @@ -82,6 +82,7 @@ part 'src/models/health_certificate.dart'; part 'src/models/health_time.dart'; part 'src/models/headers.dart'; part 'src/models/mfa_challenge.dart'; +part 'src/models/mfa_recovery_codes.dart'; part 'src/models/mfa_type.dart'; part 'src/models/mfa_factors.dart'; part 'src/models/provider.dart'; diff --git a/lib/services/account.dart b/lib/services/account.dart index 05935bfd..3d4c5822 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -207,9 +207,85 @@ class Account extends Service { } + /// Add Authenticator + /// + /// Add an authenticator app to be used as an MFA factor. Verify the + /// authenticator using the [verify + /// authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator) + /// method. + Future<models.MfaType> createMfaAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); + + final Map<String, dynamic> apiParams = { + + + }; + + final Map<String, String> 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 Authenticator + /// + /// Verify an authenticator app after adding it using the [add + /// authenticator](/docs/references/cloud/client-web/account#addAuthenticator) + /// method. + Future<models.User> updateMfaAuthenticator({required enums.AuthenticatorType type, required String otp}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); + + final Map<String, dynamic> apiParams = { + + 'otp': otp, + + }; + + final Map<String, String> 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 Authenticator + /// + /// Delete an authenticator for a user by ID. + Future<models.User> deleteMfaAuthenticator({required enums.AuthenticatorType type, required String otp}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); + + final Map<String, dynamic> apiParams = { + + 'otp': otp, + + }; + + final Map<String, String> apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.User.fromMap(res.data); + + } + /// Create 2FA Challenge /// - Future<models.MfaChallenge> createChallenge({required enums.AuthenticationFactor factor}) async { + /// Begin the process of MFA verification after sign-in. Finish the flow with + /// [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) + /// method. + Future<models.MfaChallenge> createMfaChallenge({required enums.AuthenticationFactor factor}) async { final String apiPath = '/account/mfa/challenge'; final Map<String, dynamic> apiParams = { @@ -231,8 +307,12 @@ class Account extends Service { /// Create MFA Challenge (confirmation) /// - /// Complete the MFA challenge by providing the one-time password. - Future updateChallenge({required String challengeId, required String otp}) async { + /// 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<String, dynamic> apiParams = { @@ -256,7 +336,7 @@ class Account extends Service { /// List Factors /// /// List the factors available on the account to be used as a MFA challange. - Future<models.MfaFactors> listFactors() async { + Future<models.MfaFactors> listMfaFactors() async { final String apiPath = '/account/mfa/factors'; final Map<String, dynamic> apiParams = { @@ -275,14 +355,14 @@ class Account extends Service { } - /// Add Authenticator + /// Get MFA Recovery Codes /// - /// Add an authenticator app to be used as an MFA factor. Verify the - /// authenticator using the [verify - /// authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator) - /// method. - Future<models.MfaType> addAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type.value); + /// 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<models.MfaRecoveryCodes> getMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; final Map<String, dynamic> apiParams = { @@ -294,24 +374,25 @@ class Account extends Service { }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - return models.MfaType.fromMap(res.data); + return models.MfaRecoveryCodes.fromMap(res.data); } - /// Verify Authenticator + /// Create MFA Recovery Codes /// - /// Verify an authenticator app after adding it using the [add - /// authenticator](/docs/references/cloud/client-web/account#addAuthenticator) + /// 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<models.User> verifyAuthenticator({required enums.AuthenticatorType type, required String otp}) async { - final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type.value); + Future<models.MfaRecoveryCodes> createMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; final Map<String, dynamic> apiParams = { - 'otp': otp, - + }; final Map<String, String> apiHeaders = { @@ -319,22 +400,24 @@ class Account extends Service { }; - final res = await client.call(HttpMethod.put, 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); + return models.MfaRecoveryCodes.fromMap(res.data); } - /// Delete Authenticator + /// Regenerate MFA Recovery Codes /// - /// Delete an authenticator for a user by ID. - Future<models.User> deleteAuthenticator({required enums.AuthenticatorType type, required String otp}) async { - final String apiPath = '/account/mfa/{type}'.replaceAll('{type}', type.value); + /// 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<models.MfaRecoveryCodes> updateMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; final Map<String, dynamic> apiParams = { - 'otp': otp, - + }; final Map<String, String> apiHeaders = { @@ -342,9 +425,9 @@ class Account extends Service { }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - return models.User.fromMap(res.data); + return models.MfaRecoveryCodes.fromMap(res.data); } @@ -741,10 +824,11 @@ class Account extends Service { } - /// Update (or renew) session + /// Update session /// - /// Extend session's expiry to increase it's lifespan. Extending a session is - /// useful when session length is short such as 5 minutes. + /// 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<models.Session> updateSession({required String sessionId}) async { final String apiPath = '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); diff --git a/lib/services/health.dart b/lib/services/health.dart index 4e3f9027..f9e1e8ed 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -404,6 +404,54 @@ class Health extends Service { } + /// Get usage queue + /// + /// Get the number of metrics that are waiting to be processed in the Appwrite + /// internal queue server. + Future<models.HealthQueue> getQueueUsage({int? threshold}) async { + final String apiPath = '/health/queue/usage'; + + final Map<String, dynamic> apiParams = { + 'threshold': threshold, + + + }; + + final Map<String, String> apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.HealthQueue.fromMap(res.data); + + } + + /// Get usage dump queue + /// + /// Get the number of projects containing metrics that are waiting to be + /// processed in the Appwrite internal queue server. + Future<models.HealthQueue> getQueueUsage({int? threshold}) async { + final String apiPath = '/health/queue/usage-dump'; + + final Map<String, dynamic> apiParams = { + 'threshold': threshold, + + + }; + + final Map<String, String> apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.HealthQueue.fromMap(res.data); + + } + /// Get webhooks queue /// /// Get the number of webhooks that are waiting to be processed in the Appwrite @@ -428,6 +476,28 @@ class Health extends Service { } + /// Get storage + /// + /// Check the Appwrite storage device is up and connection is successful. + Future<models.HealthStatus> getStorage() async { + final String apiPath = '/health/storage'; + + final Map<String, dynamic> apiParams = { + + + }; + + final Map<String, String> apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.HealthStatus.fromMap(res.data); + + } + /// Get local storage /// /// Check the Appwrite local storage device is up and connection is successful. diff --git a/lib/services/users.dart b/lib/services/users.dart index 0f23dd2e..566fd452 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -483,10 +483,32 @@ class Users extends Service { } + /// Delete Authenticator + /// + /// Delete an authenticator app. + Future<models.User> 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<String, dynamic> apiParams = { + + + }; + + final Map<String, String> apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.User.fromMap(res.data); + + } + /// List Factors /// /// List the factors available on the account to be used as a MFA challange. - Future<models.MfaFactors> listFactors({required String userId}) async { + Future<models.MfaFactors> listMfaFactors({required String userId}) async { final String apiPath = '/users/{userId}/mfa/factors'.replaceAll('{userId}', userId); final Map<String, dynamic> apiParams = { @@ -505,11 +527,14 @@ class Users extends Service { } - /// Delete Authenticator + /// Get MFA Recovery Codes /// - /// Delete an authenticator app. - Future<models.User> deleteAuthenticator({required String userId, required enums.AuthenticatorType type}) async { - final String apiPath = '/users/{userId}/mfa/{type}'.replaceAll('{userId}', userId).replaceAll('{type}', type.value); + /// 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<models.MfaRecoveryCodes> getMfaRecoveryCodes({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); final Map<String, dynamic> apiParams = { @@ -521,9 +546,59 @@ class Users extends Service { }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - return models.User.fromMap(res.data); + return models.MfaRecoveryCodes.fromMap(res.data); + + } + + /// Regenerate MFA Recovery Codes + /// + /// 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<models.MfaRecoveryCodes> updateMfaRecoveryCodes({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + + final Map<String, dynamic> apiParams = { + + + }; + + final Map<String, String> apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.MfaRecoveryCodes.fromMap(res.data); + + } + + /// Create MFA Recovery Codes + /// + /// 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<models.MfaRecoveryCodes> createMfaRecoveryCodes({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + + final Map<String, dynamic> apiParams = { + + + }; + + final Map<String, String> apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.MfaRecoveryCodes.fromMap(res.data); } diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index d332331e..01c73847 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -33,7 +33,7 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '11.0.0-rc.6', + 'x-sdk-version': '11.0.0', 'X-Appwrite-Response-Format' : '1.5.0', }; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index d677a9ee..5d37ce37 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -42,8 +42,8 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '11.0.0-rc.6', - 'user-agent' : 'AppwriteDartSDK/11.0.0-rc.6 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'x-sdk-version': '11.0.0', + 'user-agent' : 'AppwriteDartSDK/11.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', 'X-Appwrite-Response-Format' : '1.5.0', }; diff --git a/lib/src/enums/authentication_factor.dart b/lib/src/enums/authentication_factor.dart index efc9b7af..53a69d02 100644 --- a/lib/src/enums/authentication_factor.dart +++ b/lib/src/enums/authentication_factor.dart @@ -1,9 +1,10 @@ part of dart_appwrite.enums; enum AuthenticationFactor { - totp(value: 'totp'), + email(value: 'email'), phone(value: 'phone'), - email(value: 'email'); + totp(value: 'totp'), + recoverycode(value: 'recoverycode'); const AuthenticationFactor({ required this.value diff --git a/lib/src/enums/flag.dart b/lib/src/enums/flag.dart index d32ac9d5..a121f44d 100644 --- a/lib/src/enums/flag.dart +++ b/lib/src/enums/flag.dart @@ -34,7 +34,7 @@ enum Flag { switzerland(value: 'ch'), chile(value: 'cl'), china(value: 'cn'), - cTeDIvoire(value: 'ci'), + coteDIvoire(value: 'ci'), cameroon(value: 'cm'), democraticRepublicOfTheCongo(value: 'cd'), republicOfTheCongo(value: 'cg'), diff --git a/lib/src/enums/name.dart b/lib/src/enums/name.dart index 637b837e..6b990e43 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -7,6 +7,7 @@ enum Name { v1Mails(value: 'v1-mails'), v1Functions(value: 'v1-functions'), v1Usage(value: 'v1-usage'), + v1UsageDump(value: 'v1-usage-dump'), webhooksv1(value: 'webhooksv1'), v1Certificates(value: 'v1-certificates'), v1Builds(value: 'v1-builds'), diff --git a/lib/src/enums/runtime.dart b/lib/src/enums/runtime.dart index 45c09443..d1388fb2 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -6,23 +6,28 @@ enum Runtime { node180(value: 'node-18.0'), node190(value: 'node-19.0'), node200(value: 'node-20.0'), + node210(value: 'node-21.0'), 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'), + deno140(value: 'deno-1.40'), dart215(value: 'dart-2.15'), dart216(value: 'dart-2.16'), dart217(value: 'dart-2.17'), dart218(value: 'dart-2.18'), dart30(value: 'dart-3.0'), dart31(value: 'dart-3.1'), + dart33(value: 'dart-3.3'), dotnet31(value: 'dotnet-3.1'), dotnet60(value: 'dotnet-6.0'), dotnet70(value: 'dotnet-7.0'), @@ -30,10 +35,13 @@ enum Runtime { java110(value: 'java-11.0'), java170(value: 'java-17.0'), java180(value: 'java-18.0'), + java210(value: 'java-21.0'), swift55(value: 'swift-5.5'), swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), kotlin16(value: 'kotlin-1.6'), kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), cpp17(value: 'cpp-17'), cpp20(value: 'cpp-20'), bun10(value: 'bun-1.0'); diff --git a/lib/src/models/mfa_recovery_codes.dart b/lib/src/models/mfa_recovery_codes.dart new file mode 100644 index 00000000..d4364ea6 --- /dev/null +++ b/lib/src/models/mfa_recovery_codes.dart @@ -0,0 +1,23 @@ +part of dart_appwrite.models; + +/// MFA Recovery Codes +class MfaRecoveryCodes implements Model { + /// Recovery codes. + final List recoveryCodes; + + MfaRecoveryCodes({ + required this.recoveryCodes, + }); + + factory MfaRecoveryCodes.fromMap(Map<String, dynamic> map) { + return MfaRecoveryCodes( + recoveryCodes: map['recoveryCodes'] ?? [], + ); + } + + Map<String, dynamic> toMap() { + return { + "recoveryCodes": recoveryCodes, + }; + } +} diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index 1f84b90f..887ae0e4 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,22 +2,18 @@ part of dart_appwrite.models; /// MFAType class MfaType implements Model { - /// Backup codes. - final List backups; /// Secret token used for TOTP factor. final String secret; /// URI for authenticator apps. final String uri; MfaType({ - required this.backups, required this.secret, required this.uri, }); factory MfaType.fromMap(Map<String, dynamic> map) { return MfaType( - backups: map['backups'] ?? [], secret: map['secret'].toString(), uri: map['uri'].toString(), ); @@ -25,7 +21,6 @@ class MfaType implements Model { Map<String, dynamic> toMap() { return { - "backups": backups, "secret": secret, "uri": uri, }; diff --git a/lib/src/models/session.dart b/lib/src/models/session.dart index dfbe02d6..1349c445 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -56,6 +56,8 @@ class Session implements Model { 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, @@ -85,6 +87,7 @@ class Session implements Model { required this.current, required this.factors, required this.secret, + required this.mfaUpdatedAt, }); factory Session.fromMap(Map<String, dynamic> map) { @@ -116,6 +119,7 @@ class Session implements Model { current: map['current'], factors: map['factors'] ?? [], secret: map['secret'].toString(), + mfaUpdatedAt: map['mfaUpdatedAt'].toString(), ); } @@ -148,6 +152,7 @@ class Session implements Model { "current": current, "factors": factors, "secret": secret, + "mfaUpdatedAt": mfaUpdatedAt, }; } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index e30b9e90..6ad01e43 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -34,8 +34,6 @@ class User implements Model { final bool phoneVerification; /// Multi factor authentication status. final bool mfa; - /// TOTP status. - final bool totp; /// 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. @@ -60,7 +58,6 @@ class User implements Model { required this.emailVerification, required this.phoneVerification, required this.mfa, - required this.totp, required this.prefs, required this.targets, required this.accessedAt, @@ -84,7 +81,6 @@ class User implements Model { emailVerification: map['emailVerification'], phoneVerification: map['phoneVerification'], mfa: map['mfa'], - totp: map['totp'], prefs: Preferences.fromMap(map['prefs']), targets: List<Target>.from(map['targets'].map((p) => Target.fromMap(p))), accessedAt: map['accessedAt'].toString(), @@ -109,7 +105,6 @@ class User implements Model { "emailVerification": emailVerification, "phoneVerification": phoneVerification, "mfa": mfa, - "totp": totp, "prefs": prefs.toMap(), "targets": targets.map((p) => p.toMap()).toList(), "accessedAt": accessedAt, diff --git a/pubspec.yaml b/pubspec.yaml index aca431a2..24a7ef3a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: dart_appwrite -version: 11.0.0-rc.6 +version: 11.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 diff --git a/test/services/account_test.dart b/test/services/account_test.dart index 502889fc..a999398e 100644 --- a/test/services/account_test.dart +++ b/test/services/account_test.dart @@ -69,7 +69,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -101,7 +100,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -136,7 +134,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -233,7 +230,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -251,61 +247,8 @@ void main() { }); - test('test method createChallenge()', () async { + test('test method createMfaAuthenticator()', () async { final Map<String, dynamic> 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.createChallenge( - factor: 'totp', - ); - expect(response, isA<models.MfaChallenge>()); - - }); - - test('test method updateChallenge()', () async { - final data = ''; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.updateChallenge( - challengeId: '<CHALLENGE_ID>', - otp: '<OTP>', - ); - }); - - test('test method listFactors()', () async { - final Map<String, dynamic> data = { - 'totp': true, - 'phone': true, - 'email': true,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.listFactors( - ); - expect(response, isA<models.MfaFactors>()); - - }); - - test('test method addAuthenticator()', () async { - final Map<String, dynamic> data = { - 'backups': [], 'secret': '1', 'uri': '1',}; @@ -315,14 +258,14 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await account.addAuthenticator( + final response = await account.createMfaAuthenticator( type: 'totp', ); expect(response, isA<models.MfaType>()); }); - test('test method verifyAuthenticator()', () async { + test('test method updateMfaAuthenticator()', () async { final Map<String, dynamic> data = { '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', @@ -337,7 +280,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -348,7 +290,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await account.verifyAuthenticator( + final response = await account.updateMfaAuthenticator( type: 'totp', otp: '<OTP>', ); @@ -356,7 +298,7 @@ void main() { }); - test('test method deleteAuthenticator()', () async { + test('test method deleteMfaAuthenticator()', () async { final Map<String, dynamic> data = { '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', @@ -371,7 +313,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -382,7 +323,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await account.deleteAuthenticator( + final response = await account.deleteMfaAuthenticator( type: 'totp', otp: '<OTP>', ); @@ -390,6 +331,106 @@ void main() { }); + test('test method createMfaChallenge()', () async { + final Map<String, dynamic> 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: 'email', + ); + expect(response, isA<models.MfaChallenge>()); + + }); + + test('test method updateMfaChallenge()', () async { + final data = ''; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updateMfaChallenge( + challengeId: '<CHALLENGE_ID>', + otp: '<OTP>', + ); + }); + + test('test method listMfaFactors()', () async { + final Map<String, dynamic> data = { + 'totp': true, + 'phone': true, + 'email': true,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.listMfaFactors( + ); + expect(response, isA<models.MfaFactors>()); + + }); + + test('test method getMfaRecoveryCodes()', () async { + final Map<String, dynamic> data = { + 'recoveryCodes': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.getMfaRecoveryCodes( + ); + expect(response, isA<models.MfaRecoveryCodes>()); + + }); + + test('test method createMfaRecoveryCodes()', () async { + final Map<String, dynamic> data = { + 'recoveryCodes': [],}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createMfaRecoveryCodes( + ); + expect(response, isA<models.MfaRecoveryCodes>()); + + }); + + test('test method updateMfaRecoveryCodes()', () async { + final Map<String, dynamic> data = { + 'recoveryCodes': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updateMfaRecoveryCodes( + ); + expect(response, isA<models.MfaRecoveryCodes>()); + + }); + test('test method updateName()', () async { final Map<String, dynamic> data = { '\$id': '5e5ea5c16897e', @@ -405,7 +446,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -438,7 +478,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -471,7 +510,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -520,7 +558,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -642,7 +679,8 @@ void main() { 'countryName': 'United States', 'current': true, 'factors': [], - 'secret': '5e5bb8c16897e',}; + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; when(client.call( @@ -684,7 +722,8 @@ void main() { 'countryName': 'United States', 'current': true, 'factors': [], - 'secret': '5e5bb8c16897e',}; + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; when(client.call( @@ -728,7 +767,8 @@ void main() { 'countryName': 'United States', 'current': true, 'factors': [], - 'secret': '5e5bb8c16897e',}; + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; when(client.call( @@ -772,7 +812,8 @@ void main() { 'countryName': 'United States', 'current': true, 'factors': [], - 'secret': '5e5bb8c16897e',}; + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; when(client.call( @@ -816,7 +857,8 @@ void main() { 'countryName': 'United States', 'current': true, 'factors': [], - 'secret': '5e5bb8c16897e',}; + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; when(client.call( @@ -860,7 +902,8 @@ void main() { 'countryName': 'United States', 'current': true, 'factors': [], - 'secret': '5e5bb8c16897e',}; + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; when(client.call( @@ -903,7 +946,8 @@ void main() { 'countryName': 'United States', 'current': true, 'factors': [], - 'secret': '5e5bb8c16897e',}; + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; when(client.call( @@ -946,7 +990,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; diff --git a/test/services/health_test.dart b/test/services/health_test.dart index f6503a1b..02df813f 100644 --- a/test/services/health_test.dart +++ b/test/services/health_test.dart @@ -343,6 +343,38 @@ void main() { }); + test('test method getQueueUsage()', () async { + final Map<String, dynamic> data = { + 'size': 8,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getQueueUsage( + ); + expect(response, isA<models.HealthQueue>()); + + }); + + test('test method getQueueUsage()', () async { + final Map<String, dynamic> data = { + 'size': 8,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getQueueUsage( + ); + expect(response, isA<models.HealthQueue>()); + + }); + test('test method getQueueWebhooks()', () async { final Map<String, dynamic> data = { 'size': 8,}; @@ -359,6 +391,24 @@ void main() { }); + test('test method getStorage()', () async { + final Map<String, dynamic> data = { + 'name': 'database', + 'ping': 128, + 'status': 'pass',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getStorage( + ); + expect(response, isA<models.HealthStatus>()); + + }); + test('test method getStorageLocal()', () async { final Map<String, dynamic> data = { 'name': 'database', diff --git a/test/services/users_test.dart b/test/services/users_test.dart index 987003cd..e034d087 100644 --- a/test/services/users_test.dart +++ b/test/services/users_test.dart @@ -86,7 +86,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -119,7 +118,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -154,7 +152,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -219,7 +216,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -254,7 +250,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -289,7 +284,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -329,7 +323,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -367,7 +360,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -402,7 +394,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -448,7 +439,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -482,7 +472,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -552,7 +541,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -571,26 +559,7 @@ void main() { }); - test('test method listFactors()', () async { - final Map<String, dynamic> data = { - 'totp': true, - 'phone': true, - 'email': true,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.listFactors( - userId: '<USER_ID>', - ); - expect(response, isA<models.MfaFactors>()); - - }); - - test('test method deleteAuthenticator()', () async { + test('test method deleteMfaAuthenticator()', () async { final Map<String, dynamic> data = { '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', @@ -605,7 +574,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -616,7 +584,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await users.deleteAuthenticator( + final response = await users.deleteMfaAuthenticator( userId: '<USER_ID>', type: 'totp', ); @@ -624,6 +592,76 @@ void main() { }); + test('test method listMfaFactors()', () async { + final Map<String, dynamic> data = { + 'totp': true, + 'phone': true, + 'email': true,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.listMfaFactors( + userId: '<USER_ID>', + ); + expect(response, isA<models.MfaFactors>()); + + }); + + test('test method getMfaRecoveryCodes()', () async { + final Map<String, dynamic> data = { + 'recoveryCodes': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.getMfaRecoveryCodes( + userId: '<USER_ID>', + ); + expect(response, isA<models.MfaRecoveryCodes>()); + + }); + + test('test method updateMfaRecoveryCodes()', () async { + final Map<String, dynamic> data = { + 'recoveryCodes': [],}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.updateMfaRecoveryCodes( + userId: '<USER_ID>', + ); + expect(response, isA<models.MfaRecoveryCodes>()); + + }); + + test('test method createMfaRecoveryCodes()', () async { + final Map<String, dynamic> data = { + 'recoveryCodes': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.createMfaRecoveryCodes( + userId: '<USER_ID>', + ); + expect(response, isA<models.MfaRecoveryCodes>()); + + }); + test('test method updateName()', () async { final Map<String, dynamic> data = { '\$id': '5e5ea5c16897e', @@ -639,7 +677,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -673,7 +710,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -707,7 +743,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -805,7 +840,8 @@ void main() { 'countryName': 'United States', 'current': true, 'factors': [], - 'secret': '5e5bb8c16897e',}; + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; when(client.call( @@ -862,7 +898,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -1024,7 +1059,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; @@ -1058,7 +1092,6 @@ void main() { 'emailVerification': true, 'phoneVerification': true, 'mfa': true, - 'totp': true, 'prefs': <String, dynamic>{}, 'targets': [], 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; diff --git a/test/src/models/mfa_recovery_codes_test.dart b/test/src/models/mfa_recovery_codes_test.dart new file mode 100644 index 00000000..56555ca6 --- /dev/null +++ b/test/src/models/mfa_recovery_codes_test.dart @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('MfaRecoveryCodes', () { + + test('model', () { + final model = MfaRecoveryCodes( + recoveryCodes: [], + ); + + final map = model.toMap(); + final result = MfaRecoveryCodes.fromMap(map); + + expect(result.recoveryCodes, []); + }); + }); +} diff --git a/test/src/models/mfa_type_test.dart b/test/src/models/mfa_type_test.dart index 1e3e7488..cbb9e4ee 100644 --- a/test/src/models/mfa_type_test.dart +++ b/test/src/models/mfa_type_test.dart @@ -6,7 +6,6 @@ void main() { test('model', () { final model = MfaType( - backups: [], secret: '1', uri: '1', ); @@ -14,7 +13,6 @@ void main() { final map = model.toMap(); final result = MfaType.fromMap(map); - expect(result.backups, []); expect(result.secret, '1'); expect(result.uri, '1'); }); diff --git a/test/src/models/session_test.dart b/test/src/models/session_test.dart index 7f5126bf..8f4df83c 100644 --- a/test/src/models/session_test.dart +++ b/test/src/models/session_test.dart @@ -33,6 +33,7 @@ void main() { current: true, factors: [], secret: '5e5bb8c16897e', + mfaUpdatedAt: '2020-10-15T06:38:00.000+00:00', ); final map = model.toMap(); @@ -65,6 +66,7 @@ void main() { 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/user_test.dart b/test/src/models/user_test.dart index f2a68f40..1f411e3d 100644 --- a/test/src/models/user_test.dart +++ b/test/src/models/user_test.dart @@ -19,7 +19,6 @@ void main() { emailVerification: true, phoneVerification: true, mfa: true, - totp: true, prefs: Preferences(data: {}), targets: [], accessedAt: '2020-10-15T06:38:00.000+00:00', @@ -41,7 +40,6 @@ void main() { expect(result.emailVerification, true); expect(result.phoneVerification, true); expect(result.mfa, true); - expect(result.totp, true); expect(result.prefs.data, {"data": {}}); expect(result.targets, []); expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); From 0c07cab47049f03c51eca38e3d326c805fef455c Mon Sep 17 00:00:00 2001 From: Jake Barnby <jakeb994@gmail.com> Date: Fri, 8 Mar 2024 15:10:56 +0100 Subject: [PATCH 7/7] Appwrite 1.5 support --- CHANGELOG.md | 8 ++++++++ docs/examples/health/get-queue-usage-dump.md | 12 ++++++++++++ lib/services/health.dart | 2 +- test/services/health_test.dart | 4 ++-- 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 docs/examples/health/get-queue-usage-dump.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c4d97e1..adc136a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 11.0.0 + +* Added enum support +* Added SSR support +* Added messaging service support +* Added contains query support +* Added or query support + ## 10.1.0 * Add new queue health endpoints diff --git a/docs/examples/health/get-queue-usage-dump.md b/docs/examples/health/get-queue-usage-dump.md new file mode 100644 index 00000000..7b8d61ef --- /dev/null +++ b/docs/examples/health/get-queue-usage-dump.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('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + +Health health = Health(client); + +HealthQueue result = await health.getQueueUsageDump( + threshold: 0, // (optional) +); diff --git a/lib/services/health.dart b/lib/services/health.dart index f9e1e8ed..35bdc68a 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -432,7 +432,7 @@ class Health extends Service { /// /// Get the number of projects containing metrics that are waiting to be /// processed in the Appwrite internal queue server. - Future<models.HealthQueue> getQueueUsage({int? threshold}) async { + Future<models.HealthQueue> getQueueUsageDump({int? threshold}) async { final String apiPath = '/health/queue/usage-dump'; final Map<String, dynamic> apiParams = { diff --git a/test/services/health_test.dart b/test/services/health_test.dart index 02df813f..ecbc178a 100644 --- a/test/services/health_test.dart +++ b/test/services/health_test.dart @@ -359,7 +359,7 @@ void main() { }); - test('test method getQueueUsage()', () async { + test('test method getQueueUsageDump()', () async { final Map<String, dynamic> data = { 'size': 8,}; @@ -369,7 +369,7 @@ void main() { )).thenAnswer((_) async => Response(data: data)); - final response = await health.getQueueUsage( + final response = await health.getQueueUsageDump( ); expect(response, isA<models.HealthQueue>());