From 6c9e805682eefb0d406b6413956429019c6c838a Mon Sep 17 00:00:00 2001 From: Steven <1477010+stnguyen90@users.noreply.github.com> Date: Wed, 14 Sep 2022 12:18:33 -0700 Subject: [PATCH] Change role:all to any in docs --- docs/sdks/cli/GETTING_STARTED.md | 2 +- docs/sdks/dart/EXAMPLES.md | 23 ++++++++++----------- docs/sdks/flutter-dev/EXAMPLES.md | 34 +++++++++++++++++++------------ docs/sdks/flutter/EXAMPLES.md | 26 +++++++++++------------ docs/services/databases.md | 2 +- docs/services/storage.md | 2 +- 6 files changed, 48 insertions(+), 41 deletions(-) diff --git a/docs/sdks/cli/GETTING_STARTED.md b/docs/sdks/cli/GETTING_STARTED.md index 4d0f6fcba78..564fb4d5f99 100644 --- a/docs/sdks/cli/GETTING_STARTED.md +++ b/docs/sdks/cli/GETTING_STARTED.md @@ -98,7 +98,7 @@ $ appwrite users list To create a document you can use the following command ```sh -$ appwrite database createDocument --collectionId --documentId 'unique()' --data '{ "Name": "Iron Man" }' --read role:all team:abc +$ appwrite database createDocument --collectionId --documentId 'unique()' --data '{ "Name": "Iron Man" }' --permissions 'read("any")' 'read("team:abc")' ``` ### Some Gotchas diff --git a/docs/sdks/dart/EXAMPLES.md b/docs/sdks/dart/EXAMPLES.md index a16ba883853..208cc7f7826 100644 --- a/docs/sdks/dart/EXAMPLES.md +++ b/docs/sdks/dart/EXAMPLES.md @@ -3,14 +3,13 @@ Init your Appwrite client: ```dart - Client client = Client(); - - client - .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint - .setProject('5e8cf4f46b5e8') // Your project ID - .setSelfSigned() // Remove in production - ; +Client client = Client(); +client + .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint + .setProject('5e8cf4f46b5e8') // Your project ID + .setSelfSigned() // Remove in production +; ``` Create a new user: @@ -18,12 +17,11 @@ Create a new user: ```dart Users users = Users(client); -Response result = await users.create( +User result = await users.create( userId: '[USER_ID]', email: 'email@example.com', password: 'password', ); - ``` Fetch user profile: @@ -31,7 +29,7 @@ Fetch user profile: ```dart Users users = Users(client); -Response profile = await users.get( +User profile = await users.get( userId: '[USER_ID]', ); ``` @@ -47,8 +45,9 @@ storage.createFile( bucketId: '[BUCKET_ID]', fileId: '[FILE_ID]', // use 'unique()' to automatically generate a unique ID file: file, - read: ['role:all'], - write: [] + permissions: [ + Permission.read(Role.any()), + ], ) .then((response) { print(response); // File uploaded! diff --git a/docs/sdks/flutter-dev/EXAMPLES.md b/docs/sdks/flutter-dev/EXAMPLES.md index ea92ec6e8e1..23b631900ff 100644 --- a/docs/sdks/flutter-dev/EXAMPLES.md +++ b/docs/sdks/flutter-dev/EXAMPLES.md @@ -3,14 +3,13 @@ Init your Appwrite client: ```dart - Client client = Client(); - - client - .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint - .setProject('5e8cf4f46b5e8') // Your project ID - .setSelfSigned() // Remove in production - ; +Client client = Client(); +client + .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint + .setProject('5e8cf4f46b5e8') // Your project ID + .setSelfSigned() // Remove in production +; ``` Create a new user and session: @@ -18,9 +17,9 @@ Create a new user and session: ```dart Account account = Account(client); -Response user = await account.create(email: 'me@appwrite.io', password: 'password', name: 'My Name'); +final user = await account.create(userId: '[USER_ID]', email: 'me@appwrite.io', password: 'password', name: 'My Name'); -Response session = await account.createSession(email: 'me@appwrite.io', password: 'password'); +final session = await account.createEmailSession(email: 'me@appwrite.io', password: 'password'); ``` @@ -29,7 +28,7 @@ Fetch user profile: ```dart Account account = Account(client); -Response profile = await account.get(); +final profile = await account.get(); ``` Upload File: @@ -37,12 +36,21 @@ Upload File: ```dart Storage storage = Storage(client); -MultipartFile file = MultipartFile.fromFile('./path-to-file/image.jpg', filename: 'image.jpg'); +late InputFile file; + +if(kIsWeb) { + file = InputFile(bytes: pickedFile.bytes, filename: 'image.jpg'); +} else { + file = InputFile(path: './path-to-file/image.jpg', filename: 'image.jpg'); +} storage.createFile( + bucketId: '[BUCKET_ID]', + fileId: '[FILE_ID]', // use 'unique()' to automatically generate a unique ID file: file, - read: ['role:all'], - write: [] + permissions: [ + Permission.read(Role.any()), + ], ) .then((response) { print(response); // File uploaded! diff --git a/docs/sdks/flutter/EXAMPLES.md b/docs/sdks/flutter/EXAMPLES.md index c20544439a8..23b631900ff 100644 --- a/docs/sdks/flutter/EXAMPLES.md +++ b/docs/sdks/flutter/EXAMPLES.md @@ -3,14 +3,13 @@ Init your Appwrite client: ```dart - Client client = Client(); - - client - .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint - .setProject('5e8cf4f46b5e8') // Your project ID - .setSelfSigned() // Remove in production - ; +Client client = Client(); +client + .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint + .setProject('5e8cf4f46b5e8') // Your project ID + .setSelfSigned() // Remove in production +; ``` Create a new user and session: @@ -18,9 +17,9 @@ Create a new user and session: ```dart Account account = Account(client); -Response user = await account.create(userId: '[USER_ID]', email: 'me@appwrite.io', password: 'password', name: 'My Name'); +final user = await account.create(userId: '[USER_ID]', email: 'me@appwrite.io', password: 'password', name: 'My Name'); -Response session = await account.createSession(email: 'me@appwrite.io', password: 'password'); +final session = await account.createEmailSession(email: 'me@appwrite.io', password: 'password'); ``` @@ -29,7 +28,7 @@ Fetch user profile: ```dart Account account = Account(client); -Response profile = await account.get(); +final profile = await account.get(); ``` Upload File: @@ -40,7 +39,7 @@ Storage storage = Storage(client); late InputFile file; if(kIsWeb) { - file = InputFile(file: await MultipartFile.fromFile('file', './path-to-file/image.jpg', filename: 'image.jpg')); + file = InputFile(bytes: pickedFile.bytes, filename: 'image.jpg'); } else { file = InputFile(path: './path-to-file/image.jpg', filename: 'image.jpg'); } @@ -49,8 +48,9 @@ storage.createFile( bucketId: '[BUCKET_ID]', fileId: '[FILE_ID]', // use 'unique()' to automatically generate a unique ID file: file, - read: ['role:all'], - write: [] + permissions: [ + Permission.read(Role.any()), + ], ) .then((response) { print(response); // File uploaded! diff --git a/docs/services/databases.md b/docs/services/databases.md index 00076dc8da8..0e32fa6c779 100644 --- a/docs/services/databases.md +++ b/docs/services/databases.md @@ -4,4 +4,4 @@ All data returned by the Databases service are represented as structured JSON do The Databases service can contain multiple databases, each database can contain multiple collections. A collection is a group of similarly structured documents. The accepted structure of documents is defined by [collection attributes](/docs/databases#attributes). The collection attributes help you ensure all your user-submitted data is validated and stored according to the collection structure. -Using Appwrite permissions architecture, you can assign read or write access to each collection or document in your project for either a specific user, team, user role, or even grant it with public access (`role:all`). You can learn more about [how Appwrite handles permissions and access control](/docs/permissions). \ No newline at end of file +Using Appwrite permissions architecture, you can assign read or write access to each collection or document in your project for either a specific user, team, user role, or even grant it with public access (`any`). You can learn more about [how Appwrite handles permissions and access control](/docs/permissions). \ No newline at end of file diff --git a/docs/services/storage.md b/docs/services/storage.md index 54df77891c3..0665128a762 100644 --- a/docs/services/storage.md +++ b/docs/services/storage.md @@ -2,7 +2,7 @@ The Storage service allows you to manage your project files. Using the Storage s Files are managed using buckets. Storage buckets are similar to Collections we have in our [Databases](/docs/databases) service. The difference is, buckets also provide more power to decide what kinds of files, what sizes you want to allow in that bucket, whether or not to encrypt the files, scan with antivirus and more. -Using Appwrite permissions architecture, you can assign read or write access to each bucket or file in your project for either a specific user, team, user role, or even grant it with public access (`role:all`). You can learn more about [how Appwrite handles permissions and access control](/docs/permissions). +Using Appwrite permissions architecture, you can assign read or write access to each bucket or file in your project for either a specific user, team, user role, or even grant it with public access (`any`). You can learn more about [how Appwrite handles permissions and access control](/docs/permissions). The preview endpoint allows you to generate preview images for your files. Using the preview endpoint, you can also manipulate the resulting image so that it will fit perfectly inside your app in terms of dimensions, file size, and style. The preview endpoint also allows you to change the resulting image file format for better compression or image quality for better delivery over the network.