forked from appwrite/appwrite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request appwrite#3841 from appwrite/fix-role-all
Change role:all to any in docs
- Loading branch information
Showing
6 changed files
with
48 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,35 +3,33 @@ | |
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: | ||
|
||
```dart | ||
Users users = Users(client); | ||
Response result = await users.create( | ||
User result = await users.create( | ||
userId: '[USER_ID]', | ||
email: '[email protected]', | ||
password: 'password', | ||
); | ||
``` | ||
|
||
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! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,24 +3,23 @@ | |
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: | ||
|
||
```dart | ||
Account account = Account(client); | ||
Response user = await account.create(email: '[email protected]', password: 'password', name: 'My Name'); | ||
final user = await account.create(userId: '[USER_ID]', email: '[email protected]', password: 'password', name: 'My Name'); | ||
Response session = await account.createSession(email: '[email protected]', password: 'password'); | ||
final session = await account.createEmailSession(email: '[email protected]', password: 'password'); | ||
``` | ||
|
||
|
@@ -29,20 +28,29 @@ Fetch user profile: | |
```dart | ||
Account account = Account(client); | ||
Response profile = await account.get(); | ||
final profile = await account.get(); | ||
``` | ||
|
||
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! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,24 +3,23 @@ | |
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: | ||
|
||
```dart | ||
Account account = Account(client); | ||
Response user = await account.create(userId: '[USER_ID]', email: '[email protected]', password: 'password', name: 'My Name'); | ||
final user = await account.create(userId: '[USER_ID]', email: '[email protected]', password: 'password', name: 'My Name'); | ||
Response session = await account.createSession(email: '[email protected]', password: 'password'); | ||
final session = await account.createEmailSession(email: '[email protected]', 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! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters