From 319aae7d3f23f872f0a1df131edf13d2e960643c Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 21 Feb 2024 23:35:33 +1300 Subject: [PATCH] Release candidate 4 for 1.5.x --- README.md | 4 +- docs/examples/account/add-authenticator.md | 31 ++++----- .../account/create-anonymous-session.md | 27 ++++---- .../account/create-email-password-session.md | 33 +++++----- docs/examples/account/create-email-token.md | 34 +++++----- docs/examples/account/create-j-w-t.md | 27 ++++---- .../account/create-magic-u-r-l-token.md | 35 +++++----- .../examples/account/create-o-auth2session.md | 35 +++++----- docs/examples/account/create-phone-token.md | 33 +++++----- .../account/create-phone-verification.md | 27 ++++---- docs/examples/account/create-push-target.md | 34 +++++----- docs/examples/account/create-recovery.md | 33 +++++----- docs/examples/account/create-session.md | 33 +++++----- docs/examples/account/create-verification.md | 31 ++++----- docs/examples/account/create.md | 36 +++++----- docs/examples/account/create2f-a-challenge.md | 31 ++++----- docs/examples/account/delete-authenticator.md | 33 +++++----- docs/examples/account/delete-identity.md | 31 ++++----- docs/examples/account/delete-push-target.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 | 33 +++++----- 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-push-target.md | 33 +++++----- 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 | 45 +++++++------ docs/examples/avatars/get-credit-card.md | 45 +++++++------ docs/examples/avatars/get-favicon.md | 39 +++++------ docs/examples/avatars/get-flag.md | 45 +++++++------ docs/examples/avatars/get-image.md | 43 ++++++------ docs/examples/avatars/get-initials.md | 43 ++++++------ docs/examples/avatars/get-q-r.md | 45 +++++++------ docs/examples/databases/create-document.md | 38 +++++------ docs/examples/databases/delete-document.md | 35 +++++----- docs/examples/databases/get-document.md | 36 +++++----- docs/examples/databases/list-documents.md | 34 +++++----- docs/examples/databases/update-document.md | 37 +++++------ docs/examples/functions/create-execution.md | 36 +++++----- docs/examples/functions/get-execution.md | 33 +++++----- docs/examples/functions/list-executions.md | 33 +++++----- docs/examples/graphql/mutation.md | 31 ++++----- docs/examples/graphql/query.md | 31 ++++----- 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 ++++---- docs/examples/messaging/create-subscriber.md | 35 +++++----- docs/examples/messaging/delete-subscriber.md | 33 +++++----- docs/examples/storage/create-file.md | 36 +++++----- docs/examples/storage/delete-file.md | 33 +++++----- docs/examples/storage/get-file-download.md | 43 ++++++------ docs/examples/storage/get-file-preview.md | 65 ++++++++++++------- docs/examples/storage/get-file-view.md | 43 ++++++------ docs/examples/storage/get-file.md | 33 +++++----- docs/examples/storage/list-files.md | 33 +++++----- 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 +++++----- lib/appwrite.dart | 2 +- lib/services/account.dart | 8 +-- lib/services/avatars.dart | 6 +- lib/services/messaging.dart | 6 +- lib/src/client_browser.dart | 2 +- lib/src/client_io.dart | 2 +- pubspec.yaml | 2 +- 98 files changed, 1431 insertions(+), 1602 deletions(-) diff --git a/README.md b/README.md index 39d13409..c8bfbe38 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![pub package](https://img.shields.io/pub/v/appwrite?style=flat-square)](https://pub.dartlang.org/packages/appwrite) ![License](https://img.shields.io/github/license/appwrite/sdk-for-flutter.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) @@ -21,7 +21,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - appwrite: ^12.0.0-rc.3 + appwrite: ^12.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 1755a72b..7bcd919f 100644 --- a/docs/examples/account/add-authenticator.md +++ b/docs/examples/account/add-authenticator.md @@ -1,21 +1,18 @@ import 'package:appwrite/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 - ; - Future result = account.addAuthenticator( - type: AuthenticatorType.totp.value, - ); +Account account = Account(client); + +Future result = account.addAuthenticator( + type: AuthenticatorType.totp, +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 2f3e7a60..c4f5ea3e 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - ; - Future result = account.createAnonymousSession(); +Account account = Account(client); + +Future result = account.createAnonymousSession(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 fae7af8a..4883321f 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - ; - Future result = account.createEmailPasswordSession( - email:'email@example.com' , - password:'password' , - ); +Account account = Account(client); + +Future result = account.createEmailPasswordSession( + email: 'email@example.com', + password: 'password', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 fdaf5e27..ec5c9b64 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -1,22 +1,20 @@ import 'package:appwrite/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 - ; - Future result = account.createEmailToken( - userId:'[USER_ID]' , - email:'email@example.com' , - ); +Account account = Account(client); + +Future result = account.createEmailToken( + userId: '[USER_ID]', + email: 'email@example.com', + phrase: false, // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 c4a61f7c..ed15dfab 100644 --- a/docs/examples/account/create-j-w-t.md +++ b/docs/examples/account/create-j-w-t.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - ; - Future result = account.createJWT(); +Account account = Account(client); + +Future result = account.createJWT(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 81fea121..b024252c 100644 --- a/docs/examples/account/create-magic-u-r-l-token.md +++ b/docs/examples/account/create-magic-u-r-l-token.md @@ -1,22 +1,21 @@ import 'package:appwrite/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 - ; - Future result = account.createMagicURLToken( - userId:'[USER_ID]' , - email:'email@example.com' , - ); +Account account = Account(client); + +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); +}); - 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 4ef8054b..e9bc0600 100644 --- a/docs/examples/account/create-o-auth2session.md +++ b/docs/examples/account/create-o-auth2session.md @@ -1,21 +1,22 @@ import 'package:appwrite/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 - ; - Future result = account.createOAuth2Session( - provider: OAuthProvider.amazon.value, - ); +Account account = Account(client); + +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); +}); - 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 9ed27c5a..c419f194 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - ; - Future result = account.createPhoneToken( - userId:'[USER_ID]' , - phone:'+12065550100' , - ); +Account account = Account(client); + +Future result = account.createPhoneToken( + userId: '[USER_ID]', + phone: '+12065550100', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 76e724d8..33ffe103 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - ; - Future result = account.createPhoneVerification(); +Account account = Account(client); + +Future result = account.createPhoneVerification(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -} diff --git a/docs/examples/account/create-push-target.md b/docs/examples/account/create-push-target.md index a130a8e6..95affb25 100644 --- a/docs/examples/account/create-push-target.md +++ b/docs/examples/account/create-push-target.md @@ -1,22 +1,20 @@ import 'package:appwrite/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 - ; - Future result = account.createPushTarget( - targetId:'[TARGET_ID]' , - identifier:'[IDENTIFIER]' , - ); +Account account = Account(client); + +Future result = account.createPushTarget( + targetId: '[TARGET_ID]', + identifier: '[IDENTIFIER]', + providerId: '[PROVIDER_ID]', // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 ff00ec04..afb1708c 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - ; - Future result = account.createRecovery( - email:'email@example.com' , - url:'https://example.com' , - ); +Account account = Account(client); + +Future result = account.createRecovery( + email: 'email@example.com', + url: 'https://example.com', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 78fbffbe..a6be958c 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - ; - Future result = account.createSession( - userId:'[USER_ID]' , - secret:'[SECRET]' , - ); +Account account = Account(client); + +Future result = account.createSession( + userId: '[USER_ID]', + secret: '[SECRET]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 36ff0aff..74e31650 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -1,21 +1,18 @@ import 'package:appwrite/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 - ; - Future result = account.createVerification( - url:'https://example.com' , - ); +Account account = Account(client); + +Future result = account.createVerification( + url: 'https://example.com', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 21b9c852..57fd7cf8 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -1,23 +1,21 @@ import 'package:appwrite/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 - ; - Future result = account.create( - userId:'[USER_ID]' , - email:'email@example.com' , - password:'' , - ); +Account account = Account(client); + +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); +}); - 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 a03bd9e2..f987391f 100644 --- a/docs/examples/account/create2f-a-challenge.md +++ b/docs/examples/account/create2f-a-challenge.md @@ -1,21 +1,18 @@ import 'package:appwrite/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 - ; - Future result = account.create2FAChallenge( - factor: AuthenticationFactor.totp.value, - ); +Account account = Account(client); + +Future result = account.create2FAChallenge( + factor: AuthenticationFactor.totp, +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 c41eff6c..7cdc4f80 100644 --- a/docs/examples/account/delete-authenticator.md +++ b/docs/examples/account/delete-authenticator.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - ; - Future result = account.deleteAuthenticator( - type: AuthenticatorType.totp.value, - otp:'[OTP]' , - ); +Account account = Account(client); + +Future result = account.deleteAuthenticator( + type: AuthenticatorType.totp, + otp: '[OTP]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 212bbdf4..74088f90 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -1,21 +1,18 @@ import 'package:appwrite/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 - ; - Future result = account.deleteIdentity( - identityId:'[IDENTITY_ID]' , - ); +Account account = Account(client); + +Future result = account.deleteIdentity( + identityId: '[IDENTITY_ID]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -} diff --git a/docs/examples/account/delete-push-target.md b/docs/examples/account/delete-push-target.md index 3a12f96c..f7e7a9ed 100644 --- a/docs/examples/account/delete-push-target.md +++ b/docs/examples/account/delete-push-target.md @@ -1,21 +1,18 @@ import 'package:appwrite/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 - ; - Future result = account.deletePushTarget( - targetId:'[TARGET_ID]' , - ); +Account account = Account(client); + +Future result = account.deletePushTarget( + targetId: '[TARGET_ID]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 05afb9dc..ea895cd4 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -1,21 +1,18 @@ import 'package:appwrite/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 - ; - Future result = account.deleteSession( - sessionId:'[SESSION_ID]' , - ); +Account account = Account(client); + +Future result = account.deleteSession( + sessionId: '[SESSION_ID]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 4963de44..e517397a 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - ; - Future result = account.deleteSessions(); +Account account = Account(client); + +Future result = account.deleteSessions(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 81eb802d..0fe089aa 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - ; - Future result = account.getPrefs(); +Account account = Account(client); + +Future result = account.getPrefs(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 db2b2ad5..0384ef30 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -1,21 +1,18 @@ import 'package:appwrite/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 - ; - Future result = account.getSession( - sessionId:'[SESSION_ID]' , - ); +Account account = Account(client); + +Future result = account.getSession( + sessionId: '[SESSION_ID]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 21192de2..fd4ea3b3 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - ; - Future result = account.get(); +Account account = Account(client); + +Future result = account.get(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 5448f526..a9309df8 100644 --- a/docs/examples/account/list-factors.md +++ b/docs/examples/account/list-factors.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - ; - Future result = account.listFactors(); +Account account = Account(client); + +Future result = account.listFactors(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 2f2eed0d..309c14b7 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -1,20 +1,18 @@ import 'package:appwrite/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 - ; - Future result = account.listIdentities( - ); +Account account = Account(client); + +Future result = account.listIdentities( + queries: [], // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 9f7088a0..d22c47ef 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -1,20 +1,18 @@ import 'package:appwrite/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 - ; - Future result = account.listLogs( - ); +Account account = Account(client); + +Future result = account.listLogs( + queries: [], // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 6f2d5dc1..31c808d2 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - ; - Future result = account.listSessions(); +Account account = Account(client); + +Future result = account.listSessions(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 be073ad3..10d08197 100644 --- a/docs/examples/account/update-challenge.md +++ b/docs/examples/account/update-challenge.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - ; - Future result = account.updateChallenge( - challengeId:'[CHALLENGE_ID]' , - otp:'[OTP]' , - ); +Account account = Account(client); + +Future result = account.updateChallenge( + challengeId: '[CHALLENGE_ID]', + otp: '[OTP]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 8ecb4880..e24c0704 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - ; - Future result = account.updateEmail( - email:'email@example.com' , - password:'password' , - ); +Account account = Account(client); + +Future result = account.updateEmail( + email: 'email@example.com', + password: 'password', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 fdd41662..f7ccf728 100644 --- a/docs/examples/account/update-m-f-a.md +++ b/docs/examples/account/update-m-f-a.md @@ -1,21 +1,18 @@ import 'package:appwrite/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 - ; - Future result = account.updateMFA( - mfa:false , - ); +Account account = Account(client); + +Future result = account.updateMFA( + mfa: false, +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 43957658..f8ffc156 100644 --- a/docs/examples/account/update-magic-u-r-l-session.md +++ b/docs/examples/account/update-magic-u-r-l-session.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - ; - Future result = account.updateMagicURLSession( - userId:'[USER_ID]' , - secret:'[SECRET]' , - ); +Account account = Account(client); + +Future result = account.updateMagicURLSession( + userId: '[USER_ID]', + secret: '[SECRET]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 074d8f1d..0bf17f1c 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -1,21 +1,18 @@ import 'package:appwrite/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 - ; - Future result = account.updateName( - name:'[NAME]' , - ); +Account account = Account(client); + +Future result = account.updateName( + name: '[NAME]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 89387ab9..8361e9f5 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -1,21 +1,19 @@ import 'package:appwrite/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 - ; - Future result = account.updatePassword( - password:'' , - ); +Account account = Account(client); + +Future result = account.updatePassword( + password: '', + oldPassword: 'password', // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 6ac4280c..df88109b 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - ; - Future result = account.updatePhoneVerification( - userId:'[USER_ID]' , - secret:'[SECRET]' , - ); +Account account = Account(client); + +Future result = account.updatePhoneVerification( + userId: '[USER_ID]', + secret: '[SECRET]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 25a70ba2..84bc5c89 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - ; - Future result = account.updatePhone( - phone:'+12065550100' , - password:'password' , - ); +Account account = Account(client); + +Future result = account.updatePhone( + phone: '+12065550100', + password: 'password', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 df8d031f..e097de13 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -1,21 +1,18 @@ import 'package:appwrite/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 - ; - Future result = account.updatePrefs( - prefs:{} , - ); +Account account = Account(client); + +Future result = account.updatePrefs( + prefs: {}, +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -} diff --git a/docs/examples/account/update-push-target.md b/docs/examples/account/update-push-target.md index 2109e853..875b628b 100644 --- a/docs/examples/account/update-push-target.md +++ b/docs/examples/account/update-push-target.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - ; - Future result = account.updatePushTarget( - targetId:'[TARGET_ID]' , - identifier:'[IDENTIFIER]' , - ); +Account account = Account(client); + +Future result = account.updatePushTarget( + targetId: '[TARGET_ID]', + identifier: '[IDENTIFIER]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 5b45901f..769f02c7 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -1,23 +1,20 @@ import 'package:appwrite/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 - ; - Future result = account.updateRecovery( - userId:'[USER_ID]' , - secret:'[SECRET]' , - password:'' , - ); +Account account = Account(client); + +Future result = account.updateRecovery( + userId: '[USER_ID]', + secret: '[SECRET]', + password: '', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 efb5f949..27800c28 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -1,21 +1,18 @@ import 'package:appwrite/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 - ; - Future result = account.updateSession( - sessionId:'[SESSION_ID]' , - ); +Account account = Account(client); + +Future result = account.updateSession( + sessionId: '[SESSION_ID]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 8e734647..fb974899 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - ; - Future result = account.updateStatus(); +Account account = Account(client); + +Future result = account.updateStatus(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 544624b7..17bc1250 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - ; - Future result = account.updateVerification( - userId:'[USER_ID]' , - secret:'[SECRET]' , - ); +Account account = Account(client); + +Future result = account.updateVerification( + userId: '[USER_ID]', + secret: '[SECRET]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 2dfa15b9..75d57797 100644 --- a/docs/examples/account/verify-authenticator.md +++ b/docs/examples/account/verify-authenticator.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - ; - Future result = account.verifyAuthenticator( - type: AuthenticatorType.totp.value, - otp:'[OTP]' , - ); +Account account = Account(client); + +Future result = account.verifyAuthenticator( + type: AuthenticatorType.totp, + otp: '[OTP]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 c5a740e2..a4beb741 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -1,34 +1,37 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - // downloading file - Future result = avatars.getBrowser( - code: Browser.avantBrowser.value, - ).then((bytes) { - final file = File('path_to_file/filename.ext'); - file.writeAsBytesSync(bytes) - }).catchError((error) { - print(error.response); - }) -} +Avatars avatars = Avatars(client); -//displaying image preview +// Downloading file +Future result = avatars.getBrowser( + code: Browser.avantBrowser, + width: 0, // (optional) + height: 0, // (optional) + quality: 0, // (optional) +).then((bytes) { + final file = File('path_to_file/filename.ext'); + file.writeAsBytesSync(bytes) +}).catchError((error) { + print(error.response); +}) + +// Displaying image preview FutureBuilder( future: avatars.getBrowser( - code: Browser.avantBrowser.value, - ), //works for both public file and private file, for private files you need to be logged in + code: Browser.avantBrowser.value, + width:0 , // (optional) + height:0 , // (optional) + quality:0 , // (optional) +), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null ? Image.memory( snapshot.data, ) : CircularProgressIndicator(); - }, + } ); diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index 46df803d..8b87380e 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -1,34 +1,37 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - // downloading file - Future result = avatars.getCreditCard( - code: CreditCard.americanExpress.value, - ).then((bytes) { - final file = File('path_to_file/filename.ext'); - file.writeAsBytesSync(bytes) - }).catchError((error) { - print(error.response); - }) -} +Avatars avatars = Avatars(client); -//displaying image preview +// Downloading file +Future result = avatars.getCreditCard( + code: CreditCard.americanExpress, + width: 0, // (optional) + height: 0, // (optional) + quality: 0, // (optional) +).then((bytes) { + final file = File('path_to_file/filename.ext'); + file.writeAsBytesSync(bytes) +}).catchError((error) { + print(error.response); +}) + +// Displaying image preview FutureBuilder( future: avatars.getCreditCard( - code: CreditCard.americanExpress.value, - ), //works for both public file and private file, for private files you need to be logged in + code: CreditCard.americanExpress.value, + width:0 , // (optional) + height:0 , // (optional) + quality:0 , // (optional) +), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null ? Image.memory( snapshot.data, ) : CircularProgressIndicator(); - }, + } ); diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index f2983170..375979f9 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -1,34 +1,31 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - // downloading file - Future result = avatars.getFavicon( - url:'https://example.com' , - ).then((bytes) { - final file = File('path_to_file/filename.ext'); - file.writeAsBytesSync(bytes) - }).catchError((error) { - print(error.response); - }) -} +Avatars avatars = Avatars(client); -//displaying image preview +// Downloading file +Future result = avatars.getFavicon( + url: 'https://example.com', +).then((bytes) { + final file = File('path_to_file/filename.ext'); + file.writeAsBytesSync(bytes) +}).catchError((error) { + print(error.response); +}) + +// Displaying image preview FutureBuilder( future: avatars.getFavicon( - url:'https://example.com' , - ), //works for both public file and private file, for private files you need to be logged in + url:'https://example.com' , +), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null ? Image.memory( snapshot.data, ) : CircularProgressIndicator(); - }, + } ); diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index a23887b5..7c962ff6 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -1,34 +1,37 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - // downloading file - Future result = avatars.getFlag( - code: Flag.afghanistan.value, - ).then((bytes) { - final file = File('path_to_file/filename.ext'); - file.writeAsBytesSync(bytes) - }).catchError((error) { - print(error.response); - }) -} +Avatars avatars = Avatars(client); -//displaying image preview +// Downloading file +Future result = avatars.getFlag( + code: Flag.afghanistan, + width: 0, // (optional) + height: 0, // (optional) + quality: 0, // (optional) +).then((bytes) { + final file = File('path_to_file/filename.ext'); + file.writeAsBytesSync(bytes) +}).catchError((error) { + print(error.response); +}) + +// Displaying image preview FutureBuilder( future: avatars.getFlag( - code: Flag.afghanistan.value, - ), //works for both public file and private file, for private files you need to be logged in + code: Flag.afghanistan.value, + width:0 , // (optional) + height:0 , // (optional) + quality:0 , // (optional) +), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null ? Image.memory( snapshot.data, ) : CircularProgressIndicator(); - }, + } ); diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index 52ba2339..377b32f0 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -1,34 +1,35 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - // downloading file - Future result = avatars.getImage( - url:'https://example.com' , - ).then((bytes) { - final file = File('path_to_file/filename.ext'); - file.writeAsBytesSync(bytes) - }).catchError((error) { - print(error.response); - }) -} +Avatars avatars = Avatars(client); -//displaying image preview +// Downloading file +Future result = avatars.getImage( + url: 'https://example.com', + width: 0, // (optional) + height: 0, // (optional) +).then((bytes) { + final file = File('path_to_file/filename.ext'); + file.writeAsBytesSync(bytes) +}).catchError((error) { + print(error.response); +}) + +// Displaying image preview FutureBuilder( future: avatars.getImage( - url:'https://example.com' , - ), //works for both public file and private file, for private files you need to be logged in + url:'https://example.com' , + width:0 , // (optional) + height:0 , // (optional) +), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null ? Image.memory( snapshot.data, ) : CircularProgressIndicator(); - }, + } ); diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index b0f49c62..dff834e2 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -1,32 +1,37 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - // downloading file - Future result = avatars.getInitials( - ).then((bytes) { - final file = File('path_to_file/filename.ext'); - file.writeAsBytesSync(bytes) - }).catchError((error) { - print(error.response); - }) -} +Avatars avatars = Avatars(client); -//displaying image preview +// Downloading file +Future result = avatars.getInitials( + name: '[NAME]', // (optional) + width: 0, // (optional) + height: 0, // (optional) + background: '', // (optional) +).then((bytes) { + final file = File('path_to_file/filename.ext'); + file.writeAsBytesSync(bytes) +}).catchError((error) { + print(error.response); +}) + +// Displaying image preview FutureBuilder( future: avatars.getInitials( - ), //works for both public file and private file, for private files you need to be logged in + name:'[NAME]' , // (optional) + width:0 , // (optional) + height:0 , // (optional) + background:'' , // (optional) +), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null ? Image.memory( snapshot.data, ) : CircularProgressIndicator(); - }, + } ); diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md index c148c4d0..89393126 100644 --- a/docs/examples/avatars/get-q-r.md +++ b/docs/examples/avatars/get-q-r.md @@ -1,34 +1,37 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - // downloading file - Future result = avatars.getQR( - text:'[TEXT]' , - ).then((bytes) { - final file = File('path_to_file/filename.ext'); - file.writeAsBytesSync(bytes) - }).catchError((error) { - print(error.response); - }) -} +Avatars avatars = Avatars(client); -//displaying image preview +// Downloading file +Future result = avatars.getQR( + text: '[TEXT]', + size: 1, // (optional) + margin: 0, // (optional) + download: false, // (optional) +).then((bytes) { + final file = File('path_to_file/filename.ext'); + file.writeAsBytesSync(bytes) +}).catchError((error) { + print(error.response); +}) + +// Displaying image preview FutureBuilder( future: avatars.getQR( - text:'[TEXT]' , - ), //works for both public file and private file, for private files you need to be logged in + text:'[TEXT]' , + size:1 , // (optional) + margin:0 , // (optional) + download:false , // (optional) +), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null ? Image.memory( snapshot.data, ) : CircularProgressIndicator(); - }, + } ); diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index f4d765c9..bfe00de4 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -1,24 +1,22 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = databases.createDocument( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - documentId:'[DOCUMENT_ID]' , - data:{} , - ); +Databases databases = Databases(client); + +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); +}); - 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 edf2d99d..ca40172f 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -1,23 +1,20 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = databases.deleteDocument( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - documentId:'[DOCUMENT_ID]' , - ); +Databases databases = Databases(client); + +Future result = databases.deleteDocument( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + documentId: '[DOCUMENT_ID]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 77b484e2..23dd0438 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -1,23 +1,21 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = databases.getDocument( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - documentId:'[DOCUMENT_ID]' , - ); +Databases databases = Databases(client); + +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); +}); - 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 88d3a1e9..15dbfcd1 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -1,22 +1,20 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = databases.listDocuments( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - ); +Databases databases = Databases(client); + +Future result = databases.listDocuments( + databaseId: '[DATABASE_ID]', + collectionId: '[COLLECTION_ID]', + queries: [], // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 81dcea3e..2a2da031 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -1,23 +1,22 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = databases.updateDocument( - databaseId:'[DATABASE_ID]' , - collectionId:'[COLLECTION_ID]' , - documentId:'[DOCUMENT_ID]' , - ); +Databases databases = Databases(client); + +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); +}); - 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 98f80c23..290016f2 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -1,21 +1,23 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = functions.createExecution( - functionId:'[FUNCTION_ID]' , - ); +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) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 46734305..09cebfad 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = functions.getExecution( - functionId:'[FUNCTION_ID]' , - executionId:'[EXECUTION_ID]' , - ); +Functions functions = Functions(client); + +Future result = functions.getExecution( + functionId: '[FUNCTION_ID]', + executionId: '[EXECUTION_ID]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 b742c852..66441698 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -1,21 +1,20 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = functions.listExecutions( - functionId:'[FUNCTION_ID]' , - ); +Functions functions = Functions(client); + +Future result = functions.listExecutions( + functionId: '[FUNCTION_ID]', + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 6d201cb1..d61e2281 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -1,21 +1,18 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = graphql.mutation( - query:{} , - ); +Graphql graphql = Graphql(client); + +Future result = graphql.mutation( + query: {}, +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 18adfaa4..f20357fc 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -1,21 +1,18 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = graphql.query( - query:{} , - ); +Graphql graphql = Graphql(client); + +Future result = graphql.query( + query: {}, +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 9e9fa96b..2a801b9c 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = locale.get(); +Locale locale = Locale(client); + +Future result = locale.get(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 d11cb7bd..dd806364 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = locale.listCodes(); +Locale locale = Locale(client); + +Future result = locale.listCodes(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 0ab2a4ab..b134954e 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = locale.listContinents(); +Locale locale = Locale(client); + +Future result = locale.listContinents(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 caa32e85..8aba7e64 100644 --- a/docs/examples/locale/list-countries-e-u.md +++ b/docs/examples/locale/list-countries-e-u.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = locale.listCountriesEU(); +Locale locale = Locale(client); + +Future result = locale.listCountriesEU(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 b122eee7..47ed3c4d 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = locale.listCountriesPhones(); +Locale locale = Locale(client); + +Future result = locale.listCountriesPhones(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 e6a367dd..080a0aad 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = locale.listCountries(); +Locale locale = Locale(client); + +Future result = locale.listCountries(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 fcd1e825..c99f640b 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = locale.listCurrencies(); +Locale locale = Locale(client); + +Future result = locale.listCurrencies(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 1fb68aa8..db0b3896 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -1,19 +1,16 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = locale.listLanguages(); +Locale locale = Locale(client); + +Future result = locale.listLanguages(); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 062ccf92..97977a5f 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -1,23 +1,20 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = messaging.createSubscriber( - topicId:'[TOPIC_ID]' , - subscriberId:'[SUBSCRIBER_ID]' , - targetId:'[TARGET_ID]' , - ); +Messaging messaging = Messaging(client); + +Future result = messaging.createSubscriber( + topicId: '[TOPIC_ID]', + subscriberId: '[SUBSCRIBER_ID]', + targetId: '[TARGET_ID]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 63e98836..51d829c7 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = messaging.deleteSubscriber( - topicId:'[TOPIC_ID]' , - subscriberId:'[SUBSCRIBER_ID]' , - ); +Messaging messaging = Messaging(client); + +Future result = messaging.deleteSubscriber( + topicId: '[TOPIC_ID]', + subscriberId: '[SUBSCRIBER_ID]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 cbb58baa..2d8a06bf 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -1,24 +1,22 @@ import 'dart:io'; import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = storage.createFile( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - file:InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg') , - ); +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) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 9d841887..0448315d 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = storage.deleteFile( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - ); +Storage storage = Storage(client); + +Future result = storage.deleteFile( + bucketId: '[BUCKET_ID]', + fileId: '[FILE_ID]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 97190cd9..28ed65f5 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -1,36 +1,33 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - // downloading file - Future result = storage.getFileDownload( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - ).then((bytes) { - final file = File('path_to_file/filename.ext'); - file.writeAsBytesSync(bytes) - }).catchError((error) { - print(error.response); - }) -} +Storage storage = Storage(client); -//displaying image preview +// Downloading file +Future result = storage.getFileDownload( + bucketId: '[BUCKET_ID]', + fileId: '[FILE_ID]', +).then((bytes) { + final file = File('path_to_file/filename.ext'); + file.writeAsBytesSync(bytes) +}).catchError((error) { + print(error.response); +}) + +// Displaying image preview FutureBuilder( future: storage.getFileDownload( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - ), //works for both public file and private file, for private files you need to be logged in + bucketId:'[BUCKET_ID]' , + fileId:'[FILE_ID]' , +), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null ? Image.memory( snapshot.data, ) : CircularProgressIndicator(); - }, + } ); diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 90c46051..85ff2a10 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -1,36 +1,55 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - // downloading file - Future result = storage.getFilePreview( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - ).then((bytes) { - final file = File('path_to_file/filename.ext'); - file.writeAsBytesSync(bytes) - }).catchError((error) { - print(error.response); - }) -} +Storage storage = Storage(client); -//displaying image preview +// Downloading file +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) +).then((bytes) { + final file = File('path_to_file/filename.ext'); + file.writeAsBytesSync(bytes) +}).catchError((error) { + print(error.response); +}) + +// Displaying image preview FutureBuilder( future: storage.getFilePreview( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - ), //works for both public file and private file, for private files you need to be logged in + bucketId:'[BUCKET_ID]' , + fileId:'[FILE_ID]' , + width:0 , // (optional) + height:0 , // (optional) + gravity: ImageGravity.center.value, // (optional) + quality:0 , // (optional) + borderWidth:0 , // (optional) + borderColor:'' , // (optional) + borderRadius:0 , // (optional) + opacity:0 , // (optional) + rotation:-360 , // (optional) + background:'' , // (optional) + output: ImageFormat.jpg.value, // (optional) +), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null ? Image.memory( snapshot.data, ) : CircularProgressIndicator(); - }, + } ); diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index fb69ffe4..fa069e22 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -1,36 +1,33 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - // downloading file - Future result = storage.getFileView( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - ).then((bytes) { - final file = File('path_to_file/filename.ext'); - file.writeAsBytesSync(bytes) - }).catchError((error) { - print(error.response); - }) -} +Storage storage = Storage(client); -//displaying image preview +// Downloading file +Future result = storage.getFileView( + bucketId: '[BUCKET_ID]', + fileId: '[FILE_ID]', +).then((bytes) { + final file = File('path_to_file/filename.ext'); + file.writeAsBytesSync(bytes) +}).catchError((error) { + print(error.response); +}) + +// Displaying image preview FutureBuilder( future: storage.getFileView( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - ), //works for both public file and private file, for private files you need to be logged in + bucketId:'[BUCKET_ID]' , + fileId:'[FILE_ID]' , +), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null ? Image.memory( snapshot.data, ) : CircularProgressIndicator(); - }, + } ); diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index d6581348..f0fbbf07 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = storage.getFile( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - ); +Storage storage = Storage(client); + +Future result = storage.getFile( + bucketId: '[BUCKET_ID]', + fileId: '[FILE_ID]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 04befaa2..6f6c3d33 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -1,21 +1,20 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = storage.listFiles( - bucketId:'[BUCKET_ID]' , - ); +Storage storage = Storage(client); + +Future result = storage.listFiles( + bucketId: '[BUCKET_ID]', + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 f9dce123..f63d72f0 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -1,22 +1,21 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = storage.updateFile( - bucketId:'[BUCKET_ID]' , - fileId:'[FILE_ID]' , - ); +Storage storage = Storage(client); + +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); +}); - 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 8fddccad..40f05161 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -1,22 +1,24 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = teams.createMembership( - teamId:'[TEAM_ID]' , - roles:[] , - ); +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) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 e804e254..284f8f1f 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -1,22 +1,20 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = teams.create( - teamId:'[TEAM_ID]' , - name:'[NAME]' , - ); +Teams teams = Teams(client); + +Future result = teams.create( + teamId: '[TEAM_ID]', + name: '[NAME]', + roles: [], // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 6bf60448..7e4afcce 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = teams.deleteMembership( - teamId:'[TEAM_ID]' , - membershipId:'[MEMBERSHIP_ID]' , - ); +Teams teams = Teams(client); + +Future result = teams.deleteMembership( + teamId: '[TEAM_ID]', + membershipId: '[MEMBERSHIP_ID]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 3faa80a5..c23ba4a0 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -1,21 +1,18 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = teams.delete( - teamId:'[TEAM_ID]' , - ); +Teams teams = Teams(client); + +Future result = teams.delete( + teamId: '[TEAM_ID]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 46bc0d71..6823cb1e 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = teams.getMembership( - teamId:'[TEAM_ID]' , - membershipId:'[MEMBERSHIP_ID]' , - ); +Teams teams = Teams(client); + +Future result = teams.getMembership( + teamId: '[TEAM_ID]', + membershipId: '[MEMBERSHIP_ID]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 7d074b64..246bd12f 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -1,21 +1,18 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = teams.getPrefs( - teamId:'[TEAM_ID]' , - ); +Teams teams = Teams(client); + +Future result = teams.getPrefs( + teamId: '[TEAM_ID]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 870bb347..a495e41f 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -1,21 +1,18 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = teams.get( - teamId:'[TEAM_ID]' , - ); +Teams teams = Teams(client); + +Future result = teams.get( + teamId: '[TEAM_ID]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 1977e375..6b807e63 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -1,21 +1,20 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = teams.listMemberships( - teamId:'[TEAM_ID]' , - ); +Teams teams = Teams(client); + +Future result = teams.listMemberships( + teamId: '[TEAM_ID]', + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 80aa3016..0651eb30 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -1,20 +1,19 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = teams.list( - ); +Teams teams = Teams(client); + +Future result = teams.list( + queries: [], // (optional) + search: '[SEARCH]', // (optional) +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 a7a3762f..1b6c737b 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -1,24 +1,21 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = teams.updateMembershipStatus( - teamId:'[TEAM_ID]' , - membershipId:'[MEMBERSHIP_ID]' , - userId:'[USER_ID]' , - secret:'[SECRET]' , - ); +Teams teams = Teams(client); + +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); +}); - 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 b3f34e10..bb23506f 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -1,23 +1,20 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = teams.updateMembership( - teamId:'[TEAM_ID]' , - membershipId:'[MEMBERSHIP_ID]' , - roles:[] , - ); +Teams teams = Teams(client); + +Future result = teams.updateMembership( + teamId: '[TEAM_ID]', + membershipId: '[MEMBERSHIP_ID]', + roles: [], +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 be9aed08..0a746728 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = teams.updateName( - teamId:'[TEAM_ID]' , - name:'[NAME]' , - ); +Teams teams = Teams(client); + +Future result = teams.updateName( + teamId: '[TEAM_ID]', + name: '[NAME]', +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - 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 712bfec5..89b6499a 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -1,22 +1,19 @@ import 'package:appwrite/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 - client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - ; - Future result = teams.updatePrefs( - teamId:'[TEAM_ID]' , - prefs:{} , - ); +Teams teams = Teams(client); + +Future result = teams.updatePrefs( + teamId: '[TEAM_ID]', + prefs: {}, +); + +result.then((response) { + print(response); +}).catchError((error) { + print(error.response); +}); - result - .then((response) { - print(response); - }).catchError((error) { - print(error.response); - }); -} diff --git a/lib/appwrite.dart b/lib/appwrite.dart index 7f1bb2fe..d8ed2a06 100644 --- a/lib/appwrite.dart +++ b/lib/appwrite.dart @@ -1,6 +1,6 @@ /// Appwrite Flutter 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-flutter/releases). library appwrite; diff --git a/lib/services/account.dart b/lib/services/account.dart index c1f715c8..8caa330f 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -243,7 +243,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 = { }; @@ -261,7 +261,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 = { 'otp': otp, @@ -280,7 +280,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 = { 'otp': otp, @@ -597,7 +597,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 params = { diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index a656e527..1a83f55a 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -19,7 +19,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 = { @@ -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 = { @@ -93,7 +93,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 = { diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 30e65443..b663d463 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -6,8 +6,9 @@ class Messaging extends Service { /// Initializes a [Messaging] service Messaging(super.client); - /// 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); @@ -26,8 +27,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/src/client_browser.dart b/lib/src/client_browser.dart index b142362a..ec407182 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -43,7 +43,7 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-name': 'Flutter', 'x-sdk-platform': 'client', 'x-sdk-language': 'flutter', - 'x-sdk-version': '12.0.0-rc.3', + 'x-sdk-version': '12.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 e1790a44..df27a640 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -64,7 +64,7 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-name': 'Flutter', 'x-sdk-platform': 'client', 'x-sdk-language': 'flutter', - 'x-sdk-version': '12.0.0-rc.3', + 'x-sdk-version': '12.0.0-rc.4', 'X-Appwrite-Response-Format' : '1.5.0', }; diff --git a/pubspec.yaml b/pubspec.yaml index 2867bfc2..ca5b58aa 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: appwrite -version: 12.0.0-rc.3 +version: 12.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-flutter