Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add React Native samples to Storage Quick Start #1064

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Changes from 8 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
27f75d5
docs: add client react native code snippet sample to docs/products/st…
choir27 Jun 20, 2024
ebb00f7
docs: update code snippets based on client-react-native manual test
choir27 Jun 21, 2024
6ec110e
docs: add specific parameters for FILE type in client-react-native
choir27 Jun 24, 2024
c7fc26b
docs: add field to uri object in code snippet
choir27 Jun 25, 2024
fe4b26f
docs: update file type object properties with FILE properties from co…
choir27 Jun 25, 2024
678f269
docs: update file object properties in code snippet based on testing …
choir27 Jun 25, 2024
655c0d3
docs: replace double quotes with single quotes, change object to mult…
choir27 Jun 26, 2024
56c1460
docs: replace double quotes with single quotes for react-native-appwrite
choir27 Jun 26, 2024
2ffe92b
docs: replace placeholder [] for <> in code snippets
choir27 Jun 26, 2024
a22e4f7
docs: remove Permission from code snippets to remove optional paramet…
choir27 Jun 27, 2024
7234c11
chore: fix spacing in blog post
choir27 Jun 27, 2024
9598a60
docs: revert flutter, android-kotlin, and client-apple file object pr…
choir27 Jun 28, 2024
6da8fb5
chore: remove extra space
choir27 Jun 28, 2024
b5759ef
update http code snipeet
choir27 Jun 28, 2024
b21be3f
Update src/routes/docs/products/storage/quick-start/+page.markdoc
choir27 Jul 2, 2024
2a7caa3
Update src/routes/docs/products/storage/quick-start/+page.markdoc
choir27 Jul 2, 2024
4e57243
docs: revert web file object to previous iteration, include imports f…
choir27 Jul 2, 2024
180aaa0
docs: replace double quotes for single quotes and update image type f…
choir27 Jul 2, 2024
0280cc3
replace setProject argument with placeholder <PROJECT_ID for consistency
choir27 Jul 2, 2024
dd9610e
Merge branch 'main' into docs-react-native-samples
choir27 Jul 2, 2024
0e45184
Merge branch 'main' into docs-react-native-samples
choir27 Jul 8, 2024
babfa8e
docs: change file comment to sentence case for consistency, update qu…
choir27 Jul 8, 2024
e7f0d1e
Merge branch 'docs-react-native-samples' of https://github.com/appwri…
choir27 Jul 8, 2024
3a8a58d
Merge branch 'main' into docs-react-native-samples
choir27 Jul 15, 2024
113112b
Update src/routes/docs/products/storage/quick-start/+page.markdoc
choir27 Jul 15, 2024
4c001ab
Update src/routes/docs/products/storage/quick-start/+page.markdoc
choir27 Jul 15, 2024
9e24a53
docs: fix duplicate import to ensure accuracy. Add underscore to main…
choir27 Jul 15, 2024
48debf9
docs: remove redundant comment
choir27 Jul 15, 2024
3d32999
Merge branch 'main' into docs-react-native-samples
choir27 Jul 16, 2024
a23eff1
docs: Align comments and replace single quotes for double quotes in k…
choir27 Jul 19, 2024
aa9fd32
docs: update indentation for code snippet
choir27 Jul 19, 2024
27b8aeb
docs: remove setEndpoint from code snippets in storage quick start
choir27 Jul 20, 2024
605ad36
Update src/routes/docs/products/storage/quick-start/+page.markdoc
choir27 Jul 25, 2024
cf823e3
docs: add quotes to match consistency with other code snippet example…
choir27 Aug 13, 2024
dd67e5f
Merge branch 'main' into docs-react-native-samples
choir27 Aug 13, 2024
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
43 changes: 43 additions & 0 deletions src/routes/docs/products/storage/quick-start/+page.markdoc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,34 @@ 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';

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

const storage = new Storage(client);

const promise = await storage.createFile(
'[BUCKET_ID]',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@choir27 We use <> angle brackets universally for placeholders now. I started moving toward this but didn't finish. Make sure you stay consistent!

ID.unique(),
{
name: 'file.jpeg',
type: 'image/jpeg',
uri: 'file:///data/user/0/host.exp.exponent/cache/ExperienceData/text.jpeg',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also make sure the URI is something generic and reasonable :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also ask @lohanidamodar to see if there's inputfiles for react native.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed with @lohanidamodar that there are currently no inputfiles for react native

size: 183799
}, // FILE
Permission.read('any')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure this uses the same params as all the other examples on this page. I think some other examples don't show permission, but if you want to add it here, make sure ALL examples are updated to be consistent!

);


promise.then(function (response) {
console.log(response); // Success
}, function (error) {
console.log(error); // Failure
});
```
{% /multicode %}


Expand Down Expand Up @@ -224,4 +251,20 @@ class MainActivity : AppCompatActivity() {
}
}
```
```client-react-native
import { Client, Storage, ID } from 'react-native-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
;
choir27 marked this conversation as resolved.
Show resolved Hide resolved

const result = storage.getFileDownload('[BUCKET_ID]', '[FILE_ID]');

console.log(result); // Resource URL
```
{% /multicode %}
Loading