Skip to content

Commit

Permalink
Merge pull request #12 from appwrite/dev
Browse files Browse the repository at this point in the history
1.5.x support
  • Loading branch information
lohanidamodar authored May 5, 2024
2 parents d53b216 + 43cb69e commit 897b6cf
Show file tree
Hide file tree
Showing 128 changed files with 2,373 additions and 12,598 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
release:
types: [published]
workflow_dispatch:


jobs:
publish:
Expand All @@ -20,14 +19,24 @@ jobs:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

# Determine release tag based on the tag name
- name: Determine release tag
id: release_tag
run: |
if [[ "${{ github.ref }}" == *"-rc"* ]] || [[ "${{ github.ref }}" == *"-RC"* ]]; then
echo "tag=next" >> "$GITHUB_OUTPUT"
else
echo "tag=latest" >> "$GITHUB_OUTPUT"
fi
# Install dependencies (if any) and build your project (if necessary)
- name: Install dependencies and build
run: |
npm install
npm run build
# Publish to NPM
# Publish to NPM with the appropriate tag
- name: Publish
run: npm publish
run: npm publish --tag ${{ steps.release_tag.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Change Log
# Change log
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2023 Appwrite (https://appwrite.io) and individual contributors.
Copyright (c) 2024 Appwrite (https://appwrite.io) and individual contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
31 changes: 22 additions & 9 deletions README.md
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)

Expand All @@ -20,6 +20,8 @@ To install
npx expo install react-native-appwrite react-native-url-polyfill
```



## Getting Started

### Add your Platform
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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.
19 changes: 6 additions & 13 deletions docs/examples/account/create-anonymous-session.md
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);
14 changes: 14 additions & 0 deletions docs/examples/account/create-email-password-session.md
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);
18 changes: 0 additions & 18 deletions docs/examples/account/create-email-session.md

This file was deleted.

15 changes: 15 additions & 0 deletions docs/examples/account/create-email-token.md
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);
19 changes: 6 additions & 13 deletions docs/examples/account/create-j-w-t.md
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);
18 changes: 0 additions & 18 deletions docs/examples/account/create-magic-u-r-l-session.md

This file was deleted.

16 changes: 16 additions & 0 deletions docs/examples/account/create-magic-u-r-l-token.md
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);
13 changes: 13 additions & 0 deletions docs/examples/account/create-mfa-authenticator.md
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);
13 changes: 13 additions & 0 deletions docs/examples/account/create-mfa-challenge.md
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);
11 changes: 11 additions & 0 deletions docs/examples/account/create-mfa-recovery-codes.md
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);
19 changes: 10 additions & 9 deletions docs/examples/account/create-o-auth2session.md
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)
);

15 changes: 15 additions & 0 deletions docs/examples/account/create-o-auth2token.md
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)
);

18 changes: 0 additions & 18 deletions docs/examples/account/create-phone-session.md

This file was deleted.

14 changes: 14 additions & 0 deletions docs/examples/account/create-phone-token.md
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);
Loading

0 comments on commit 897b6cf

Please sign in to comment.