-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from appwrite/dev
1.5.x support
- Loading branch information
Showing
128 changed files
with
2,373 additions
and
12,598 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# Change Log | ||
# Change log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# Appwrite React Native SDK [BETA] | ||
# Appwrite React Native SDK | ||
|
||
![License](https://img.shields.io/github/license/appwrite/sdk-for-react-native.svg?style=flat-square) | ||
![Version](https://img.shields.io/badge/api%20version-1.4.12-blue.svg?style=flat-square) | ||
![Version](https://img.shields.io/badge/api%20version-1.5.4-blue.svg?style=flat-square) | ||
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) | ||
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) | ||
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) | ||
|
||
**This SDK is compatible with Appwrite server version 1.4.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-react-native/releases).** | ||
**This SDK is compatible with Appwrite server version 1.5.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-react-native/releases).** | ||
|
||
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) | ||
|
||
|
@@ -20,6 +20,8 @@ To install | |
npx expo install react-native-appwrite react-native-url-polyfill | ||
``` | ||
|
||
|
||
|
||
## Getting Started | ||
|
||
### Add your Platform | ||
|
@@ -28,19 +30,28 @@ If this is your first time using Appwrite, create an account and create your fir | |
Then, under **Add a platform**, add a **Android app** or a **Apple app**. You can skip optional steps. | ||
|
||
#### iOS steps | ||
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. | ||
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. | ||
|
||
#### Android steps | ||
Add your app's **name** and **package name**, Your package name is generally the **applicationId** in your app-level `build.gradle` file. | ||
Add your app's **name** and **package name**, Your package name is generally the **applicationId** in your app-level **build.gradle** file. For Expo projects you can set or find it on **app.json** file at your project's root directory. | ||
|
||
## Setup | ||
|
||
On `index.js` add import for `react-native-url-polyfill` | ||
|
||
``` | ||
import 'react-native-url-polyfill/auto' | ||
``` | ||
|
||
> If you are building for iOS, don't forget to install pods | ||
> `cd ios && pod install && cd ..` | ||
### Init your SDK | ||
Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page. | ||
|
||
```js | ||
import { Client } from 'react-native-appwrite'; | ||
// Init your react-native SDK | ||
// Init your React Native SDK | ||
const client = new Client(); | ||
|
||
client | ||
|
@@ -63,12 +74,13 @@ account.create(ID.unique(), '[email protected]', 'password', 'Jane Doe') | |
}, function (error) { | ||
console.log(error); | ||
}); | ||
|
||
``` | ||
|
||
### Full Example | ||
```js | ||
import { Client, Account } from 'react-native-appwrite'; | ||
// Init your Web SDK | ||
// Init your React Native SDK | ||
const client = new Client(); | ||
|
||
client | ||
|
@@ -95,9 +107,10 @@ You can use the following resources to learn more and get help | |
- 💬 [Discord Community](https://appwrite.io/discord) | ||
- 🚂 [Appwrite React Native Playground](https://github.com/appwrite/playground-for-react-native) | ||
|
||
|
||
## Contribution | ||
|
||
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. | ||
|
||
## License | ||
Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. | ||
|
||
Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,11 @@ | ||
import { Client, Account } from "appwrite"; | ||
import { Client, Account } from "react-native-appwrite"; | ||
|
||
const client = new Client(); | ||
const client = new Client() | ||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2'); // Your project ID | ||
|
||
const account = new Account(client); | ||
|
||
client | ||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2') // Your project ID | ||
; | ||
|
||
const promise = account.createAnonymousSession(); | ||
const result = await account.createAnonymousSession(); | ||
|
||
promise.then(function (response) { | ||
console.log(response); // Success | ||
}, function (error) { | ||
console.log(error); // Failure | ||
}); | ||
console.log(response); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Client, Account } from "react-native-appwrite"; | ||
|
||
const client = new Client() | ||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2'); // Your project ID | ||
|
||
const account = new Account(client); | ||
|
||
const result = await account.createEmailPasswordSession( | ||
'[email protected]', // email | ||
'password' // password | ||
); | ||
|
||
console.log(response); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Client, Account } from "react-native-appwrite"; | ||
|
||
const client = new Client() | ||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2'); // Your project ID | ||
|
||
const account = new Account(client); | ||
|
||
const result = await account.createEmailToken( | ||
'<USER_ID>', // userId | ||
'[email protected]', // email | ||
false // phrase (optional) | ||
); | ||
|
||
console.log(response); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,11 @@ | ||
import { Client, Account } from "appwrite"; | ||
import { Client, Account } from "react-native-appwrite"; | ||
|
||
const client = new Client(); | ||
const client = new Client() | ||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2'); // Your project ID | ||
|
||
const account = new Account(client); | ||
|
||
client | ||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2') // Your project ID | ||
; | ||
|
||
const promise = account.createJWT(); | ||
const result = await account.createJWT(); | ||
|
||
promise.then(function (response) { | ||
console.log(response); // Success | ||
}, function (error) { | ||
console.log(error); // Failure | ||
}); | ||
console.log(response); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Client, Account } from "react-native-appwrite"; | ||
|
||
const client = new Client() | ||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2'); // Your project ID | ||
|
||
const account = new Account(client); | ||
|
||
const result = await account.createMagicURLToken( | ||
'<USER_ID>', // userId | ||
'[email protected]', // email | ||
'https://example.com', // url (optional) | ||
false // phrase (optional) | ||
); | ||
|
||
console.log(response); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Client, Account, AuthenticatorType } from "react-native-appwrite"; | ||
|
||
const client = new Client() | ||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2'); // Your project ID | ||
|
||
const account = new Account(client); | ||
|
||
const result = await account.createMfaAuthenticator( | ||
AuthenticatorType.Totp // type | ||
); | ||
|
||
console.log(response); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Client, Account, AuthenticationFactor } from "react-native-appwrite"; | ||
|
||
const client = new Client() | ||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2'); // Your project ID | ||
|
||
const account = new Account(client); | ||
|
||
const result = await account.createMfaChallenge( | ||
AuthenticationFactor.Email // factor | ||
); | ||
|
||
console.log(response); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Client, Account } from "react-native-appwrite"; | ||
|
||
const client = new Client() | ||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2'); // Your project ID | ||
|
||
const account = new Account(client); | ||
|
||
const result = await account.createMfaRecoveryCodes(); | ||
|
||
console.log(response); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import { Client, Account } from "appwrite"; | ||
import { Client, Account, OAuthProvider } from "react-native-appwrite"; | ||
|
||
const client = new Client(); | ||
const client = new Client() | ||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2'); // Your project ID | ||
|
||
const account = new Account(client); | ||
|
||
client | ||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2') // Your project ID | ||
; | ||
|
||
// Go to OAuth provider login page | ||
account.createOAuth2Session('amazon'); | ||
account.createOAuth2Session( | ||
OAuthProvider.Amazon, // provider | ||
'https://example.com', // success (optional) | ||
'https://example.com', // failure (optional) | ||
[] // scopes (optional) | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Client, Account, OAuthProvider } from "react-native-appwrite"; | ||
|
||
const client = new Client() | ||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2'); // Your project ID | ||
|
||
const account = new Account(client); | ||
|
||
account.createOAuth2Token( | ||
OAuthProvider.Amazon, // provider | ||
'https://example.com', // success (optional) | ||
'https://example.com', // failure (optional) | ||
[] // scopes (optional) | ||
); | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Client, Account } from "react-native-appwrite"; | ||
|
||
const client = new Client() | ||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2'); // Your project ID | ||
|
||
const account = new Account(client); | ||
|
||
const result = await account.createPhoneToken( | ||
'<USER_ID>', // userId | ||
'+12065550100' // phone | ||
); | ||
|
||
console.log(response); |
Oops, something went wrong.