You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**This SDK is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-react-native/releases).**
9
+
**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-react-native/releases).**
10
10
11
11
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the React Native SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
If this is your first time using Appwrite, create an account and create your first project.
29
29
30
30
Then, under **Add a platform**, add a **Android app** or a **Apple app**. You can skip optional steps.
31
31
32
32
#### iOS steps
33
+
33
34
Add your app **name** and **Bundle ID**. You can find your **Bundle Identifier** in the **General** tab for your app's primary target in XCode. For Expo projects you can set or find it on **app.json** file at your project's root directory.
Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page.
51
53
52
54
```js
@@ -62,6 +64,7 @@ client
62
64
```
63
65
64
66
### Make Your First Request
67
+
65
68
Once your SDK object is set, access any of the Appwrite services and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section.
The Appwrite React Native SDK provides type safety when working with database documents through generic methods. Methods like `listDocuments`, `getDocument`, and others accept a generic type parameter that allows you to specify your custom model type for full type safety.
console.log(`Book: ${book.name} by ${book.author}`); // Now you have full type safety
132
+
});
133
+
} catch (error) {
134
+
console.error('Appwrite error:', error);
135
+
}
136
+
```
137
+
138
+
**JavaScript (with JSDoc for type hints):**
139
+
```javascript
140
+
/**
141
+
* @typedef{Object}Book
142
+
* @property{string}name
143
+
* @property{string}author
144
+
* @property{string}[releaseYear]
145
+
* @property{string}[category]
146
+
* @property{string[]}[genre]
147
+
* @property{boolean}isCheckedOut
148
+
*/
149
+
150
+
constdatabases=newDatabases(client);
151
+
152
+
try {
153
+
/**@type{Models.DocumentList<Book>}*/
154
+
constdocuments=awaitdatabases.listDocuments(
155
+
'your-database-id',
156
+
'your-collection-id'
157
+
);
158
+
159
+
documents.documents.forEach(book=> {
160
+
console.log(`Book: ${book.name} by ${book.author}`); // Type hints available in IDE
161
+
});
162
+
} catch (error) {
163
+
console.error('Appwrite error:', error);
164
+
}
165
+
```
166
+
167
+
**Tip**: You can use the `appwrite types` command to automatically generate TypeScript interfaces based on your Appwrite database schema. Learn more about [type generation](https://appwrite.io/docs/products/databases/type-generation).
168
+
169
+
### Error Handling
170
+
171
+
The Appwrite React Native SDK raises an `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching the exception and present the `message` to the user or handle it yourself based on the provided error information. Below is an example.
This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request.
0 commit comments