From 27f75d5ad2f78b249a0f7f908970f3b2c6dadcaf Mon Sep 17 00:00:00 2001 From: choir27 Date: Thu, 20 Jun 2024 13:37:23 -0400 Subject: [PATCH 01/29] docs: add client react native code snippet sample to docs/products/storage --- .../storage/quick-start/+page.markdoc | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index f81577b26c..71b335ad2d 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -119,7 +119,27 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. --cec8e8123c05ba25-- ``` + ```client-react-native + import { Client, Storage, ID } from "appwrite"; + const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + + const storage = new Storage(client); + + const promise = await storage.create( + '[BUCKET_ID]', + ID.unique(), + document.getElementById('uploader').files[0] + ); + + promise.then(function (response) { + console.log(response); // Success + }, function (error) { + console.log(error); // Failure + }); + ``` {% /multicode %} @@ -224,4 +244,20 @@ class MainActivity : AppCompatActivity() { } } ``` +```client-react-native +import { Client, Storage, ID } from "appwrite"; + +const client = new Client(); + +const storage = new Storage(client); + +client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +const result = storage.getFileDownload('[BUCKET_ID]', '[FILE_ID]'); + +console.log(result); // Resource URL +``` {% /multicode %} \ No newline at end of file From ebb00f72b65895cd801cf4e691cd4ecee36340cb Mon Sep 17 00:00:00 2001 From: choir27 Date: Fri, 21 Jun 2024 12:32:07 -0400 Subject: [PATCH 02/29] docs: update code snippets based on client-react-native manual test --- .../docs/products/storage/quick-start/+page.markdoc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index 71b335ad2d..83f0f12685 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -120,7 +120,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. --cec8e8123c05ba25-- ``` ```client-react-native - import { Client, Storage, ID } from "appwrite"; + import { Client, Storage, ID } from "react-native-appwrite"; const client = new Client() .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint @@ -128,10 +128,11 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. const storage = new Storage(client); - const promise = await storage.create( + const promise = await storage.createFile( '[BUCKET_ID]', - ID.unique(), - document.getElementById('uploader').files[0] + ID.unique(), + FILE, + ["read(\"any\")"] ); promise.then(function (response) { @@ -245,7 +246,7 @@ class MainActivity : AppCompatActivity() { } ``` ```client-react-native -import { Client, Storage, ID } from "appwrite"; +import { Client, Storage, ID } from "react-native-appwrite"; const client = new Client(); From 6ec110e9a58928408009b37caad5b66b2c0cf284 Mon Sep 17 00:00:00 2001 From: choir27 Date: Mon, 24 Jun 2024 09:44:34 -0400 Subject: [PATCH 03/29] docs: add specific parameters for FILE type in client-react-native --- src/routes/docs/products/storage/quick-start/+page.markdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index 83f0f12685..b148f4e1be 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -131,7 +131,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. const promise = await storage.createFile( '[BUCKET_ID]', ID.unique(), - FILE, + {name: "file.txt", type: "text/plain", size: 37967, uri: ""}, // FILE ["read(\"any\")"] ); From c7fc26bb6ccdb3178b9a20725779515c6f3d84e4 Mon Sep 17 00:00:00 2001 From: choir27 Date: Tue, 25 Jun 2024 09:31:32 -0400 Subject: [PATCH 04/29] docs: add field to uri object in code snippet --- src/routes/docs/products/storage/quick-start/+page.markdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index b148f4e1be..7a440f7439 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -131,7 +131,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. const promise = await storage.createFile( '[BUCKET_ID]', ID.unique(), - {name: "file.txt", type: "text/plain", size: 37967, uri: ""}, // FILE + {name: "file.txt", type: "text/plain", size: 37967, uri: "https://file.txt"}, // FILE ["read(\"any\")"] ); From fe4b26fca3f75a0f1749ed3d5582a758a8268bb0 Mon Sep 17 00:00:00 2001 From: choir27 Date: Tue, 25 Jun 2024 09:50:47 -0400 Subject: [PATCH 05/29] docs: update file type object properties with FILE properties from console --- .../products/storage/quick-start/+page.markdoc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index 7a440f7439..90bfd4efb1 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -123,16 +123,21 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. import { Client, Storage, ID } from "react-native-appwrite"; const client = new Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID const storage = new Storage(client); const promise = await storage.createFile( - '[BUCKET_ID]', - ID.unique(), - {name: "file.txt", type: "text/plain", size: 37967, uri: "https://file.txt"}, // FILE - ["read(\"any\")"] + '[BUCKET_ID]', + ID.unique(), + {lastModified: 1712036524000, + lastModifiedDate: Tue Apr 02 2024 01:42:04 GMT-0400 (Eastern Daylight Time) {}, + name: "wallhaven-j3o97w.jpg", + size: 199339, + type: "image/jpeg", + webkitRelativePath: ""}, // FILE + ["read(\"any\")"] ); promise.then(function (response) { From 678f269a3f9506e5632ec59bc36ac9a5eacfb1b1 Mon Sep 17 00:00:00 2001 From: choir27 Date: Tue, 25 Jun 2024 16:23:13 -0400 Subject: [PATCH 06/29] docs: update file object properties in code snippet based on testing app with mobile --- .../docs/products/storage/quick-start/+page.markdoc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index 90bfd4efb1..6416f16fd9 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -131,15 +131,11 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. const promise = await storage.createFile( '[BUCKET_ID]', ID.unique(), - {lastModified: 1712036524000, - lastModifiedDate: Tue Apr 02 2024 01:42:04 GMT-0400 (Eastern Daylight Time) {}, - name: "wallhaven-j3o97w.jpg", - size: 199339, - type: "image/jpeg", - webkitRelativePath: ""}, // FILE + { name: "file.jpeg", type: "image/jpeg", uri: "file:///data/user/0/host.exp.exponent/cache/ExperienceData/text.jpeg", size: 183799}, // FILE ["read(\"any\")"] ); + promise.then(function (response) { console.log(response); // Success }, function (error) { From 655c0d3b3c58b155fbd746aa23cdb767771689ea Mon Sep 17 00:00:00 2001 From: choir27 Date: Wed, 26 Jun 2024 09:19:40 -0400 Subject: [PATCH 07/29] docs: replace double quotes with single quotes, change object to multi-line code, replace read[any] with Appwrite Permission --- .../docs/products/storage/quick-start/+page.markdoc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index 6416f16fd9..8db6c3cf13 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -120,7 +120,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. --cec8e8123c05ba25-- ``` ```client-react-native - import { Client, Storage, ID } from "react-native-appwrite"; + import { Client, Storage, ID, Permission } from "react-native-appwrite"; const client = new Client() .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint @@ -131,8 +131,13 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. const promise = await storage.createFile( '[BUCKET_ID]', ID.unique(), - { name: "file.jpeg", type: "image/jpeg", uri: "file:///data/user/0/host.exp.exponent/cache/ExperienceData/text.jpeg", size: 183799}, // FILE - ["read(\"any\")"] + { + name: 'file.jpeg', + type: 'image/jpeg', + uri: 'file:///data/user/0/host.exp.exponent/cache/ExperienceData/text.jpeg', + size: 183799 + }, // FILE + Permission.read('any') ); From 56c14605cd54110a947519d2c92fb81e6e9db196 Mon Sep 17 00:00:00 2001 From: choir27 Date: Wed, 26 Jun 2024 09:20:50 -0400 Subject: [PATCH 08/29] docs: replace double quotes with single quotes for react-native-appwrite --- src/routes/docs/products/storage/quick-start/+page.markdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index 8db6c3cf13..b336709eaf 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -120,7 +120,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. --cec8e8123c05ba25-- ``` ```client-react-native - import { Client, Storage, ID, Permission } from "react-native-appwrite"; + import { Client, Storage, ID, Permission } from 'react-native-appwrite'; const client = new Client() .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint @@ -252,7 +252,7 @@ class MainActivity : AppCompatActivity() { } ``` ```client-react-native -import { Client, Storage, ID } from "react-native-appwrite"; +import { Client, Storage, ID } from 'react-native-appwrite'; const client = new Client(); From 2ffe92becb428f9d98476583d98c3c7e29a48ad9 Mon Sep 17 00:00:00 2001 From: choir27 Date: Wed, 26 Jun 2024 16:16:03 -0400 Subject: [PATCH 09/29] docs: replace placeholder [] for <> in code snippets --- .../storage/quick-start/+page.markdoc | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index b336709eaf..54639c89d5 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -29,7 +29,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. const storage = new Storage(client); const promise = storage.createFile( - '[BUCKET_ID]', + '', ID.unique(), document.getElementById('uploader').files[0] ); @@ -52,7 +52,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. final storage = Storage(client); final file = await storage.createFile( - bucketId: '[BUCKET_ID]', + bucketId: '', fileId: ID.unique(), file: InputFile.fromPath(path: './path-to-files/image.jpg', filename: 'image.jpg'), ); @@ -69,7 +69,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. let storage = Storage(client) let file = try await storage.createFile( - bucketId: "[BUCKET_ID]", + bucketId: "", fileId: ID.unique(), file: InputFile.fromBuffer(yourByteBuffer, filename: "image.jpg", @@ -90,7 +90,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. val storage = Storage(client) val file = storage.createFile( - bucketId = "[BUCKET_ID]", + bucketId = "", fileId = ID.unique(), file = File("./path-to-files/image.jpg"), ) @@ -101,16 +101,16 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. POST /v1/storage/buckets/{bucketId}/files HTTP/1.1 Content-Type: multipart/form-data; boundary="cec8e8123c05ba25" Content-Length: *Length of your entity body in bytes* - X-Appwrite-Project: [PROJECT_ID] + X-Appwrite-Project: --cec8e8123c05ba25 Content-Disposition: form-data; name="operations" - { "query": "mutation CreateFile($bucketId: String!, $fileId: String!, $file: InputFile!) { storageCreateFile(bucketId: $bucketId, fileId: $fileId, file: $file) { id } }", "variables": { "bucketId": "[BUCKET_ID]", "fileId": "[FILE_ID]", "file": null } } + { "query": "mutation CreateFile($bucketId: String!, $fileId: String!, $file: InputFile!) { storageCreateFile(bucketId: $bucketId, fileId: $fileId, file: $file) { id } }", "variables": { "bucketId": "", "fileId": "", "file": null } } --cec8e8123c05ba25 Content-Disposition: form-data; name="map" - { "0": ["variables.file"] } + { "0": <"variables.file"> } --cec8e8123c05ba25 Content-Disposition: form-data; name="0"; filename="file.txt" Content-Type: text/plain @@ -129,12 +129,12 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. const storage = new Storage(client); const promise = await storage.createFile( - '[BUCKET_ID]', + '', ID.unique(), { name: 'file.jpeg', type: 'image/jpeg', - uri: 'file:///data/user/0/host.exp.exponent/cache/ExperienceData/text.jpeg', + uri: 'file://user/text.jpeg', size: 183799 }, // FILE Permission.read('any') @@ -166,7 +166,7 @@ client .setProject('5df5acd0d48c2') // Your project ID ; -const result = storage.getFileDownload('[BUCKET_ID]', '[FILE_ID]'); +const result = storage.getFileDownload('', ''); console.log(result); // Resource URL ``` @@ -183,8 +183,8 @@ void main() { // Init SDK ; // downloading file Future result = storage.getFileDownload( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId: '', + fileId: '', ).then((bytes) { final file = File('path_to_file/filename.ext'); file.writeAsBytesSync(bytes) @@ -196,8 +196,8 @@ void main() { // Init SDK //displaying image preview FutureBuilder( future: storage.getFileDownload( - bucketId: '[BUCKET_ID]', - fileId: '[FILE_ID]', + bucketId: '', + fileId: '', ), //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 @@ -217,8 +217,8 @@ func main() async throws { .setProject("5df5acd0d48c2") // Your project ID let storage = Storage(client) let byteBuffer = try await storage.getFileDownload( - bucketId: "[BUCKET_ID]", - fileId: "[FILE_ID]" + bucketId: "", + fileId: "" ) print(String(describing: byteBuffer)) @@ -244,8 +244,8 @@ class MainActivity : AppCompatActivity() { val storage = Storage(client) val result = storage.getFileDownload( - bucketId = "[BUCKET_ID]", - fileId = "[FILE_ID]" + bucketId = "", + fileId = "" ) println(result); // Resource URL } @@ -263,7 +263,7 @@ client .setProject('5df5acd0d48c2') // Your project ID ; -const result = storage.getFileDownload('[BUCKET_ID]', '[FILE_ID]'); +const result = storage.getFileDownload('', ''); console.log(result); // Resource URL ``` From a22e4f7f8fc2a8f76d9cc09cec3b7d6259391fe1 Mon Sep 17 00:00:00 2001 From: choir27 Date: Thu, 27 Jun 2024 10:23:34 -0400 Subject: [PATCH 10/29] docs: remove Permission from code snippets to remove optional parameters. Update file object for all storage code snippets for consistency --- .../storage/quick-start/+page.markdoc | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index 54639c89d5..c512b8cdcb 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -31,7 +31,10 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. const promise = storage.createFile( '', ID.unique(), - document.getElementById('uploader').files[0] + { name: 'file.jpeg', + type: 'image/jpeg', + uri: 'file://user/text.jpeg', + size: 183799 } ); promise.then(function (response) { @@ -54,7 +57,10 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. final file = await storage.createFile( bucketId: '', fileId: ID.unique(), - file: InputFile.fromPath(path: './path-to-files/image.jpg', filename: 'image.jpg'), + file: { name: 'file.jpeg', + type: 'image/jpeg', + uri: 'file://user/text.jpeg', + size: 183799 } ); } ``` @@ -71,10 +77,10 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. let file = try await storage.createFile( bucketId: "", fileId: ID.unique(), - file: InputFile.fromBuffer(yourByteBuffer, - filename: "image.jpg", - mimeType: "image/jpeg" - ) + file: { name: 'file.jpeg', + type: 'image/jpeg', + uri: 'file://user/text.jpeg', + size: 183799 } ) } ``` @@ -92,7 +98,10 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. val file = storage.createFile( bucketId = "", fileId = ID.unique(), - file = File("./path-to-files/image.jpg"), + file = { name: 'file.jpeg', + type: 'image/jpeg', + uri: 'file://user/text.jpeg', + size: 183799 }, ) } ``` @@ -106,7 +115,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. --cec8e8123c05ba25 Content-Disposition: form-data; name="operations" - { "query": "mutation CreateFile($bucketId: String!, $fileId: String!, $file: InputFile!) { storageCreateFile(bucketId: $bucketId, fileId: $fileId, file: $file) { id } }", "variables": { "bucketId": "", "fileId": "", "file": null } } + { "query": "mutation CreateFile($bucketId: String!, $fileId: String!, $file: { name: 'file.jpeg', type: 'image/jpeg', uri: 'file://user/text.jpeg', size: 183799 }) { storageCreateFile(bucketId: $bucketId, fileId: $fileId, file: { name: 'file.jpeg', type: 'image/jpeg', uri: 'file://user/text.jpeg', size: 183799 } ) { id } }", "variables": { "bucketId": "", "fileId": "", "file": null } } --cec8e8123c05ba25 Content-Disposition: form-data; name="map" @@ -120,7 +129,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. --cec8e8123c05ba25-- ``` ```client-react-native - import { Client, Storage, ID, Permission } from 'react-native-appwrite'; + import { Client, Storage, ID } from 'react-native-appwrite'; const client = new Client() .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint @@ -131,16 +140,12 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. const promise = await storage.createFile( '', ID.unique(), - { - name: 'file.jpeg', - type: 'image/jpeg', - uri: 'file://user/text.jpeg', - size: 183799 - }, // FILE - Permission.read('any') + { name: 'file.jpeg', + type: 'image/jpeg', + uri: 'file://user/text.jpeg', + size: 183799 } ); - promise.then(function (response) { console.log(response); // Success }, function (error) { From 7234c11185d1bc588802e7dd183862ce624eb889 Mon Sep 17 00:00:00 2001 From: choir27 Date: Thu, 27 Jun 2024 10:27:23 -0400 Subject: [PATCH 11/29] chore: fix spacing in blog post --- src/routes/blog/post/celebrating-1.5-contributors/+page.markdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/blog/post/celebrating-1.5-contributors/+page.markdoc b/src/routes/blog/post/celebrating-1.5-contributors/+page.markdoc index ab090bbd81..df0d54e171 100644 --- a/src/routes/blog/post/celebrating-1.5-contributors/+page.markdoc +++ b/src/routes/blog/post/celebrating-1.5-contributors/+page.markdoc @@ -59,7 +59,7 @@ The latest version of Appwrite was built with the help of over 20 developers, tr - [@amanpatel23](https://github.com/amanpatel23), who [fixed certain pattern input validation](https://github.com/appwrite/console/pull/702) - [@programmingwithrp](https://github.com/programmingwithrp), who [updated links for the Cron syntax](https://github.com/appwrite/console/pull/639) - [@sourabpramanik](https://github.com/sourabpramanik), who [helped fix table overflow in mobile view](https://github.com/appwrite/console/pull/666) -- [@sourabpramanik](https://github.com/sourabpramanik), who[ helped fix the console organization project count limit](https://github.com/appwrite/console/pull/699) +- [@sourabpramanik](https://github.com/sourabpramanik), who [ helped fix the console organization project count limit](https://github.com/appwrite/console/pull/699) - [@AmitGurbani](https://github.com/AmitGurbani), who [fixed clearing of the DateTime attribute](https://github.com/appwrite/console/pull/594) - [@sahalsaad](https://github.com/sahalsaad), who [added nullable option to the DateTime field](https://github.com/appwrite/console/pull/608) - [@FreSauce](https://github.com/FreSauce), who [fixed missing separator for keycodes comparison](https://github.com/appwrite/console/pull/585) From 9598a60192d6eeb77643f07a1eab6be23d0a1b5c Mon Sep 17 00:00:00 2001 From: choir27 Date: Fri, 28 Jun 2024 11:25:14 -0400 Subject: [PATCH 12/29] docs: revert flutter, android-kotlin, and client-apple file object properties until testing code snippets successfully create file. Update REST code snippets tentatively, still need to successfully create file with new code --- .../storage/quick-start/+page.markdoc | 70 +++++++++---------- 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index c512b8cdcb..bbca6222b5 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -31,10 +31,12 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. const promise = storage.createFile( '', ID.unique(), - { name: 'file.jpeg', - type: 'image/jpeg', - uri: 'file://user/text.jpeg', - size: 183799 } + const test = { + size: 275345, + type: "image/png", + name: "img_MIKU_us.png", + lastModified: 1719515891557 + }; ); promise.then(function (response) { @@ -57,10 +59,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. final file = await storage.createFile( bucketId: '', fileId: ID.unique(), - file: { name: 'file.jpeg', - type: 'image/jpeg', - uri: 'file://user/text.jpeg', - size: 183799 } + file: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg') ); } ``` @@ -77,10 +76,10 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. let file = try await storage.createFile( bucketId: "", fileId: ID.unique(), - file: { name: 'file.jpeg', - type: 'image/jpeg', - uri: 'file://user/text.jpeg', - size: 183799 } + file: InputFile.fromBuffer(yourByteBuffer, + filename: "image.jpg", + mimeType: "image/jpeg" + ) ) } ``` @@ -98,35 +97,29 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. val file = storage.createFile( bucketId = "", fileId = ID.unique(), - file = { name: 'file.jpeg', - type: 'image/jpeg', - uri: 'file://user/text.jpeg', - size: 183799 }, + file = InputFile.fromPath("file.png"), ) } ``` ```http - POST /v1/storage/buckets/{bucketId}/files HTTP/1.1 - Content-Type: multipart/form-data; boundary="cec8e8123c05ba25" - Content-Length: *Length of your entity body in bytes* - X-Appwrite-Project: - - --cec8e8123c05ba25 - Content-Disposition: form-data; name="operations" + POST https://cloud.appwrite.io/v1/storage/buckets//files HTTP/1.1 + X-Appwrite-Project: + X-Appwrite-Mode: admin + Cookie: + Content-Type: multipart/form-data; boundary=---1234 + Content-Length: + + -----1234 + Content-Disposition: form-data; name="fileId" + + "" + + -----1234 + Content-Disposition: form-data; name="file"; filename="file.png" + Content-Type: image/png + < ./file.png - { "query": "mutation CreateFile($bucketId: String!, $fileId: String!, $file: { name: 'file.jpeg', type: 'image/jpeg', uri: 'file://user/text.jpeg', size: 183799 }) { storageCreateFile(bucketId: $bucketId, fileId: $fileId, file: { name: 'file.jpeg', type: 'image/jpeg', uri: 'file://user/text.jpeg', size: 183799 } ) { id } }", "variables": { "bucketId": "", "fileId": "", "file": null } } - --cec8e8123c05ba25 - Content-Disposition: form-data; name="map" - - { "0": <"variables.file"> } - --cec8e8123c05ba25 - Content-Disposition: form-data; name="0"; filename="file.txt" - Content-Type: text/plain - - File content. - - --cec8e8123c05ba25-- ``` ```client-react-native import { Client, Storage, ID } from 'react-native-appwrite'; @@ -140,11 +133,12 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. const promise = await storage.createFile( '', ID.unique(), - { name: 'file.jpeg', + { + name: 'file.jpeg', type: 'image/jpeg', uri: 'file://user/text.jpeg', - size: 183799 } - ); + size: 183799 + }); promise.then(function (response) { console.log(response); // Success From 6da8fb569e389714f595b5a9065440d8eb147815 Mon Sep 17 00:00:00 2001 From: choir27 Date: Fri, 28 Jun 2024 11:26:23 -0400 Subject: [PATCH 13/29] chore: remove extra space --- src/routes/blog/post/celebrating-1.5-contributors/+page.markdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/blog/post/celebrating-1.5-contributors/+page.markdoc b/src/routes/blog/post/celebrating-1.5-contributors/+page.markdoc index df0d54e171..107ad5596e 100644 --- a/src/routes/blog/post/celebrating-1.5-contributors/+page.markdoc +++ b/src/routes/blog/post/celebrating-1.5-contributors/+page.markdoc @@ -59,7 +59,7 @@ The latest version of Appwrite was built with the help of over 20 developers, tr - [@amanpatel23](https://github.com/amanpatel23), who [fixed certain pattern input validation](https://github.com/appwrite/console/pull/702) - [@programmingwithrp](https://github.com/programmingwithrp), who [updated links for the Cron syntax](https://github.com/appwrite/console/pull/639) - [@sourabpramanik](https://github.com/sourabpramanik), who [helped fix table overflow in mobile view](https://github.com/appwrite/console/pull/666) -- [@sourabpramanik](https://github.com/sourabpramanik), who [ helped fix the console organization project count limit](https://github.com/appwrite/console/pull/699) +- [@sourabpramanik](https://github.com/sourabpramanik), who [helped fix the console organization project count limit](https://github.com/appwrite/console/pull/699) - [@AmitGurbani](https://github.com/AmitGurbani), who [fixed clearing of the DateTime attribute](https://github.com/appwrite/console/pull/594) - [@sahalsaad](https://github.com/sahalsaad), who [added nullable option to the DateTime field](https://github.com/appwrite/console/pull/608) - [@FreSauce](https://github.com/FreSauce), who [fixed missing separator for keycodes comparison](https://github.com/appwrite/console/pull/585) From b5759efafb60be311a4be0b6a952d519726e98dd Mon Sep 17 00:00:00 2001 From: choir27 Date: Fri, 28 Jun 2024 14:38:23 -0400 Subject: [PATCH 14/29] update http code snipeet --- .../storage/quick-start/+page.markdoc | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index bbca6222b5..25ab729ab6 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -103,22 +103,25 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. ``` ```http - POST https://cloud.appwrite.io/v1/storage/buckets//files HTTP/1.1 - X-Appwrite-Project: - X-Appwrite-Mode: admin - Cookie: - Content-Type: multipart/form-data; boundary=---1234 - Content-Length: - - -----1234 - Content-Disposition: form-data; name="fileId" - - "" - - -----1234 - Content-Disposition: form-data; name="file"; filename="file.png" - Content-Type: image/png - < ./file.png + POST https://cloud.appwrite.io/v1/storage/buckets//files HTTP/1.1 + X-Appwrite-Project: + X-Appwrite-Mode: admin + X-Appwrite-Response-Format: 1.5.0 + Cookie: COOKIE + Content-Type: multipart/form-data; boundary=---1234 + Content-Length: LENGTH + + -----1234 + Content-Disposition: form-data; name="fileId" + + + -----1234 + Content-Disposition: form-data; name="file"; filename="text.png" + Content-Type: image/PNG + +< ./miku.png + +-----1234 ``` ```client-react-native From b21be3f3bd5d9f008ce703d2130588b2f659b499 Mon Sep 17 00:00:00 2001 From: Richard <66279068+choir27@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:03:50 -0400 Subject: [PATCH 15/29] Update src/routes/docs/products/storage/quick-start/+page.markdoc Co-authored-by: Steven Nguyen <1477010+stnguyen90@users.noreply.github.com> --- .../docs/products/storage/quick-start/+page.markdoc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index 25ab729ab6..cb69ddce96 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -137,11 +137,12 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. '', ID.unique(), { - name: 'file.jpeg', - type: 'image/jpeg', - uri: 'file://user/text.jpeg', - size: 183799 - }); + name: 'file.jpeg', + type: 'image/jpeg', + uri: 'file://user/text.jpeg', + size: 183799 + } +); promise.then(function (response) { console.log(response); // Success From 2a7caa39cdd00edaf609cd5b75d3e8f22d21ea9d Mon Sep 17 00:00:00 2001 From: Richard <66279068+choir27@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:04:08 -0400 Subject: [PATCH 16/29] Update src/routes/docs/products/storage/quick-start/+page.markdoc Co-authored-by: Steven Nguyen <1477010+stnguyen90@users.noreply.github.com> --- src/routes/docs/products/storage/quick-start/+page.markdoc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index cb69ddce96..6f0aa4062d 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -262,9 +262,8 @@ const client = new Client(); const storage = new Storage(client); client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; + .setEndpoint('https://cloud.appwrite.io/v1') + .setProject(''); const result = storage.getFileDownload('', ''); From 4e57243044df0843cd617515a00cd364285f9acc Mon Sep 17 00:00:00 2001 From: choir27 Date: Tue, 2 Jul 2024 10:19:53 -0400 Subject: [PATCH 17/29] docs: revert web file object to previous iteration, include imports for ID and inputFile --- .../storage/quick-start/+page.markdoc | 55 +++++++++---------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index 6f0aa4062d..c6c31443b2 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -20,7 +20,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. {% multicode %} ```client-web - import { Client, Storage } from "appwrite"; + import { Client, Storage, ID } from "appwrite"; const client = new Client() .setEndpoint('https://cloud.appwrite.io/v1') @@ -31,12 +31,12 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. const promise = storage.createFile( '', ID.unique(), - const test = { - size: 275345, - type: "image/png", - name: "img_MIKU_us.png", - lastModified: 1719515891557 - }; + { + name: 'file.txt', + type: 'text/plain', + size: 37967, + uri: 'file://text.png' + }, // FILE ); promise.then(function (response) { @@ -59,7 +59,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. final file = await storage.createFile( bucketId: '', fileId: ID.unique(), - file: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg') + file: InputFile.fromPath(path: './path-to-files/image.jpg', filename: 'image.jpg'), ); } ``` @@ -86,6 +86,8 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. ```client-android-kotlin import io.appwrite.Client import io.appwrite.services.Storage + import io.appwrite.models.InputFileio.appwrite.models.InputFile + import io.appwrite.ID suspend fun main() { val client = Client(applicationContext) @@ -103,27 +105,24 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. ``` ```http - POST https://cloud.appwrite.io/v1/storage/buckets//files HTTP/1.1 - X-Appwrite-Project: - X-Appwrite-Mode: admin - X-Appwrite-Response-Format: 1.5.0 - Cookie: COOKIE - Content-Type: multipart/form-data; boundary=---1234 - Content-Length: LENGTH - - -----1234 - Content-Disposition: form-data; name="fileId" - - - -----1234 - Content-Disposition: form-data; name="file"; filename="text.png" - Content-Type: image/PNG - -< ./miku.png - ------1234 + POST https://cloud.appwrite.io/v1/storage/buckets//files HTTP/1.1 + X-Appwrite-Project: + X-Appwrite-Response-Format: 1.5.0 + Cookie: + Content-Type: multipart/form-data; boundary=---1234 + Content-Length: + -----1234 + Content-Disposition: form-data; name="file"; filename="text.png" + Content-Type: image/PNG + + < + + -----1234 +``` - ``` ```client-react-native import { Client, Storage, ID } from 'react-native-appwrite'; From 180aaa0daa8a49c207c9873ecda89b882dfd6d13 Mon Sep 17 00:00:00 2001 From: choir27 Date: Tue, 2 Jul 2024 11:49:17 -0400 Subject: [PATCH 18/29] docs: replace double quotes for single quotes and update image type for consistency --- .../storage/quick-start/+page.markdoc | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index c6c31443b2..a5edd6c408 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -20,7 +20,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. {% multicode %} ```client-web - import { Client, Storage, ID } from "appwrite"; + import { Client, Storage, ID } from 'appwrite'; const client = new Client() .setEndpoint('https://cloud.appwrite.io/v1') @@ -68,17 +68,17 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. func main() async throws { let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") - .setProject("") + .setEndpoint('https://cloud.appwrite.io/v1') + .setProject('') let storage = Storage(client) let file = try await storage.createFile( - bucketId: "", + bucketId: '', fileId: ID.unique(), file: InputFile.fromBuffer(yourByteBuffer, - filename: "image.jpg", - mimeType: "image/jpeg" + filename: 'image.jpg', + mimeType: 'image/jpeg' ) ) } @@ -91,15 +91,15 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. suspend fun main() { val client = Client(applicationContext) - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID val storage = Storage(client) val file = storage.createFile( - bucketId = "", + bucketId = '', fileId = ID.unique(), - file = InputFile.fromPath("file.png"), + file = InputFile.fromPath('./path-to-files/image.jpg'), ) } ``` @@ -110,13 +110,13 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. X-Appwrite-Response-Format: 1.5.0 Cookie: Content-Type: multipart/form-data; boundary=---1234 - Content-Length: -----1234 - Content-Disposition: form-data; name="fileId" + Content-Disposition: form-data; name='fileId' -----1234 - Content-Disposition: form-data; name="file"; filename="text.png" - Content-Type: image/PNG + Content-Disposition: form-data; name='file'; filename='image.jpg' + Content-Type: image/jpg < @@ -136,9 +136,9 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. '', ID.unique(), { - name: 'file.jpeg', - type: 'image/jpeg', - uri: 'file://user/text.jpeg', + name: 'image.jpg', + type: 'image/jpg', + uri: 'file://user/image.jpg', size: 183799 } ); @@ -157,7 +157,7 @@ To download a file, use the `getFileDownload` method. {% multicode %} ```client-web -import { Client, Storage } from "appwrite"; +import { Client, Storage } from 'appwrite'; const client = new Client(); @@ -215,12 +215,12 @@ import Appwrite func main() async throws { let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID let storage = Storage(client) let byteBuffer = try await storage.getFileDownload( - bucketId: "", - fileId: "" + bucketId: '', + fileId: '' ) print(String(describing: byteBuffer)) @@ -240,14 +240,14 @@ class MainActivity : AppCompatActivity() { setContentView(R.layout.activity_main) val client = Client(applicationContext) - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID val storage = Storage(client) val result = storage.getFileDownload( - bucketId = "", - fileId = "" + bucketId = '', + fileId = '' ) println(result); // Resource URL } From 0280cc324f687bdb84dcdcc35cec39c2cbe72d10 Mon Sep 17 00:00:00 2001 From: choir27 Date: Tue, 2 Jul 2024 12:12:52 -0400 Subject: [PATCH 19/29] replace setProject argument with placeholder ) // Your project ID ; const result = storage.getFileDownload('', ''); @@ -181,7 +181,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID + .setProject() // Your project ID ; // downloading file Future result = storage.getFileDownload( @@ -216,7 +216,7 @@ import Appwrite func main() async throws { let client = Client() .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID + .setProject() // Your project ID let storage = Storage(client) let byteBuffer = try await storage.getFileDownload( bucketId: '', @@ -241,7 +241,7 @@ class MainActivity : AppCompatActivity() { val client = Client(applicationContext) .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID + .setProject() // Your project ID val storage = Storage(client) From babfa8eeaff2e05aeb30c3a9037d6889e8fe564b Mon Sep 17 00:00:00 2001 From: choir27 Date: Mon, 8 Jul 2024 10:49:02 -0400 Subject: [PATCH 20/29] docs: change file comment to sentence case for consistency, update quotes for consistency across code snippets --- .../storage/quick-start/+page.markdoc | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index 0ffa850a21..7699c04db5 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -36,7 +36,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. type: 'text/plain', size: 37967, uri: 'file://text.png' - }, // FILE + }, // File ); promise.then(function (response) { @@ -63,12 +63,13 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. ); } ``` + ```client-apple import Appwrite func main() async throws { let client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') + .setEndpoint("https://cloud.appwrite.io/v1") .setProject('') let storage = Storage(client) @@ -83,6 +84,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. ) } ``` + ```client-android-kotlin import io.appwrite.Client import io.appwrite.services.Storage @@ -121,7 +123,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. < -----1234 -``` + ``` ```client-react-native import { Client, Storage, ID } from 'react-native-appwrite'; @@ -165,13 +167,14 @@ const storage = new Storage(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject() // Your project ID + .setProject('') // Your project ID ; const result = storage.getFileDownload('', ''); console.log(result); // Resource URL ``` + ```client-flutter import 'package:appwrite/appwrite.dart'; @@ -181,7 +184,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject() // Your project ID + .setProject('') // Your project ID ; // downloading file Future result = storage.getFileDownload( @@ -210,13 +213,14 @@ FutureBuilder( }, ); ``` + ```client-apple import Appwrite func main() async throws { let client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject() // Your project ID + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject('') // Your project ID let storage = Storage(client) let byteBuffer = try await storage.getFileDownload( bucketId: '', @@ -226,6 +230,7 @@ func main() async throws { print(String(describing: byteBuffer)) } ``` + ```client-android-kotlin import androidx.appcompat.app.AppCompatActivity import android.os.Bundle @@ -241,7 +246,7 @@ class MainActivity : AppCompatActivity() { val client = Client(applicationContext) .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject() // Your project ID + .setProject('') // Your project ID val storage = Storage(client) @@ -253,6 +258,7 @@ class MainActivity : AppCompatActivity() { } } ``` + ```client-react-native import { Client, Storage, ID } from 'react-native-appwrite'; From 113112bf69258c6e021704ce0b5f91782ac99a00 Mon Sep 17 00:00:00 2001 From: Richard <66279068+choir27@users.noreply.github.com> Date: Mon, 15 Jul 2024 09:11:32 -0400 Subject: [PATCH 21/29] Update src/routes/docs/products/storage/quick-start/+page.markdoc Co-authored-by: Steven Nguyen <1477010+stnguyen90@users.noreply.github.com> --- src/routes/docs/products/storage/quick-start/+page.markdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index 7699c04db5..8191a2cd40 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -120,7 +120,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. Content-Disposition: form-data; name='file'; filename='image.jpg' Content-Type: image/jpg - < + -----1234 ``` From 4c001ab03045f37c784d4eb85ec78e1109d7855c Mon Sep 17 00:00:00 2001 From: Richard <66279068+choir27@users.noreply.github.com> Date: Mon, 15 Jul 2024 09:12:21 -0400 Subject: [PATCH 22/29] Update src/routes/docs/products/storage/quick-start/+page.markdoc Co-authored-by: Steven Nguyen <1477010+stnguyen90@users.noreply.github.com> --- src/routes/docs/products/storage/quick-start/+page.markdoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index 8191a2cd40..7ee2a2825a 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -115,7 +115,8 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. Content-Length: -----1234 Content-Disposition: form-data; name='fileId' - + + -----1234 Content-Disposition: form-data; name='file'; filename='image.jpg' Content-Type: image/jpg From 9e24a53e24a412dfb4d927d746b73e4323b24b29 Mon Sep 17 00:00:00 2001 From: choir27 Date: Mon, 15 Jul 2024 10:35:16 -0400 Subject: [PATCH 23/29] docs: fix duplicate import to ensure accuracy. Add underscore to maintain consistency in placeholder variable. remove extra indentation and extra newline in codesnippet --- .../docs/products/storage/quick-start/+page.markdoc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index 7ee2a2825a..cfa369f564 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -88,7 +88,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. ```client-android-kotlin import io.appwrite.Client import io.appwrite.services.Storage - import io.appwrite.models.InputFileio.appwrite.models.InputFile + import io.appwrite.models.InputFile import io.appwrite.ID suspend fun main() { @@ -115,14 +115,11 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. Content-Length: -----1234 Content-Disposition: form-data; name='fileId' - -----1234 Content-Disposition: form-data; name='file'; filename='image.jpg' Content-Type: image/jpg - - -----1234 ``` @@ -139,10 +136,10 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. '', ID.unique(), { - name: 'image.jpg', - type: 'image/jpg', - uri: 'file://user/image.jpg', - size: 183799 + name: 'image.jpg', + type: 'image/jpg', + uri: 'file://user/image.jpg', + size: 183799 } ); From 48debf93d475e5b60db99abc9153283a39324e42 Mon Sep 17 00:00:00 2001 From: choir27 Date: Mon, 15 Jul 2024 11:05:18 -0400 Subject: [PATCH 24/29] docs: remove redundant comment --- .../storage/quick-start/+page.markdoc | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index cfa369f564..e5b943a94e 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -36,7 +36,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. type: 'text/plain', size: 37967, uri: 'file://text.png' - }, // File + }, ); promise.then(function (response) { @@ -127,26 +127,26 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. import { Client, Storage, ID } from 'react-native-appwrite'; const client = new Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID const storage = new Storage(client); const promise = await storage.createFile( - '', - ID.unique(), - { - name: 'image.jpg', - type: 'image/jpg', - uri: 'file://user/image.jpg', - size: 183799 + '', + ID.unique(), + { + name: 'image.jpg', + type: 'image/jpg', + uri: 'file://user/image.jpg', + size: 183799 } ); promise.then(function (response) { - console.log(response); // Success + console.log(response); // Success }, function (error) { - console.log(error); // Failure + console.log(error); // Failure }); ``` {% /multicode %} From a23eff11f14f75caba9ddcd06c796f9504e9bbeb Mon Sep 17 00:00:00 2001 From: choir27 Date: Fri, 19 Jul 2024 13:10:27 -0400 Subject: [PATCH 25/29] docs: Align comments and replace single quotes for double quotes in kotlin and apple code samples for runtime accuracy --- .../storage/quick-start/+page.markdoc | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index e5b943a94e..ab702e790b 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -42,7 +42,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. promise.then(function (response) { console.log(response); // Success }, function (error) { - console.log(error); // Failure + console.log(error); // Failure }); ``` @@ -70,16 +70,16 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. func main() async throws { let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") - .setProject('') + .setProject("") let storage = Storage(client) let file = try await storage.createFile( - bucketId: '', + bucketId: "", fileId: ID.unique(), file: InputFile.fromBuffer(yourByteBuffer, - filename: 'image.jpg', - mimeType: 'image/jpeg' + filename: "image.jpg", + mimeType: "image/jpeg" ) ) } @@ -93,15 +93,15 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. suspend fun main() { val client = Client(applicationContext) - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID val storage = Storage(client) val file = storage.createFile( - bucketId = '', + bucketId = "", fileId = ID.unique(), - file = InputFile.fromPath('./path-to-files/image.jpg'), + file = InputFile.fromPath("./path-to-files/image.jpg"), ) } ``` @@ -141,12 +141,12 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. uri: 'file://user/image.jpg', size: 183799 } -); + ); promise.then(function (response) { console.log(response); // Success }, function (error) { - console.log(error); // Failure + console.log(error); // Failure }); ``` {% /multicode %} @@ -165,7 +165,7 @@ const storage = new Storage(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID + .setProject('') // Your project ID ; const result = storage.getFileDownload('', ''); @@ -182,7 +182,7 @@ void main() { // Init SDK client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID + .setProject('') // Your project ID ; // downloading file Future result = storage.getFileDownload( @@ -218,11 +218,11 @@ import Appwrite func main() async throws { let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject('') // Your project ID + .setProject("") // Your project ID let storage = Storage(client) let byteBuffer = try await storage.getFileDownload( - bucketId: '', - fileId: '' + bucketId: "", + fileId: "" ) print(String(describing: byteBuffer)) @@ -243,14 +243,14 @@ class MainActivity : AppCompatActivity() { setContentView(R.layout.activity_main) val client = Client(applicationContext) - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID val storage = Storage(client) val result = storage.getFileDownload( - bucketId = '', - fileId = '' + bucketId = "", + fileId = "" ) println(result); // Resource URL } From aa9fd328f08e5d0f2aa042ca84c07ffadcae525f Mon Sep 17 00:00:00 2001 From: choir27 Date: Fri, 19 Jul 2024 15:05:08 -0400 Subject: [PATCH 26/29] docs: update indentation for code snippet --- .../products/storage/quick-start/+page.markdoc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index ab702e790b..638377db45 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -29,16 +29,17 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. const storage = new Storage(client); const promise = storage.createFile( - '', - ID.unique(), - { - name: 'file.txt', - type: 'text/plain', - size: 37967, - uri: 'file://text.png' - }, + "", + ID.unique(), + { + name: "file.txt", + type: "text/plain", + size: 37967, + uri: "file://text.png", + }, ); + promise.then(function (response) { console.log(response); // Success }, function (error) { From 27b8aeb53ad5f57a25c670436e60def9423a0495 Mon Sep 17 00:00:00 2001 From: choir27 Date: Sat, 20 Jul 2024 12:39:03 -0400 Subject: [PATCH 27/29] docs: remove setEndpoint from code snippets in storage quick start --- .../docs/products/storage/quick-start/+page.markdoc | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index 638377db45..2d5294a35f 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -23,7 +23,6 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. import { Client, Storage, ID } from 'appwrite'; const client = new Client() - .setEndpoint('https://cloud.appwrite.io/v1') .setProject(''); const storage = new Storage(client); @@ -52,7 +51,6 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. void main() { // Init SDK final client = Client() - .setEndpoint('https://cloud.appwrite.io/v1') .setProject(''); final storage = Storage(client); @@ -70,7 +68,6 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. func main() async throws { let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") .setProject("") let storage = Storage(client) @@ -94,7 +91,6 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. suspend fun main() { val client = Client(applicationContext) - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID val storage = Storage(client) @@ -128,7 +124,6 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. import { Client, Storage, ID } from 'react-native-appwrite'; const client = new Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID const storage = new Storage(client); @@ -165,7 +160,6 @@ const client = new Client(); const storage = new Storage(client); client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID ; @@ -182,7 +176,6 @@ void main() { // Init SDK Storage storage = Storage(client); client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID ; // downloading file @@ -218,7 +211,6 @@ import Appwrite func main() async throws { let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let storage = Storage(client) let byteBuffer = try await storage.getFileDownload( @@ -244,7 +236,6 @@ class MainActivity : AppCompatActivity() { setContentView(R.layout.activity_main) val client = Client(applicationContext) - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID val storage = Storage(client) @@ -266,7 +257,6 @@ const client = new Client(); const storage = new Storage(client); client - .setEndpoint('https://cloud.appwrite.io/v1') .setProject(''); const result = storage.getFileDownload('', ''); From 605ad36a6af757eed4ff3fa7892d7dc780d3f2cd Mon Sep 17 00:00:00 2001 From: Richard <66279068+choir27@users.noreply.github.com> Date: Thu, 25 Jul 2024 14:29:43 -0400 Subject: [PATCH 28/29] Update src/routes/docs/products/storage/quick-start/+page.markdoc Co-authored-by: Steven Nguyen <1477010+stnguyen90@users.noreply.github.com> --- .../docs/products/storage/quick-start/+page.markdoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index 2d5294a35f..a11d0fec0c 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -31,10 +31,10 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. "", ID.unique(), { - name: "file.txt", - type: "text/plain", - size: 37967, - uri: "file://text.png", + name: "file.txt", + type: "text/plain", + size: 37967, + uri: "file://text.png", }, ); From cf823e3274261beda9a1cbb766225613dcc414b4 Mon Sep 17 00:00:00 2001 From: choir27 Date: Tue, 13 Aug 2024 11:32:44 -0400 Subject: [PATCH 29/29] docs: add quotes to match consistency with other code snippet examples. add projectid comment to match consistency with other code snippets. Add spacing to http to match other http code snippets. Add http code snippet to downloadFile. --- .../storage/quick-start/+page.markdoc | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index a11d0fec0c..14447ea9ca 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -23,18 +23,18 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. import { Client, Storage, ID } from 'appwrite'; const client = new Client() - .setProject(''); + .setProject(''); // Your project ID const storage = new Storage(client); const promise = storage.createFile( - "", + '', ID.unique(), { - name: "file.txt", - type: "text/plain", + name: 'file.txt', + type: 'text/plain', size: 37967, - uri: "file://text.png", + uri: 'file://text.png', }, ); @@ -49,9 +49,9 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. ```client-flutter import 'package:appwrite/appwrite.dart'; - void main() { // Init SDK + void main() { final client = Client() - .setProject(''); + .setProject(''); // Your project ID final storage = Storage(client); @@ -68,7 +68,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. func main() async throws { let client = Client() - .setProject("") + .setProject("") // Your project ID let storage = Storage(client) @@ -91,7 +91,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. suspend fun main() { val client = Client(applicationContext) - .setProject("") // Your project ID + .setProject("") // Your project ID val storage = Storage(client) @@ -110,12 +110,15 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. Cookie: Content-Type: multipart/form-data; boundary=---1234 Content-Length: + -----1234 - Content-Disposition: form-data; name='fileId' + Content-Disposition: form-data; name='fileId' + -----1234 Content-Disposition: form-data; name='file'; filename='image.jpg' Content-Type: image/jpg + -----1234 ``` @@ -124,7 +127,7 @@ To upload a file, add this to you web, Flutter, Apple, or Android app. import { Client, Storage, ID } from 'react-native-appwrite'; const client = new Client() - .setProject(''); // Your project ID + .setProject(''); // Your project ID const storage = new Storage(client); @@ -153,14 +156,14 @@ To download a file, use the `getFileDownload` method. {% multicode %} ```client-web -import { Client, Storage } from 'appwrite'; +import { Client, Storage } from "appwrite"; const client = new Client(); const storage = new Storage(client); client - .setProject('') // Your project ID + .setProject('') // Your project ID ; const result = storage.getFileDownload('', ''); @@ -249,6 +252,12 @@ class MainActivity : AppCompatActivity() { } ``` +```http +GET https://cloud.appwrite.io/v1/storage/buckets//files//download HTTP/1.1 +X-Appwrite-Project: "" +X-Appwrite-Response-Format: 1.5.0 +``` + ```client-react-native import { Client, Storage, ID } from 'react-native-appwrite';