1
0
Fork 0
mirror of synced 2024-06-01 18:39:57 +12:00

docs: push new changes

This commit is contained in:
Torsten Dittmann 2022-05-17 13:32:43 +02:00
parent 248df3b13d
commit a07facb66c
28 changed files with 118 additions and 54 deletions

View file

@ -21,7 +21,7 @@ public class MainActivity extends AppCompatActivity {
storage.createFile(
"[BUCKET_ID]",
"[FILE_ID]",
File("./path-to-files/image.jpg"),
File("file.png"),
new Continuation<Object>() {
@NotNull
@Override

View file

@ -20,7 +20,7 @@ class MainActivity : AppCompatActivity() {
val response = storage.createFile(
bucketId = "[BUCKET_ID]",
fileId = "[FILE_ID]",
file = File("./path-to-files/image.jpg"),
file = File("file.png"),
)
val json = response.body?.string()
}

View file

@ -8,9 +8,18 @@ void main() { // Init SDK
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
// downloading file
Future result = avatars.getBrowser(
code: 'aa',
).then((bytes) {
final file = File('path_to_file/filename.ext');
file.writeAsBytesSync(bytes)
}).catchError((error) {
print(error.response);
})
}
//displaying image
//displaying image preview
FutureBuilder(
future: avatars.getBrowser(
code: 'aa',

View file

@ -8,9 +8,18 @@ void main() { // Init SDK
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
// downloading file
Future result = avatars.getCreditCard(
code: 'amex',
).then((bytes) {
final file = File('path_to_file/filename.ext');
file.writeAsBytesSync(bytes)
}).catchError((error) {
print(error.response);
})
}
//displaying image
//displaying image preview
FutureBuilder(
future: avatars.getCreditCard(
code: 'amex',

View file

@ -8,9 +8,18 @@ void main() { // Init SDK
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
// downloading file
Future result = avatars.getFavicon(
url: 'https://example.com',
).then((bytes) {
final file = File('path_to_file/filename.ext');
file.writeAsBytesSync(bytes)
}).catchError((error) {
print(error.response);
})
}
//displaying image
//displaying image preview
FutureBuilder(
future: avatars.getFavicon(
url: 'https://example.com',

View file

@ -8,9 +8,18 @@ void main() { // Init SDK
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
// downloading file
Future result = avatars.getFlag(
code: 'af',
).then((bytes) {
final file = File('path_to_file/filename.ext');
file.writeAsBytesSync(bytes)
}).catchError((error) {
print(error.response);
})
}
//displaying image
//displaying image preview
FutureBuilder(
future: avatars.getFlag(
code: 'af',

View file

@ -8,9 +8,18 @@ void main() { // Init SDK
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
// downloading file
Future result = avatars.getImage(
url: 'https://example.com',
).then((bytes) {
final file = File('path_to_file/filename.ext');
file.writeAsBytesSync(bytes)
}).catchError((error) {
print(error.response);
})
}
//displaying image
//displaying image preview
FutureBuilder(
future: avatars.getImage(
url: 'https://example.com',

View file

@ -8,9 +8,17 @@ void main() { // Init SDK
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
// downloading file
Future result = avatars.getInitials(
).then((bytes) {
final file = File('path_to_file/filename.ext');
file.writeAsBytesSync(bytes)
}).catchError((error) {
print(error.response);
})
}
//displaying image
//displaying image preview
FutureBuilder(
future: avatars.getInitials(
), //works for both public file and private file, for private files you need to be logged in

View file

@ -8,9 +8,18 @@ void main() { // Init SDK
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
// downloading file
Future result = avatars.getQR(
text: '[TEXT]',
).then((bytes) {
final file = File('path_to_file/filename.ext');
file.writeAsBytesSync(bytes)
}).catchError((error) {
print(error.response);
})
}
//displaying image
//displaying image preview
FutureBuilder(
future: avatars.getQR(
text: '[TEXT]',

View file

@ -8,9 +8,19 @@ void main() { // Init SDK
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
// downloading file
Future result = storage.getFileDownload(
bucketId: '[BUCKET_ID]',
fileId: '[FILE_ID]',
).then((bytes) {
final file = File('path_to_file/filename.ext');
file.writeAsBytesSync(bytes)
}).catchError((error) {
print(error.response);
})
}
//displaying image
//displaying image preview
FutureBuilder(
future: storage.getFileDownload(
bucketId: '[BUCKET_ID]',

View file

@ -8,9 +8,19 @@ void main() { // Init SDK
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
// downloading file
Future result = storage.getFilePreview(
bucketId: '[BUCKET_ID]',
fileId: '[FILE_ID]',
).then((bytes) {
final file = File('path_to_file/filename.ext');
file.writeAsBytesSync(bytes)
}).catchError((error) {
print(error.response);
})
}
//displaying image
//displaying image preview
FutureBuilder(
future: storage.getFilePreview(
bucketId: '[BUCKET_ID]',

View file

@ -8,9 +8,19 @@ void main() { // Init SDK
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
// downloading file
Future result = storage.getFileView(
bucketId: '[BUCKET_ID]',
fileId: '[FILE_ID]',
).then((bytes) {
final file = File('path_to_file/filename.ext');
file.writeAsBytesSync(bytes)
}).catchError((error) {
print(error.response);
})
}
//displaying image
//displaying image preview
FutureBuilder(
future: storage.getFileView(
bucketId: '[BUCKET_ID]',

View file

@ -1,14 +0,0 @@
const sdk = new Appwrite();
sdk
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
let promise = sdk.account.delete();
promise.then(function (response) {
console.log(response); // Success
}, function (error) {
console.log(error); // Failure
});

View file

@ -1,14 +0,0 @@
const sdk = new Appwrite();
sdk
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
let promise = sdk.account.delete();
promise.then(function (response) {
console.log(response); // Success
}, function (error) {
console.log(error); // Failure
});

View file

@ -12,7 +12,7 @@ client
;
let promise = functions.createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', new File([fileBlob], 'file.png'), false);
let promise = functions.createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', 'file.png', false);
promise.then(function (response) {
console.log(response);

View file

@ -12,7 +12,7 @@ client
;
let promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', new File([fileBlob], 'file.png'));
let promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', 'file.png');
promise.then(function (response) {
console.log(response);

View file

@ -11,7 +11,7 @@ public void main() {
functions.createDeployment(
functionId = "[FUNCTION_ID]",
entrypoint = "[ENTRYPOINT]",
code = File("./path-to-files/image.jpg"),
code = File("file.png"),
activate = false
new Continuation<Response>() {
@NotNull

View file

@ -11,7 +11,7 @@ public void main() {
storage.createFile(
bucketId = "[BUCKET_ID]",
fileId = "[FILE_ID]",
file = File("./path-to-files/image.jpg"),
file = File("file.png"),
new Continuation<Response>() {
@NotNull
@Override

View file

@ -11,7 +11,7 @@ suspend fun main() {
val response = functions.createDeployment(
functionId = "[FUNCTION_ID]",
entrypoint = "[ENTRYPOINT]",
code = File("./path-to-files/image.jpg"),
code = File("file.png"),
activate = false
)
val json = response.body?.string()

View file

@ -11,7 +11,7 @@ suspend fun main() {
val response = storage.createFile(
bucketId = "[BUCKET_ID]",
fileId = "[FILE_ID]",
file = File("./path-to-files/image.jpg"),
file = File("file.png"),
)
val json = response.body?.string()
}

View file

@ -12,7 +12,7 @@ client
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
let promise = functions.createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', fs.createReadStream(__dirname + '/file.png'), false);
let promise = functions.createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', 'file.png', false);
promise.then(function (response) {
console.log(response);

View file

@ -12,7 +12,7 @@ client
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
let promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', fs.createReadStream(__dirname + '/file.png'));
let promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', 'file.png');
promise.then(function (response) {
console.log(response);

View file

@ -13,4 +13,4 @@ $client
$functions = new Functions($client);
$result = $functions->createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', new \CURLFile('/path/to/file.png', 'image/png', 'file.png'), false);
$result = $functions->createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', 'file.png', false);

View file

@ -13,4 +13,4 @@ $client
$storage = new Storage($client);
$result = $storage->createFile('[BUCKET_ID]', '[FILE_ID]', new \CURLFile('/path/to/file.png', 'image/png', 'file.png'));
$result = $storage->createFile('[BUCKET_ID]', '[FILE_ID]', 'file.png');

View file

@ -11,4 +11,4 @@ client = Client()
functions = Functions(client)
result = functions.create_deployment('[FUNCTION_ID]', '[ENTRYPOINT]', open('/path/to/file.png', 'rb'), False)
result = functions.create_deployment('[FUNCTION_ID]', '[ENTRYPOINT]', 'file.png', False)

View file

@ -11,4 +11,4 @@ client = Client()
storage = Storage(client)
result = storage.create_file('[BUCKET_ID]', '[FILE_ID]', open('/path/to/file.png', 'rb'))
result = storage.create_file('[BUCKET_ID]', '[FILE_ID]', 'file.png')

View file

@ -9,6 +9,6 @@ client
functions = Appwrite::Functions.new(client)
response = functions.create_deployment(function_id: '[FUNCTION_ID]', entrypoint: '[ENTRYPOINT]', code: File.new(), activate: false)
response = functions.create_deployment(function_id: '[FUNCTION_ID]', entrypoint: '[ENTRYPOINT]', code: 'dir/file.png', activate: false)
puts response.inspect

View file

@ -9,6 +9,6 @@ client
storage = Appwrite::Storage.new(client)
response = storage.create_file(bucket_id: '[BUCKET_ID]', file_id: '[FILE_ID]', file: File.new())
response = storage.create_file(bucket_id: '[BUCKET_ID]', file_id: '[FILE_ID]', file: 'dir/file.png')
puts response.inspect