Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions examples/1.9.x/client-android/java/avatars/get-photo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
```java
import android.util.Log;

import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Avatars;

Client client = new Client(context)
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>"); // Your project ID

Avatars avatars = new Avatars(client);

avatars.getPhoto(
0, // width (optional)
0, // height (optional)
0, // quality (optional)
"png", // output (optional)
"g", // rating (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}

Log.d("Appwrite", result.toString());
})
);

```
19 changes: 19 additions & 0 deletions examples/1.9.x/client-android/kotlin/avatars/get-photo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```kotlin
import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Avatars

val client = Client(context)
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

val avatars = Avatars(client)

val result = avatars.getPhoto(
width = 0, // (optional)
height = 0, // (optional)
quality = 0, // (optional)
output = "png", // (optional)
rating = "g", // (optional)
)
```
18 changes: 18 additions & 0 deletions examples/1.9.x/client-apple/examples/avatars/get-photo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```swift
import Appwrite

let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let avatars = Avatars(client)

let bytes = try await avatars.getPhoto(
width: 0, // optional
height: 0, // optional
quality: 0, // optional
output: "png", // optional
rating: "g" // optional
)

```
40 changes: 40 additions & 0 deletions examples/1.9.x/client-flutter/examples/avatars/get-photo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
```dart
import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:appwrite/appwrite.dart';

Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

Avatars avatars = Avatars(client);

// Downloading file
Uint8List bytes = await avatars.getPhoto(
width: 0, // optional
height: 0, // optional
quality: 0, // optional
output: 'png', // optional
rating: 'g', // optional
);

final file = File('path_to_file/filename.ext');
file.writeAsBytesSync(bytes);

// Displaying image preview
FutureBuilder<Uint8List>(
future: avatars.getPhoto(
width: 0, // optional
height: 0, // optional
quality: 0, // optional
output: 'png', // optional
rating: 'g', // optional
), // Works for both public file and private file, for private files you need to be logged in
builder: (context, snapshot) {
return snapshot.hasData && snapshot.data != null
? Image.memory(snapshot.data!)
: const CircularProgressIndicator();
},
);
```
13 changes: 13 additions & 0 deletions examples/1.9.x/client-graphql/examples/avatars/get-photo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
```graphql
query {
avatarsGetPhoto(
width: 0,
height: 0,
quality: 0,
output: "png",
rating: "g"
) {
status
}
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ query {
longitude: -122.4194,
accuracy: 100,
touch: true,
permissions: ["geolocation","notifications"],
permissions: ["geolocation", "notifications"],
sleep: 3,
width: 800,
height: 600,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mutation {
collectionId: "<COLLECTION_ID>",
documentId: "<DOCUMENT_ID>",
data: "{\"username\":\"walter.obrien\",\"email\":\"walter.obrien@example.com\",\"fullName\":\"Walter O'Brien\",\"age\":30,\"isAdmin\":false}",
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
transactionId: "<TRANSACTION_ID>"
) {
_id
Expand All @@ -24,7 +24,7 @@ mutation {
collectionId: "<COLLECTION_ID>",
documentId: "<DOCUMENT_ID>",
data: "{\"username\":\"walter.obrien\",\"email\":\"walter.obrien@example.com\",\"fullName\":\"Walter O'Brien\",\"age\":30,\"isAdmin\":false}",
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
transactionId: "<TRANSACTION_ID>"
) {
_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mutation {
collectionId: "<COLLECTION_ID>",
documentId: "<DOCUMENT_ID>",
data: "{\"username\":\"walter.obrien\",\"email\":\"walter.obrien@example.com\",\"fullName\":\"Walter O'Brien\",\"age\":33,\"isAdmin\":false}",
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
transactionId: "<TRANSACTION_ID>"
) {
_id
Expand All @@ -24,7 +24,7 @@ mutation {
collectionId: "<COLLECTION_ID>",
documentId: "<DOCUMENT_ID>",
data: "{\"username\":\"walter.obrien\",\"email\":\"walter.obrien@example.com\",\"fullName\":\"Walter O'Brien\",\"age\":33,\"isAdmin\":false}",
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
transactionId: "<TRANSACTION_ID>"
) {
_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mutation {
collectionId: "<COLLECTION_ID>",
documentId: "<DOCUMENT_ID>",
data: "{\"username\":\"walter.obrien\",\"email\":\"walter.obrien@example.com\",\"fullName\":\"Walter O'Brien\",\"age\":30,\"isAdmin\":false}",
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
transactionId: "<TRANSACTION_ID>"
) {
_id
Expand All @@ -24,7 +24,7 @@ mutation {
collectionId: "<COLLECTION_ID>",
documentId: "<DOCUMENT_ID>",
data: "{\"username\":\"walter.obrien\",\"email\":\"walter.obrien@example.com\",\"fullName\":\"Walter O'Brien\",\"age\":30,\"isAdmin\":false}",
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
transactionId: "<TRANSACTION_ID>"
) {
_id
Expand Down
4 changes: 2 additions & 2 deletions examples/1.9.x/client-graphql/examples/presences/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mutation {
status: "<STATUS>",
expiresAt: "2020-10-15T06:38:00.000+00:00",
metadata: "{}",
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
purge: false
) {
_id
Expand All @@ -25,7 +25,7 @@ mutation {
status: "<STATUS>",
expiresAt: "2020-10-15T06:38:00.000+00:00",
metadata: "{}",
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
purge: false
) {
_id
Expand Down
4 changes: 2 additions & 2 deletions examples/1.9.x/client-graphql/examples/presences/upsert.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mutation {
presencesUpsert(
presenceId: "<PRESENCE_ID>",
status: "<STATUS>",
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
expiresAt: "2020-10-15T06:38:00.000+00:00",
metadata: "{}"
) {
Expand All @@ -22,7 +22,7 @@ mutation {
presencesUpsert(
presenceId: "<PRESENCE_ID>",
status: "<STATUS>",
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
expiresAt: "2020-10-15T06:38:00.000+00:00",
metadata: "{}"
) {
Expand Down
4 changes: 2 additions & 2 deletions examples/1.9.x/client-graphql/examples/storage/create-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Content-Length: *Length of your entity body in bytes*
--cec8e8123c05ba25
Content-Disposition: form-data; name="operations"

{ "query": "mutation { storageCreateFile(bucketId: $bucketId, fileId: $fileId, file: $file, permissions: $permissions, folder: $folder) { id }" }, "variables": { "bucketId": "<BUCKET_ID>", "fileId": "<FILE_ID>", "file": null, "permissions": ["read("any")"], "folder": "" } }
{ "query": "mutation { storageCreateFile(bucketId: $bucketId, fileId: $fileId, file: $file, permissions: $permissions, folder: $folder) { id }" }, "variables": { "bucketId": "<BUCKET_ID>", "fileId": "<FILE_ID>", "file": null, "permissions": ["read(\"any\")"], "folder": "" } }

--cec8e8123c05ba25
Content-Disposition: form-data; name="map"
Expand All @@ -28,7 +28,7 @@ mutation {
bucketId: "<BUCKET_ID>",
fileId: "<FILE_ID>",
file: null,
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
folder: ""
) {
_id
Expand Down
4 changes: 2 additions & 2 deletions examples/1.9.x/client-graphql/examples/storage/update-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mutation {
bucketId: "<BUCKET_ID>",
fileId: "<FILE_ID>",
name: "<NAME>",
permissions: ["read("any")"]
permissions: ["read(\"any\")"]
) {
_id
bucketId
Expand All @@ -29,7 +29,7 @@ mutation {
bucketId: "<BUCKET_ID>",
fileId: "<FILE_ID>",
name: "<NAME>",
permissions: ["read("any")"]
permissions: ["read(\"any\")"]
) {
_id
bucketId
Expand Down
4 changes: 2 additions & 2 deletions examples/1.9.x/client-graphql/examples/tablesdb/create-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mutation {
tableId: "<TABLE_ID>",
rowId: "<ROW_ID>",
data: "{\"username\":\"walter.obrien\",\"email\":\"walter.obrien@example.com\",\"fullName\":\"Walter O'Brien\",\"age\":30,\"isAdmin\":false}",
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
transactionId: "<TRANSACTION_ID>"
) {
_id
Expand All @@ -24,7 +24,7 @@ mutation {
tableId: "<TABLE_ID>",
rowId: "<ROW_ID>",
data: "{\"username\":\"walter.obrien\",\"email\":\"walter.obrien@example.com\",\"fullName\":\"Walter O'Brien\",\"age\":30,\"isAdmin\":false}",
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
transactionId: "<TRANSACTION_ID>"
) {
_id
Expand Down
4 changes: 2 additions & 2 deletions examples/1.9.x/client-graphql/examples/tablesdb/update-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mutation {
tableId: "<TABLE_ID>",
rowId: "<ROW_ID>",
data: "{\"username\":\"walter.obrien\",\"email\":\"walter.obrien@example.com\",\"fullName\":\"Walter O'Brien\",\"age\":33,\"isAdmin\":false}",
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
transactionId: "<TRANSACTION_ID>"
) {
_id
Expand All @@ -24,7 +24,7 @@ mutation {
tableId: "<TABLE_ID>",
rowId: "<ROW_ID>",
data: "{\"username\":\"walter.obrien\",\"email\":\"walter.obrien@example.com\",\"fullName\":\"Walter O'Brien\",\"age\":33,\"isAdmin\":false}",
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
transactionId: "<TRANSACTION_ID>"
) {
_id
Expand Down
4 changes: 2 additions & 2 deletions examples/1.9.x/client-graphql/examples/tablesdb/upsert-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mutation {
tableId: "<TABLE_ID>",
rowId: "<ROW_ID>",
data: "{\"username\":\"walter.obrien\",\"email\":\"walter.obrien@example.com\",\"fullName\":\"Walter O'Brien\",\"age\":33,\"isAdmin\":false}",
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
transactionId: "<TRANSACTION_ID>"
) {
_id
Expand All @@ -24,7 +24,7 @@ mutation {
tableId: "<TABLE_ID>",
rowId: "<ROW_ID>",
data: "{\"username\":\"walter.obrien\",\"email\":\"walter.obrien@example.com\",\"fullName\":\"Walter O'Brien\",\"age\":33,\"isAdmin\":false}",
permissions: ["read("any")"],
permissions: ["read(\"any\")"],
transactionId: "<TRANSACTION_ID>"
) {
_id
Expand Down
19 changes: 19 additions & 0 deletions examples/1.9.x/client-react-native/examples/avatars/get-photo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```javascript
import { Client, Avatars } from "react-native-appwrite";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const avatars = new Avatars(client);

const result = avatars.getPhoto({
width: 0, // optional
height: 0, // optional
quality: 0, // optional
output: 'png', // optional
rating: 'g' // optional
});

console.log(result);
```
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const result = await databases.createDocument({
"age": 30,
"isAdmin": false
},
permissions: ["read("any")"], // optional
permissions: ["read(\"any\")"], // optional
transactionId: '<TRANSACTION_ID>' // optional
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const result = await databases.updateDocument({
"age": 33,
"isAdmin": false
}, // optional
permissions: ["read("any")"], // optional
permissions: ["read(\"any\")"], // optional
transactionId: '<TRANSACTION_ID>' // optional
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const result = await databases.upsertDocument({
"age": 30,
"isAdmin": false
}, // optional
permissions: ["read("any")"], // optional
permissions: ["read(\"any\")"], // optional
transactionId: '<TRANSACTION_ID>' // optional
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const result = await presences.update({
status: '<STATUS>', // optional
expiresAt: '2020-10-15T06:38:00.000+00:00', // optional
metadata: {}, // optional
permissions: ["read("any")"], // optional
permissions: ["read(\"any\")"], // optional
purge: false // optional
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const presences = new Presences(client);
const result = await presences.upsert({
presenceId: '<PRESENCE_ID>',
status: '<STATUS>',
permissions: ["read("any")"], // optional
permissions: ["read(\"any\")"], // optional
expiresAt: '2020-10-15T06:38:00.000+00:00', // optional
metadata: {} // optional
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const result = await storage.createFile({
bucketId: '<BUCKET_ID>',
fileId: '<FILE_ID>',
file: InputFile.fromPath('/path/to/file', 'filename'),
permissions: ["read("any")"], // optional
permissions: ["read(\"any\")"], // optional
folder: '' // optional
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const result = await storage.updateFile({
bucketId: '<BUCKET_ID>',
fileId: '<FILE_ID>',
name: '<NAME>', // optional
permissions: ["read("any")"] // optional
permissions: ["read(\"any\")"] // optional
});

console.log(result);
Expand Down
Loading