diff --git a/README.md b/README.md index 39d1340..c8bfbe3 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 1755a72..7bcd919 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 2f3e7a6..c4f5ea3 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 fae7af8..4883321 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 fdaf5e2..ec5c9b6 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 c4a61f7..ed15dfa 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 81fea12..b024252 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 4ef8054..e9bc060 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 9ed27c5..c419f19 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 76e724d..33ffe10 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 a130a8e..95affb2 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 ff00ec0..afb1708 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 78fbffb..a6be958 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 36ff0af..74e3165 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 21b9c85..57fd7cf 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 a03bd9e..f987391 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 c41eff6..7cdc4f8 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 212bbdf..74088f9 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 3a12f96..f7e7a9e 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 05afb9d..ea895cd 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 4963de4..e517397 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 81eb802..0fe089a 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 db2b2ad..0384ef3 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 21192de..fd4ea3b 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 5448f52..a9309df 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 2f2eed0..309c14b 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 9f7088a..d22c47e 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 6f2d5dc..31c808d 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 be073ad..10d0819 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 8ecb488..e24c070 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 fdd4166..f7ccf72 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 4395765..f8ffc15 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 074d8f1..0bf17f1 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 89387ab..8361e9f 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 6ac4280..df88109 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 25a70ba..84bc5c8 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 df8d031..e097de1 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 2109e85..875b628 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 5b45901..769f02c 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 efb5f94..27800c2 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 8e73464..fb97489 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 544624b..17bc125 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 2dfa15b..75d5779 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 c5a740e..a4beb74 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 46df803..8b87380 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 f298317..375979f 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 a23887b..7c962ff 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 52ba233..377b32f 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 b0f49c6..dff834e 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 c148c4d..8939312 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 f4d765c..bfe00de 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 edf2d99..ca40172 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 77b484e..23dd043 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 88d3a1e..15dbfcd 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 81dcea3..2a2da03 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 98f80c2..290016f 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 4673430..09cebfa 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 b742c85..6644169 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 6d201cb..d61e228 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 18adfaa..f20357f 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 9e9fa96..2a801b9 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 d11cb7b..dd80636 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 0ab2a4a..b134954 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 caa32e8..8aba7e6 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 b122eee..47ed3c4 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 e6a367d..080a0aa 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 fcd1e82..c99f640 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 1fb68aa..db0b389 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 062ccf9..97977a5 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 63e9883..51d829c 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 cbb58ba..2d8a06b 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 9d84188..0448315 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 97190cd..28ed65f 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 90c4605..85ff2a1 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 fb69ffe..fa069e2 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 d658134..f0fbbf0 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 04befaa..6f6c3d3 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 f9dce12..f63d72f 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 8fddcca..40f0516 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 e804e25..284f8f1 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 6bf6044..7e4afcc 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 3faa80a..c23ba4a 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 46bc0d7..6823cb1 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 7d074b6..246bd12 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 870bb34..a495e41 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 1977e37..6b807e6 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 80aa301..0651eb3 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 a7a3762..1b6c737 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 b3f34e1..bb23506 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 be9aed0..0a74672 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 712bfec..89b6499 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 7f1bb2f..d8ed2a0 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 c1f715c..8caa330 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 a656e52..1a83f55 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 30e6544..b663d46 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 b142362..ec40718 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 e1790a4..df27a64 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 2867bfc..ca5b58a 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