diff --git a/README.md b/README.md index 79045b6..45d4bcd 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.3.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.3.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) diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index 01b4374..2f3e7a6 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.createAnonymousSession(); diff --git a/docs/examples/account/create-email-session.md b/docs/examples/account/create-email-session.md index 6cbb227..52b6b91 100644 --- a/docs/examples/account/create-email-session.md +++ b/docs/examples/account/create-email-session.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.createEmailSession( diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-j-w-t.md index f88c7ad..c4a61f7 100644 --- a/docs/examples/account/create-j-w-t.md +++ b/docs/examples/account/create-j-w-t.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.createJWT(); diff --git a/docs/examples/account/create-magic-u-r-l-session.md b/docs/examples/account/create-magic-u-r-l-session.md index 4d36b45..d1b89bf 100644 --- a/docs/examples/account/create-magic-u-r-l-session.md +++ b/docs/examples/account/create-magic-u-r-l-session.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.createMagicURLSession( diff --git a/docs/examples/account/create-o-auth2session.md b/docs/examples/account/create-o-auth2session.md index a100378..e985a92 100644 --- a/docs/examples/account/create-o-auth2session.md +++ b/docs/examples/account/create-o-auth2session.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.createOAuth2Session( diff --git a/docs/examples/account/create-phone-session.md b/docs/examples/account/create-phone-session.md index f71c3d0..fcb705c 100644 --- a/docs/examples/account/create-phone-session.md +++ b/docs/examples/account/create-phone-session.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.createPhoneSession( diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index ee16f76..76e724d 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.createPhoneVerification(); diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index 2a5df1a..361a9f0 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.createRecovery( diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index 18fa98a..d66c3b1 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.createVerification( diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index bd5ba35..1ff2ae9 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.create( diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index c116ef1..9146561 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.deleteSession( diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index 0d84b9d..4963de4 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.deleteSessions(); diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index 2d6efd5..81eb802 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.getPrefs(); diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index 4d93a81..9e0f66c 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.getSession( diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index 733d884..21192de 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.get(); diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index 965378c..9f7088a 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.listLogs( diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index ac370b0..6f2d5dc 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.listSessions(); diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index 30dff9b..1fb9a3f 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.updateEmail( 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 9688110..3c7ef8f 100644 --- a/docs/examples/account/update-magic-u-r-l-session.md +++ b/docs/examples/account/update-magic-u-r-l-session.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.updateMagicURLSession( diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index 01ff7a0..ae5d623 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.updateName( diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index d70a2c2..b5e86de 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.updatePassword( diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md index 2125266..1f97926 100644 --- a/docs/examples/account/update-phone-session.md +++ b/docs/examples/account/update-phone-session.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.updatePhoneSession( diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index 9ad71fe..86d9b0f 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.updatePhoneVerification( diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index a3b1ccc..edfe478 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.updatePhone( diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index bb7b8f8..9769708 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.updatePrefs( diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index df9f144..f499b18 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.updateRecovery( diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index 37fd58c..fb1afcc 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.updateSession( diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index fb3790e..8e73464 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.updateStatus(); diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index 2bfbaed..fba8ed6 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -5,7 +5,7 @@ void main() { // Init SDK Account account = Account(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = account.updateVerification( diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index f908d11..70af566 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -5,7 +5,7 @@ void main() { // Init SDK Avatars avatars = Avatars(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; // downloading file diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index 0c6ff01..6a29dc8 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -5,7 +5,7 @@ void main() { // Init SDK Avatars avatars = Avatars(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; // downloading file diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index 6df7c2d..2da0f2e 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -5,7 +5,7 @@ void main() { // Init SDK Avatars avatars = Avatars(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; // downloading file diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index fa5b60d..1336788 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -5,7 +5,7 @@ void main() { // Init SDK Avatars avatars = Avatars(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; // downloading file diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index 219d160..debbf1e 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -5,7 +5,7 @@ void main() { // Init SDK Avatars avatars = Avatars(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; // downloading file diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index cd1b1f7..b0f49c6 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -5,7 +5,7 @@ void main() { // Init SDK Avatars avatars = Avatars(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; // downloading file diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md index df6ebd3..8df7293 100644 --- a/docs/examples/avatars/get-q-r.md +++ b/docs/examples/avatars/get-q-r.md @@ -5,7 +5,7 @@ void main() { // Init SDK Avatars avatars = Avatars(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; // downloading file diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 730dd21..6a03173 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -5,7 +5,7 @@ void main() { // Init SDK Databases databases = Databases(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = databases.createDocument( diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index 8dc6246..a377b02 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -5,7 +5,7 @@ void main() { // Init SDK Databases databases = Databases(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = databases.deleteDocument( diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index 71c88d6..b2cf89a 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -5,7 +5,7 @@ void main() { // Init SDK Databases databases = Databases(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = databases.getDocument( diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 816a17d..4cd69e3 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -5,7 +5,7 @@ void main() { // Init SDK Databases databases = Databases(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = databases.listDocuments( diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 29abff6..595099b 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -5,7 +5,7 @@ void main() { // Init SDK Databases databases = Databases(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = databases.updateDocument( diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index 70b617f..b188c32 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -5,7 +5,7 @@ void main() { // Init SDK Functions functions = Functions(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = functions.createExecution( diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index a10f793..f30b4b4 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -5,7 +5,7 @@ void main() { // Init SDK Functions functions = Functions(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = functions.getExecution( diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 3f59aa3..1840f50 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -5,7 +5,7 @@ void main() { // Init SDK Functions functions = Functions(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = functions.listExecutions( diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index 0eba90f..c0bffce 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -5,7 +5,7 @@ void main() { // Init SDK Graphql graphql = Graphql(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = graphql.mutation( diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index d4a3d6e..455cb0b 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -5,7 +5,7 @@ void main() { // Init SDK Graphql graphql = Graphql(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = graphql.query( diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index 21b1a6c..9e9fa96 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -5,7 +5,7 @@ void main() { // Init SDK Locale locale = Locale(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = locale.get(); diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index be47ec2..0ab2a4a 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -5,7 +5,7 @@ void main() { // Init SDK Locale locale = Locale(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = locale.listContinents(); diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-e-u.md index 9f2a9ab..caa32e8 100644 --- a/docs/examples/locale/list-countries-e-u.md +++ b/docs/examples/locale/list-countries-e-u.md @@ -5,7 +5,7 @@ void main() { // Init SDK Locale locale = Locale(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = locale.listCountriesEU(); diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index 93d84ea..b122eee 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -5,7 +5,7 @@ void main() { // Init SDK Locale locale = Locale(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = locale.listCountriesPhones(); diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index 6eb8d42..e6a367d 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -5,7 +5,7 @@ void main() { // Init SDK Locale locale = Locale(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = locale.listCountries(); diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index eb8be0f..fcd1e82 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -5,7 +5,7 @@ void main() { // Init SDK Locale locale = Locale(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = locale.listCurrencies(); diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index 287f69b..1fb68aa 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -5,7 +5,7 @@ void main() { // Init SDK Locale locale = Locale(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = locale.listLanguages(); diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index 5c591ff..0f5e44f 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -6,7 +6,7 @@ void main() { // Init SDK Storage storage = Storage(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = storage.createFile( diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index ee193d9..230b73a 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -5,7 +5,7 @@ void main() { // Init SDK Storage storage = Storage(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = storage.deleteFile( diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index ea3f2ab..883b7d6 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -5,7 +5,7 @@ void main() { // Init SDK Storage storage = Storage(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; // downloading file diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 1a0fca2..f42138b 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -5,7 +5,7 @@ void main() { // Init SDK Storage storage = Storage(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; // downloading file diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index 4605133..4f7c4d9 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -5,7 +5,7 @@ void main() { // Init SDK Storage storage = Storage(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; // downloading file diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index 26e5db0..681aca4 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -5,7 +5,7 @@ void main() { // Init SDK Storage storage = Storage(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = storage.getFile( diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index b1d095a..e574f7b 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -5,7 +5,7 @@ void main() { // Init SDK Storage storage = Storage(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = storage.listFiles( diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index 7105652..1170f05 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -5,7 +5,7 @@ void main() { // Init SDK Storage storage = Storage(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = storage.updateFile( diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 6be423c..ac58c50 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -5,7 +5,7 @@ void main() { // Init SDK Teams teams = Teams(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.createMembership( diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index 5333ce3..bd62ce3 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -5,7 +5,7 @@ void main() { // Init SDK Teams teams = Teams(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.create( diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index 8192b85..0febe42 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -5,7 +5,7 @@ void main() { // Init SDK Teams teams = Teams(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.deleteMembership( diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index e55c62b..b45d971 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -5,7 +5,7 @@ void main() { // Init SDK Teams teams = Teams(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.delete( diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index 6abecfe..28d95a2 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -5,7 +5,7 @@ void main() { // Init SDK Teams teams = Teams(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.getMembership( diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index e242b17..e9ae94e 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -5,7 +5,7 @@ void main() { // Init SDK Teams teams = Teams(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.getPrefs( diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index 25eb245..0ec7027 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -5,7 +5,7 @@ void main() { // Init SDK Teams teams = Teams(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.get( diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 67a6c15..cbbc525 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -5,7 +5,7 @@ void main() { // Init SDK Teams teams = Teams(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.listMemberships( diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index 8657f80..80aa301 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -5,7 +5,7 @@ void main() { // Init SDK Teams teams = Teams(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.list( diff --git a/docs/examples/teams/update-membership-roles.md b/docs/examples/teams/update-membership-roles.md index 7615752..6e96c01 100644 --- a/docs/examples/teams/update-membership-roles.md +++ b/docs/examples/teams/update-membership-roles.md @@ -5,7 +5,7 @@ void main() { // Init SDK Teams teams = Teams(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.updateMembershipRoles( diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index 7cda544..ed31f54 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -5,7 +5,7 @@ void main() { // Init SDK Teams teams = Teams(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.updateMembershipStatus( diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index d657002..5c794bd 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -5,7 +5,7 @@ void main() { // Init SDK Teams teams = Teams(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.updateName( diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index aab3322..c29cbb9 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -5,7 +5,7 @@ void main() { // Init SDK Teams teams = Teams(client); client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.updatePrefs( diff --git a/lib/appwrite.dart b/lib/appwrite.dart index 1063831..c48f00f 100644 --- a/lib/appwrite.dart +++ b/lib/appwrite.dart @@ -1,3 +1,8 @@ +/// Appwrite Flutter SDK +/// +/// This SDK is compatible with Appwrite server version 1.3.x. +/// For older versions, please check +/// [previous releases](https://github.com/appwrite/sdk-for-flutter/releases). library appwrite; import 'dart:async'; diff --git a/lib/id.dart b/lib/id.dart index e32f001..1cfcee4 100644 --- a/lib/id.dart +++ b/lib/id.dart @@ -1,13 +1,16 @@ part of appwrite; +/// Helper class to generate ID strings for resources. class ID { - ID._(); - - static String unique() { - return 'unique()'; - } + ID._(); - static String custom(String id) { - return id; - } + /// Have Appwrite generate a unique ID for you. + static String unique() { + return 'unique()'; + } + + /// Uses [id] as the ID for the resource. + static String custom(String id) { + return id; + } } \ No newline at end of file diff --git a/lib/models.dart b/lib/models.dart index 898ea35..c8b0619 100644 --- a/lib/models.dart +++ b/lib/models.dart @@ -1,3 +1,4 @@ +/// Appwrite Models library appwrite.models; part 'src/models/model.dart'; diff --git a/lib/permission.dart b/lib/permission.dart index 5bc0cfd..c860e19 100644 --- a/lib/permission.dart +++ b/lib/permission.dart @@ -1,21 +1,34 @@ part of appwrite; +/// Helper class to generate permission strings for resources. class Permission { - Permission._(); + Permission._(); - static String read(String role) { - return 'read("$role")'; - } - static String write(String role) { - return 'write("$role")'; - } - static String create(String role) { - return 'create("$role")'; - } - static String update(String role) { - return 'update("$role")'; - } - static String delete(String role) { - return 'delete("$role")'; - } + /// Read permission for provided [role] + static String read(String role) { + return 'read("$role")'; + } + + /// Write permission for provided [role] + /// + /// This is an alias of update, delete, and possibly create. + /// Don't use write in combination with update, delete, or create. + static String write(String role) { + return 'write("$role")'; + } + + /// Update permission for provided [role] + static String create(String role) { + return 'create("$role")'; + } + + /// Update permission for provided [role] + static String update(String role) { + return 'update("$role")'; + } + + /// Delete permission for provided [role] + static String delete(String role) { + return 'delete("$role")'; + } } diff --git a/lib/query.dart b/lib/query.dart index 7110e87..df958a1 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -1,61 +1,97 @@ part of appwrite; +/// Helper class to generate query strings. class Query { - Query._(); - + Query._(); + + /// Filter resources where [attribute] is equal to [value]. + /// + /// [value] can be a single value or a list. If a list is used + /// the query will return resources where [attribute] is equal + /// to any of the values in the list. static String equal(String attribute, dynamic value) => _addQuery(attribute, 'equal', value); + /// Filter resources where [attribute] is not equal to [value]. static String notEqual(String attribute, dynamic value) => _addQuery(attribute, 'notEqual', value); + /// Filter resources where [attribute] is less than [value]. static String lessThan(String attribute, dynamic value) => _addQuery(attribute, 'lessThan', value); + /// Filter resources where [attribute] is less than or equal to [value]. static String lessThanEqual(String attribute, dynamic value) => _addQuery(attribute, 'lessThanEqual', value); + /// Filter resources where [attribute] is greater than [value]. static String greaterThan(String attribute, dynamic value) => _addQuery(attribute, 'greaterThan', value); + /// Filter resources where [attribute] is greater than or equal to [value]. static String greaterThanEqual(String attribute, dynamic value) => _addQuery(attribute, 'greaterThanEqual', value); + /// Filter resources where by searching [attribute] for [value]. + /// + /// A fulltext index on [attribute] is required for this query to work. static String search(String attribute, String value) => _addQuery(attribute, 'search', value); + /// Filter resources where [attribute] is null. static String isNull(String attribute) => 'isNull("$attribute")'; + /// Filter resources where [attribute] is not null. static String isNotNull(String attribute) => 'isNotNull("$attribute")'; + /// Filter resources where [attribute] is between [start] and [end] (inclusive). static String between(String attribute, dynamic start, dynamic end) => _addQuery(attribute, 'between', [start, end]); + /// Filter resources where [attribute] starts with [value]. static String startsWith(String attribute, String value) => _addQuery(attribute, 'startsWith', value); + /// Filter resources where [attribute] ends with [value]. static String endsWith(String attribute, String value) => _addQuery(attribute, 'endsWith', value); - static String select(List attributes) => 'select([${attributes.map((attr) => "\"$attr\"").join(",")}])'; + /// Specify which attributes should be returned by the API call. + static String select(List attributes) => + 'select([${attributes.map((attr) => "\"$attr\"").join(",")}])'; + /// Sort results by [attribute] ascending. static String orderAsc(String attribute) => 'orderAsc("$attribute")'; + /// Sort results by [attribute] descending. static String orderDesc(String attribute) => 'orderDesc("$attribute")'; + /// Return results before [id]. + /// + /// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination) + /// docs for more information. static String cursorBefore(String id) => 'cursorBefore("$id")'; + /// Return results after [id]. + /// + /// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination) + /// docs for more information. static String cursorAfter(String id) => 'cursorAfter("$id")'; + /// Return only [limit] results. static String limit(int limit) => 'limit($limit)'; + /// Return results from [offset]. + /// + /// Refer to the [Offset Pagination](https://appwrite.io/docs/pagination#offset-pagination) + /// docs for more information. static String offset(int offset) => 'offset($offset)'; static String _addQuery(String attribute, String method, dynamic value) => (value is List) - ? '$method("$attribute", [${value.map((item) => parseValues(item)).join(",")}])' - : '$method("$attribute", [${parseValues(value)}])'; + ? '$method("$attribute", [${value.map((item) => _parseValues(item)).join(",")}])' + : '$method("$attribute", [${_parseValues(value)}])'; - static String parseValues(dynamic value) => + static String _parseValues(dynamic value) => (value is String) ? '"$value"' : '$value'; -} +} \ No newline at end of file diff --git a/lib/role.dart b/lib/role.dart index 445579e..9289d69 100644 --- a/lib/role.dart +++ b/lib/role.dart @@ -1,12 +1,20 @@ part of appwrite; +/// Helper class to generate role strings for [Permission]. class Role { Role._(); + /// Grants access to anyone. + /// + /// This includes authenticated and unauthenticated users. static String any() { return 'any'; } + /// Grants access to a specific user by user ID. + /// + /// You can optionally pass verified or unverified for + /// [status] to target specific types of users. static String user(String id, [String status = '']) { if(status.isEmpty) { return 'user:$id'; @@ -14,6 +22,10 @@ class Role { return 'user:$id/$status'; } + /// Grants access to any authenticated or anonymous user. + /// + /// You can optionally pass verified or unverified for + /// [status] to target specific types of users. static String users([String status = '']) { if(status.isEmpty) { return 'users'; @@ -21,10 +33,17 @@ class Role { return 'users/$status'; } + /// Grants access to any guest user without a session. + /// + /// Authenticated users don't have access to this role. static String guests() { return 'guests'; } + /// Grants access to a team by team ID. + /// + /// You can optionally pass a role for [role] to target + /// team members with the specified role. static String team(String id, [String role = '']) { if(role.isEmpty) { return 'team:$id'; @@ -32,6 +51,10 @@ class Role { return 'team:$id/$role'; } + /// Grants access to a specific member of a team. + /// + /// When the member is removed from the team, they will + /// no longer have access. static String member(String id) { return 'member:$id'; } diff --git a/lib/services/account.dart b/lib/services/account.dart index 96ba5bc..61118f2 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,13 +1,13 @@ part of appwrite; - /// The Account service allows you to authenticate and manage a user account. +/// The Account service allows you to authenticate and manage a user account. class Account extends Service { + /// Initializes a [Account] service Account(super.client); /// Get Account /// /// Get currently logged in user data as JSON object. - /// Future get() async { const String path = '/account'; @@ -32,7 +32,6 @@ class Account extends Service { /// route to start verifying the user email address. To allow the new user to /// login to their new account, you need to create a new [account /// session](/docs/client/account#accountCreateSession). - /// Future create({required String userId, required String email, required String password, String? name}) async { const String path = '/account'; @@ -63,7 +62,6 @@ class Account extends Service { /// This endpoint can also be used to convert an anonymous account to a normal /// one, by passing an email address and a new password. /// - /// Future updateEmail({required String email, required String password}) async { const String path = '/account/email'; @@ -89,7 +87,6 @@ class Account extends Service { /// Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes /// from its creation and will be invalid if the user will logout in that time /// frame. - /// Future createJWT() async { const String path = '/account/jwt'; @@ -110,7 +107,6 @@ class Account extends Service { /// /// Get currently logged in user list of latest security activity logs. Each /// log returns user IP address, location and date and time of log. - /// Future listLogs({List? queries}) async { const String path = '/account/logs'; @@ -131,7 +127,6 @@ class Account extends Service { /// Update Name /// /// Update currently logged in user account name. - /// Future updateName({required String name}) async { const String path = '/account/name'; @@ -154,7 +149,6 @@ class Account extends Service { /// Update currently logged in user password. For validation, user is required /// to pass in the new password, and the old password. For users created with /// OAuth, Team Invites and Magic URL, oldPassword is optional. - /// Future updatePassword({required String password, String? oldPassword}) async { const String path = '/account/password'; @@ -180,7 +174,6 @@ class Account extends Service { /// SMS is not sent automatically, however you can use the [POST /// /account/verification/phone](/docs/client/account#accountCreatePhoneVerification) /// endpoint to send a confirmation SMS. - /// Future updatePhone({required String phone, required String password}) async { const String path = '/account/phone'; @@ -202,7 +195,6 @@ class Account extends Service { /// Get Account Preferences /// /// Get currently logged in user preferences as a key-value object. - /// Future getPrefs() async { const String path = '/account/prefs'; @@ -224,7 +216,6 @@ class Account extends Service { /// Update currently logged in user account preferences. The object you pass is /// stored as is, and replaces any previous value. The maximum allowed prefs /// size is 64kB and throws error if exceeded. - /// Future updatePrefs({required Map prefs}) async { const String path = '/account/prefs'; @@ -252,7 +243,6 @@ class Account extends Service { /// /account/recovery](/docs/client/account#accountUpdateRecovery) endpoint to /// complete the process. The verification link sent to the user's email /// address is valid for 1 hour. - /// Future createRecovery({required String email, required String url}) async { const String path = '/account/recovery'; @@ -282,7 +272,6 @@ class Account extends Service { /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) /// the only valid redirect URLs are the ones from domains you have set when /// adding your platforms in the console interface. - /// Future updateRecovery({required String userId, required String secret, required String password, required String passwordAgain}) async { const String path = '/account/recovery'; @@ -307,7 +296,6 @@ class Account extends Service { /// /// Get currently logged in user list of active sessions across different /// devices. - /// Future listSessions() async { const String path = '/account/sessions'; @@ -328,7 +316,6 @@ class Account extends Service { /// /// Delete all sessions from the user account and remove any sessions cookies /// from the end client. - /// Future deleteSessions() async { const String path = '/account/sessions'; @@ -353,7 +340,6 @@ class Account extends Service { /// need to update its [email and /// password](/docs/client/account#accountUpdateEmail) or create an [OAuth2 /// session](/docs/client/account#accountCreateOAuth2Session). - /// Future createAnonymousSession() async { const String path = '/account/sessions/anonymous'; @@ -377,7 +363,6 @@ class Account extends Service { /// /// A user is limited to 10 active sessions at a time by default. [Learn more /// about session limits](/docs/authentication-security#limits). - /// Future createEmailSession({required String email, required String password}) async { const String path = '/account/sessions/email'; @@ -412,7 +397,6 @@ class Account extends Service { /// /// A user is limited to 10 active sessions at a time by default. [Learn more /// about session limits](/docs/authentication-security#limits). - /// Future createMagicURLSession({required String userId, required String email, String? url}) async { const String path = '/account/sessions/magic-url'; @@ -445,7 +429,6 @@ class Account extends Service { /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) /// the only valid redirect URLs are the ones from domains you have set when /// adding your platforms in the console interface. - /// Future updateMagicURLSession({required String userId, required String secret}) async { const String path = '/account/sessions/magic-url'; @@ -481,7 +464,6 @@ class Account extends Service { /// A user is limited to 10 active sessions at a time by default. [Learn more /// about session limits](/docs/authentication-security#limits). /// - /// Future createOAuth2Session({required String provider, String? success, String? failure, List? scopes}) async { final String path = '/account/sessions/oauth2/{provider}'.replaceAll('{provider}', provider); @@ -528,7 +510,6 @@ class Account extends Service { /// /// A user is limited to 10 active sessions at a time by default. [Learn more /// about session limits](/docs/authentication-security#limits). - /// Future createPhoneSession({required String userId, required String phone}) async { const String path = '/account/sessions/phone'; @@ -554,7 +535,6 @@ class Account extends Service { /// [createPhoneSession](/docs/client/account#accountCreatePhoneSession) /// endpoint and the **secret** received via SMS to successfully update and /// confirm the phone session. - /// Future updatePhoneSession({required String userId, required String secret}) async { const String path = '/account/sessions/phone'; @@ -577,7 +557,6 @@ class Account extends Service { /// /// Use this endpoint to get a logged in user's session using a Session ID. /// Inputting 'current' will return the current session being used. - /// Future getSession({required String sessionId}) async { final String path = '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); @@ -599,7 +578,6 @@ class Account extends Service { /// Access tokens have limited lifespan and expire to mitigate security risks. /// If session was created using an OAuth provider, this route can be used to /// "refresh" the access token. - /// Future updateSession({required String sessionId}) async { final String path = '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); @@ -622,7 +600,6 @@ class Account extends Service { /// account sessions across all of their different devices. When using the /// Session ID argument, only the unique session ID provided is deleted. /// - /// Future deleteSession({required String sessionId}) async { final String path = '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); @@ -644,7 +621,6 @@ class Account extends Service { /// Block the currently logged in user account. Behind the scene, the user /// record is not deleted but permanently blocked from any access. To /// completely delete a user, use the Users API instead. - /// Future updateStatus() async { const String path = '/account/status'; @@ -678,7 +654,6 @@ class Account extends Service { /// the only valid redirect URLs are the ones from domains you have set when /// adding your platforms in the console interface. /// - /// Future createVerification({required String url}) async { const String path = '/account/verification'; @@ -702,7 +677,6 @@ class Account extends Service { /// the **userId** and **secret** parameters that were attached to your app URL /// to verify the user email ownership. If confirmed this route will return a /// 200 status code. - /// Future updateVerification({required String userId, required String secret}) async { const String path = '/account/verification'; @@ -729,7 +703,6 @@ class Account extends Service { /// endpoint. Learn more about how to [complete the verification /// process](/docs/client/account#accountUpdatePhoneVerification). The /// verification code sent to the user's phone number is valid for 15 minutes. - /// Future createPhoneVerification() async { const String path = '/account/verification/phone'; @@ -752,7 +725,6 @@ class Account extends Service { /// **userId** and **secret** that were sent to your user's phone number to /// verify the user email ownership. If confirmed this route will return a 200 /// status code. - /// Future updatePhoneVerification({required String userId, required String secret}) async { const String path = '/account/verification/phone'; diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index 6962ff5..f5edcba 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,8 +1,9 @@ part of appwrite; - /// The Avatars service aims to help you complete everyday tasks related to - /// your app image, icons, and avatars. +/// The Avatars service aims to help you complete everyday tasks related to +/// your app image, icons, and avatars. class Avatars extends Service { + /// Initializes a [Avatars] service Avatars(super.client); /// Get Browser Icon @@ -16,7 +17,6 @@ class Avatars extends Service { /// with preserved aspect ratio. If both dimensions are 0, the API provides an /// image at source quality. If dimensions are not specified, the default size /// of image returned is 100x100px. - /// Future getBrowser({required String code, int? width, int? height, int? quality}) async { final String path = '/avatars/browsers/{code}'.replaceAll('{code}', code); @@ -44,7 +44,6 @@ class Avatars extends Service { /// image at source quality. If dimensions are not specified, the default size /// of image returned is 100x100px. /// - /// Future getCreditCard({required String code, int? width, int? height, int? quality}) async { final String path = '/avatars/credit-cards/{code}'.replaceAll('{code}', code); @@ -66,7 +65,6 @@ class Avatars extends Service { /// Use this endpoint to fetch the favorite icon (AKA favicon) of any remote /// website URL. /// - /// Future getFavicon({required String url}) async { const String path = '/avatars/favicon'; @@ -93,7 +91,6 @@ class Avatars extends Service { /// image at source quality. If dimensions are not specified, the default size /// of image returned is 100x100px. /// - /// Future getFlag({required String code, int? width, int? height, int? quality}) async { final String path = '/avatars/flags/{code}'.replaceAll('{code}', code); @@ -122,7 +119,6 @@ class Avatars extends Service { /// image at source quality. If dimensions are not specified, the default size /// of image returned is 400x400px. /// - /// Future getImage({required String url, int? width, int? height}) async { const String path = '/avatars/image'; @@ -157,7 +153,6 @@ class Avatars extends Service { /// image at source quality. If dimensions are not specified, the default size /// of image returned is 100x100px. /// - /// Future getInitials({String? name, int? width, int? height, String? background}) async { const String path = '/avatars/initials'; @@ -180,7 +175,6 @@ class Avatars extends Service { /// Converts a given plain text to a QR code image. You can use the query /// parameters to change the size and style of the resulting image. /// - /// Future getQR({required String text, int? size, int? margin, bool? download}) async { const String path = '/avatars/qr'; diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 03e4d20..fe42763 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,15 +1,15 @@ part of appwrite; - /// The Databases service allows you to create structured collections of - /// documents, query and filter lists of documents +/// The Databases service allows you to create structured collections of +/// documents, query and filter lists of documents class Databases extends Service { + /// Initializes a [Databases] service Databases(super.client); /// List Documents /// /// Get a list of all the user's documents in a given collection. You can use /// the query params to filter your results. - /// Future listDocuments({required String databaseId, required String collectionId, List? queries}) async { final String path = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); @@ -33,7 +33,6 @@ class Databases extends Service { /// collection resource using either a [server /// integration](/docs/server/databases#databasesCreateCollection) API or /// directly from your database console. - /// Future createDocument({required String databaseId, required String collectionId, required String documentId, required Map data, List? permissions}) async { final String path = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); @@ -57,7 +56,6 @@ class Databases extends Service { /// /// Get a document by its unique ID. This endpoint response returns a JSON /// object with the document data. - /// Future getDocument({required String databaseId, required String collectionId, required String documentId, List? queries}) async { final String path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); @@ -79,7 +77,6 @@ class Databases extends Service { /// /// Update a document by its unique ID. Using the patch method you can pass /// only specific fields that will get updated. - /// Future updateDocument({required String databaseId, required String collectionId, required String documentId, Map? data, List? permissions}) async { final String path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); @@ -101,7 +98,6 @@ class Databases extends Service { /// Delete Document /// /// Delete a document by its unique ID. - /// Future deleteDocument({required String databaseId, required String collectionId, required String documentId}) async { final String path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); diff --git a/lib/services/functions.dart b/lib/services/functions.dart index 7cb2ee0..4433a4d 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,15 +1,15 @@ part of appwrite; - /// The Functions Service allows you view, create and manage your Cloud - /// Functions. +/// The Functions Service allows you view, create and manage your Cloud +/// Functions. class Functions extends Service { + /// Initializes a [Functions] service Functions(super.client); /// List Executions /// /// Get a list of all the current user function execution logs. You can use the /// query params to filter your results. - /// Future listExecutions({required String functionId, List? queries, String? search}) async { final String path = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); @@ -34,7 +34,6 @@ class Functions extends Service { /// current execution status. You can ping the `Get Execution` endpoint to get /// updates on the current execution status. Once this endpoint is called, your /// function execution process will start asynchronously. - /// Future createExecution({required String functionId, String? data, bool? xasync}) async { final String path = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); @@ -56,7 +55,6 @@ class Functions extends Service { /// Get Execution /// /// Get a function execution log by its unique ID. - /// Future getExecution({required String functionId, required String executionId}) async { final String path = '/functions/{functionId}/executions/{executionId}'.replaceAll('{functionId}', functionId).replaceAll('{executionId}', executionId); diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index 6e5b698..9b15ca1 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,14 +1,14 @@ part of appwrite; - /// The GraphQL API allows you to query and mutate your Appwrite server using - /// GraphQL. +/// The GraphQL API allows you to query and mutate your Appwrite server using +/// GraphQL. class Graphql extends Service { + /// Initializes a [Graphql] service Graphql(super.client); /// GraphQL Endpoint /// /// Execute a GraphQL mutation. - /// Future query({required Map query}) async { const String path = '/graphql'; @@ -29,7 +29,6 @@ class Graphql extends Service { /// GraphQL Endpoint /// /// Execute a GraphQL mutation. - /// Future mutation({required Map query}) async { const String path = '/graphql/mutation'; diff --git a/lib/services/locale.dart b/lib/services/locale.dart index 75e104f..06bdff5 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,8 +1,9 @@ part of appwrite; - /// The Locale service allows you to customize your app based on your users' - /// location. +/// The Locale service allows you to customize your app based on your users' +/// location. class Locale extends Service { + /// Initializes a [Locale] service Locale(super.client); /// Get User Locale @@ -13,7 +14,6 @@ class Locale extends Service { /// supported language. /// /// ([IP Geolocation by DB-IP](https://db-ip.com)) - /// Future get() async { const String path = '/locale'; @@ -34,7 +34,6 @@ class Locale extends Service { /// /// List of all continents. You can use the locale header to get the data in a /// supported language. - /// Future listContinents() async { const String path = '/locale/continents'; @@ -55,7 +54,6 @@ class Locale extends Service { /// /// List of all countries. You can use the locale header to get the data in a /// supported language. - /// Future listCountries() async { const String path = '/locale/countries'; @@ -76,7 +74,6 @@ class Locale extends Service { /// /// List of all countries that are currently members of the EU. You can use the /// locale header to get the data in a supported language. - /// Future listCountriesEU() async { const String path = '/locale/countries/eu'; @@ -97,7 +94,6 @@ class Locale extends Service { /// /// List of all countries phone codes. You can use the locale header to get the /// data in a supported language. - /// Future listCountriesPhones() async { const String path = '/locale/countries/phones'; @@ -119,7 +115,6 @@ class Locale extends Service { /// List of all currencies, including currency symbol, name, plural, and /// decimal digits for all major and minor currencies. You can use the locale /// header to get the data in a supported language. - /// Future listCurrencies() async { const String path = '/locale/currencies'; @@ -140,7 +135,6 @@ class Locale extends Service { /// /// List of all languages classified by ISO 639-1 including 2-letter code, name /// in English, and name in the respective language. - /// Future listLanguages() async { const String path = '/locale/languages'; diff --git a/lib/services/storage.dart b/lib/services/storage.dart index 23d0922..e536758 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,14 +1,14 @@ part of appwrite; - /// The Storage service allows you to manage your project files. +/// The Storage service allows you to manage your project files. class Storage extends Service { + /// Initializes a [Storage] service Storage(super.client); /// List Files /// /// Get a list of all the user files. You can use the query params to filter /// your results. - /// Future listFiles({required String bucketId, List? queries, String? search}) async { final String path = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); @@ -47,7 +47,6 @@ class Storage extends Service { /// If you're creating a new file using one of the Appwrite SDKs, all the /// chunking logic will be managed by the SDK internally. /// - /// Future createFile({required String bucketId, required String fileId, required InputFile file, List? permissions, Function(UploadProgress)? onProgress}) async { final String path = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); @@ -83,7 +82,6 @@ class Storage extends Service { /// /// Get a file by its unique ID. This endpoint response returns a JSON object /// with the file metadata. - /// Future getFile({required String bucketId, required String fileId}) async { final String path = '/storage/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); @@ -104,7 +102,6 @@ class Storage extends Service { /// /// Update a file by its unique ID. Only users with write permissions have /// access to update this resource. - /// Future updateFile({required String bucketId, required String fileId, List? permissions}) async { final String path = '/storage/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); @@ -126,7 +123,6 @@ class Storage extends Service { /// /// Delete a file by its unique ID. Only users with write permissions have /// access to delete this resource. - /// Future deleteFile({required String bucketId, required String fileId}) async { final String path = '/storage/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); @@ -148,7 +144,6 @@ class Storage extends Service { /// Get a file content by its unique ID. The endpoint response return with a /// 'Content-Disposition: attachment' header that tells the browser to start /// downloading the file to user downloads directory. - /// Future getFileDownload({required String bucketId, required String fileId}) async { final String path = '/storage/buckets/{bucketId}/files/{fileId}/download'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); @@ -169,7 +164,6 @@ class Storage extends Service { /// and spreadsheets, will return the file icon image. You can also pass query /// string arguments for cutting and resizing your preview image. Preview is /// supported only for image files smaller than 10MB. - /// Future getFilePreview({required String bucketId, required String fileId, int? width, int? height, String? gravity, int? quality, int? borderWidth, String? borderColor, int? borderRadius, double? opacity, int? rotation, String? background, String? output}) async { final String path = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); @@ -199,7 +193,6 @@ class Storage extends Service { /// Get a file content by its unique ID. This endpoint is similar to the /// download method but returns with no 'Content-Disposition: attachment' /// header. - /// Future getFileView({required String bucketId, required String fileId}) async { final String path = '/storage/buckets/{bucketId}/files/{fileId}/view'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); diff --git a/lib/services/teams.dart b/lib/services/teams.dart index 3296843..1b97616 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,15 +1,15 @@ part of appwrite; - /// The Teams service allows you to group users of your project and to enable - /// them to share read and write access to your project resources +/// The Teams service allows you to group users of your project and to enable +/// them to share read and write access to your project resources class Teams extends Service { + /// Initializes a [Teams] service Teams(super.client); /// List Teams /// /// Get a list of all the teams in which the current user is a member. You can /// use the parameters to filter your results. - /// Future list({List? queries, String? search}) async { const String path = '/teams'; @@ -33,7 +33,6 @@ class Teams extends Service { /// Create a new team. The user who creates the team will automatically be /// assigned as the owner of the team. Only the users with the owner role can /// invite new members, add new owners and delete or update the team. - /// Future create({required String teamId, required String name, List? roles}) async { const String path = '/teams'; @@ -56,7 +55,6 @@ class Teams extends Service { /// Get Team /// /// Get a team by its ID. All team members have read access for this resource. - /// Future get({required String teamId}) async { final String path = '/teams/{teamId}'.replaceAll('{teamId}', teamId); @@ -76,7 +74,6 @@ class Teams extends Service { /// Update Name /// /// Update the team's name by its unique ID. - /// Future updateName({required String teamId, required String name}) async { final String path = '/teams/{teamId}'.replaceAll('{teamId}', teamId); @@ -98,7 +95,6 @@ class Teams extends Service { /// /// Delete a team using its ID. Only team members with the owner role can /// delete the team. - /// Future delete({required String teamId}) async { final String path = '/teams/{teamId}'.replaceAll('{teamId}', teamId); @@ -119,7 +115,6 @@ class Teams extends Service { /// /// Use this endpoint to list a team's members using the team's ID. All team /// members have read access to this endpoint. - /// Future listMemberships({required String teamId, List? queries, String? search}) async { final String path = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); @@ -161,7 +156,6 @@ class Teams extends Service { /// Appwrite will accept the only redirect URLs under the domains you have /// added as a platform on the Appwrite Console. /// - /// Future createMembership({required String teamId, required List roles, required String url, String? email, String? userId, String? phone, String? name}) async { final String path = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); @@ -188,7 +182,6 @@ class Teams extends Service { /// /// Get a team member by the membership unique id. All team members have read /// access for this resource. - /// Future getMembership({required String teamId, required String membershipId}) async { final String path = '/teams/{teamId}/memberships/{membershipId}'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId); @@ -210,7 +203,6 @@ class Teams extends Service { /// Modify the roles of a team member. Only team members with the owner role /// have access to this endpoint. Learn more about [roles and /// permissions](/docs/permissions). - /// Future updateMembershipRoles({required String teamId, required String membershipId, required List roles}) async { final String path = '/teams/{teamId}/memberships/{membershipId}'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId); @@ -233,7 +225,6 @@ class Teams extends Service { /// This endpoint allows a user to leave a team or for a team owner to delete /// the membership of any other team member. You can also use this endpoint to /// delete a user membership even if it is not accepted. - /// Future deleteMembership({required String teamId, required String membershipId}) async { final String path = '/teams/{teamId}/memberships/{membershipId}'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId); @@ -259,7 +250,6 @@ class Teams extends Service { /// If the request is successful, a session for the user is automatically /// created. /// - /// Future updateMembershipStatus({required String teamId, required String membershipId, required String userId, required String secret}) async { final String path = '/teams/{teamId}/memberships/{membershipId}/status'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId); @@ -283,7 +273,6 @@ class Teams extends Service { /// Get the team's shared preferences by its unique ID. If a preference doesn't /// need to be shared by all team members, prefer storing them in [user /// preferences](/docs/client/account#accountGetPrefs). - /// Future getPrefs({required String teamId}) async { final String path = '/teams/{teamId}/prefs'.replaceAll('{teamId}', teamId); @@ -305,7 +294,6 @@ class Teams extends Service { /// Update the team's preferences by its unique ID. The object you pass is /// stored as is and replaces any previous value. The maximum allowed prefs /// size is 64kB and throws an error if exceeded. - /// Future updatePrefs({required String teamId, required Map prefs}) async { final String path = '/teams/{teamId}/prefs'.replaceAll('{teamId}', teamId); diff --git a/lib/src/client.dart b/lib/src/client.dart index 7b662f8..0104067 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -5,22 +5,32 @@ import 'client_stub.dart' import 'response.dart'; import 'upload_progress.dart'; +/// [Client] that handles requests to Appwrite. +/// +/// The [Client] is also responsible for managing user's sessions. abstract class Client { + /// The size for cunked uploads in bytes. static const int CHUNK_SIZE = 5*1024*1024; + /// Holds configuration such as project. late Map config; late String _endPoint; late String? _endPointRealtime; + /// Appwrite endpoint. String get endPoint => _endPoint; + /// Appwrite realtime endpoint. String? get endPointRealtime => _endPointRealtime; + /// Initializes a [Client]. factory Client( {String endPoint = 'https://HOSTNAME/v1', bool selfSigned = false}) => createClient(endPoint: endPoint, selfSigned: selfSigned); + /// Handle OAuth2 session creation. Future webAuth(Uri url, {String? callbackUrlScheme}); + /// Upload a file in chunks. Future chunkedUpload({ required String path, required Map params, @@ -30,20 +40,36 @@ abstract class Client { Function(UploadProgress)? onProgress, }); + /// Set self signed to [status]. + /// + /// If self signed is true, [Client] will ignore invalid certificates. + /// This is helpful in environments where your Appwrite + /// instance does not have a valid SSL certificate. Client setSelfSigned({bool status = true}); + /// Set the Appwrite endpoint. Client setEndpoint(String endPoint); + /// Set the Appwrite realtime endpoint. Client setEndPointRealtime(String endPoint); - /// Your project ID + /// Set Project. + /// + /// Your project ID. Client setProject(value); - /// Your secret JSON Web Token + + /// Set JWT. + /// + /// Your secret JSON Web Token. Client setJWT(value); + + /// Set Locale. Client setLocale(value); + /// Add headers that should be sent with all API calls. Client addHeader(String key, String value); + /// Send the API request. Future call(HttpMethod method, { String path = '', Map headers = const {}, diff --git a/lib/src/enums.dart b/lib/src/enums.dart index 9f84bd9..6566f2e 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -1,6 +1,8 @@ +/// HTTP methods. enum HttpMethod { get, post, put, delete, patch } extension HttpMethodString on HttpMethod { + /// Returns the HTTP method in all caps. String name() { return toString().split('.').last.toUpperCase(); } diff --git a/lib/src/exception.dart b/lib/src/exception.dart index a5c6a9f..d5ab276 100644 --- a/lib/src/exception.dart +++ b/lib/src/exception.dart @@ -1,11 +1,20 @@ +/// Exception thrown by the appwrite package. class AppwriteException implements Exception { + /// Error message. final String? message; + + /// Error type. + /// + /// See [Error Types](https://appwrite.io/docs/response-codes#errorTypes) + /// for more information. final String? type; final int? code; final dynamic response; + /// Initializes an Appwrite Exception. AppwriteException([this.message = "", this.code, this.type, this.response]); + /// Returns the error type, message, and code. @override String toString() { if (message == null) return "AppwriteException"; diff --git a/lib/src/input_file.dart b/lib/src/input_file.dart index 13c6e75..bb7db00 100644 --- a/lib/src/input_file.dart +++ b/lib/src/input_file.dart @@ -1,5 +1,6 @@ import 'exception.dart'; +/// Helper class to handle files. class InputFile { late final String? path; late final List? bytes; diff --git a/lib/src/realtime.dart b/lib/src/realtime.dart index f30ad0d..fffb7c6 100644 --- a/lib/src/realtime.dart +++ b/lib/src/realtime.dart @@ -5,7 +5,9 @@ import 'realtime_subscription.dart'; import 'service.dart'; import 'client.dart'; +/// Realtime allows you to listen to any events on the server-side in realtime using the subscribe method. abstract class Realtime extends Service { + /// Initializes a [Realtime] service factory Realtime(Client client) => createRealtime(client); /// Subscribes to Appwrite events and returns a `RealtimeSubscription` object, which can be used @@ -42,9 +44,8 @@ abstract class Realtime extends Service { /// RealtimeSubscription subscribe(List channels); - // The [close code][] set when the WebSocket connection is closed. + /// The [close code](https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.5) set when the WebSocket connection is closed. /// /// Before the connection has been closed, this will be `null`. - int? get closeCode => null; } diff --git a/lib/src/realtime_message.dart b/lib/src/realtime_message.dart index 9e7b879..e12b8a4 100644 --- a/lib/src/realtime_message.dart +++ b/lib/src/realtime_message.dart @@ -1,11 +1,24 @@ import 'dart:convert'; import 'package:flutter/foundation.dart'; +/// Realtime Message class RealtimeMessage { + /// All permutations of the system event that triggered this message + /// + /// The first event in the list is the most specfic event without wildcards. final List events; + + /// The data related to the event final Map payload; + + /// All channels that match this event final List channels; + + /// ISO 8601 formatted timestamp in UTC timezone in + /// which the event was sent from Appwrite final String timestamp; + + /// Initializes a [RealtimeMessage] RealtimeMessage({ required this.events, required this.payload, @@ -13,6 +26,7 @@ class RealtimeMessage { required this.timestamp, }); + /// Returns a copy of this [RealtimeMessage] with specified attributes overridden. RealtimeMessage copyWith({ List? events, Map? payload, @@ -27,6 +41,7 @@ class RealtimeMessage { ); } + /// Returns a [Map] representation of this [RealtimeMessage]. Map toMap() { return { 'events': events, @@ -36,6 +51,7 @@ class RealtimeMessage { }; } + /// Initializes a [RealtimeMessage] from a [Map]. factory RealtimeMessage.fromMap(Map map) { return RealtimeMessage( events: List.from(map['events'] ?? []), @@ -45,11 +61,14 @@ class RealtimeMessage { ); } + /// Converts a [RealtimeMessage] to a JSON [String]. String toJson() => json.encode(toMap()); + /// Initializes a [RealtimeMessage] from a JSON [String]. factory RealtimeMessage.fromJson(String source) => RealtimeMessage.fromMap(json.decode(source)); + /// Returns a string representation of this [RealtimeMessage]. @override String toString() { return 'RealtimeMessage(events: $events, payload: $payload, channels: $channels, timestamp: $timestamp)'; diff --git a/lib/src/realtime_subscription.dart b/lib/src/realtime_subscription.dart index b36a862..e45d3b4 100644 --- a/lib/src/realtime_subscription.dart +++ b/lib/src/realtime_subscription.dart @@ -1,8 +1,13 @@ import 'realtime_message.dart'; +/// Realtime Subscription class RealtimeSubscription { + /// Stream of [RealtimeMessage]s final Stream stream; + + /// Closes the subscription final Future Function() close; + /// Initializes a [RealtimeSubscription] RealtimeSubscription({required this.stream, required this.close}); } diff --git a/lib/src/response.dart b/lib/src/response.dart index bf4eea3..ff7d14b 100644 --- a/lib/src/response.dart +++ b/lib/src/response.dart @@ -1,8 +1,11 @@ import 'dart:convert'; +/// Appwrite Response class Response { + /// Initializes a [Response] Response({this.data}); + /// HTTP body returned from Appwrite T? data; @override diff --git a/lib/src/upload_progress.dart b/lib/src/upload_progress.dart index 4ed965d..44cde38 100644 --- a/lib/src/upload_progress.dart +++ b/lib/src/upload_progress.dart @@ -1,11 +1,23 @@ import 'dart:convert'; +/// Progress of a File Upload class UploadProgress { + /// ID of the file. final String $id; + + /// Progress percentage. final double progress; + + /// Size uploaded in bytes. final int sizeUploaded; + + /// Total number of chunks. final int chunksTotal; + + /// Number of chunks uploaded. final int chunksUploaded; + + /// Initializes an [UploadProgress] UploadProgress({ required this.$id, required this.progress, @@ -14,6 +26,7 @@ class UploadProgress { required this.chunksUploaded, }); + /// Initializes an [UploadProgress] from a [Map] factory UploadProgress.fromMap(Map map) { return UploadProgress( $id: map['\$id'] ?? '', @@ -24,6 +37,7 @@ class UploadProgress { ); } + /// Converts an [UploadProgress] to a [Map] Map toMap() { return { "\$id": $id, @@ -34,11 +48,14 @@ class UploadProgress { }; } + /// Converts an [UploadProgress] to a JSON [String] String toJson() => json.encode(toMap()); + /// Initializes an [UploadProgress] from a JSON [String] factory UploadProgress.fromJson(String source) => UploadProgress.fromMap(json.decode(source)); + /// Returns a string representation of an [UploadProgress] @override String toString() { return 'UploadProgress(\$id: ${$id}, progress: $progress, sizeUploaded: $sizeUploaded, chunksTotal: $chunksTotal, chunksUploaded: $chunksUploaded)'; diff --git a/pubspec.yaml b/pubspec.yaml index c6d328c..23fd825 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,17 +18,17 @@ environment: dependencies: flutter: sdk: flutter - cookie_jar: ^3.0.1 - device_info_plus: ^8.1.0 - flutter_web_auth_2: ^2.0.4 - http: ^0.13.5 - package_info_plus: ^3.0.3 - path_provider: ^2.0.13 - web_socket_channel: ^2.3.0 - universal_html: ^2.0.9 + cookie_jar: ^4.0.3 + device_info_plus: ^9.0.2 + flutter_web_auth_2: ^2.1.4 + http: '>=0.13.6 <1.0.1' + package_info_plus: ^4.0.2 + path_provider: ^2.0.15 + web_socket_channel: ^2.4.0 + universal_html: ^2.2.2 dev_dependencies: - path_provider_platform_interface: ^2.0.5 + path_provider_platform_interface: ^2.0.6 flutter_lints: ^2.0.1 flutter_test: sdk: flutter