Skip to content

Commit 221a925

Browse files
committed
1.5.x support
1 parent d53b216 commit 221a925

File tree

128 files changed

+2359
-12595
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+2359
-12595
lines changed

Diff for: .github/workflows/publish.yml

+13-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
release:
55
types: [published]
66
workflow_dispatch:
7-
87

98
jobs:
109
publish:
@@ -20,14 +19,24 @@ jobs:
2019
node-version: '20.x'
2120
registry-url: 'https://registry.npmjs.org'
2221

22+
# Determine release tag based on the tag name
23+
- name: Determine release tag
24+
id: release_tag
25+
run: |
26+
if [[ "$" == *"-rc"* ]]; then
27+
echo "tag=next" >> "$GITHUB_OUTPUT"
28+
else
29+
echo "tag=latest" >> "$GITHUB_OUTPUT"
30+
fi
31+
2332
# Install dependencies (if any) and build your project (if necessary)
2433
- name: Install dependencies and build
2534
run: |
2635
npm install
2736
npm run build
2837
29-
# Publish to NPM
38+
# Publish to NPM with the appropriate tag
3039
- name: Publish
31-
run: npm publish
40+
run: npm publish --tag $
3241
env:
33-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
42+
NODE_AUTH_TOKEN: $

Diff for: CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# Change Log
1+
# Change log

Diff for: LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2023 Appwrite (https://appwrite.io) and individual contributors.
1+
Copyright (c) 2024 Appwrite (https://appwrite.io) and individual contributors.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Diff for: README.md

+21-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Appwrite React Native SDK [BETA]
1+
# Appwrite React Native SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-react-native.svg?style=flat-square)
4-
![Version](https://img.shields.io/badge/api%20version-1.4.12-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-1.5.0-blue.svg?style=flat-square)
55
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
66
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
77
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
88

9-
**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).**
9+
**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).**
1010

1111
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)
1212

@@ -20,6 +20,8 @@ To install
2020
npx expo install react-native-appwrite react-native-url-polyfill
2121
```
2222

23+
24+
2325
## Getting Started
2426

2527
### Add your Platform
@@ -31,16 +33,25 @@ Then, under **Add a platform**, add a **Android app** or a **Apple app**. You ca
3133
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.
3234

3335
#### Android steps
34-
Add your app's **name** and **package name**, Your package name is generally the **applicationId** in your app-level `build.gradle` file.
36+
Add your app's **name** and **package name**, Your package name is generally the **applicationId** in your app-level [build.gradle](https://github.com/appwrite/playground-for-flutter/blob/master/android/app/build.gradle#L41) file.
3537

3638
## Setup
3739

40+
On `index.js` add import for `react-native-url-polyfill`
41+
42+
```
43+
import 'react-native-url-polyfill/auto'
44+
```
45+
46+
> If you are building for iOS, don't forget to install pods
47+
> `cd ios && pod install && cd ..`
48+
3849
### Init your SDK
3950
Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page.
4051

4152
```js
4253
import { Client } from 'react-native-appwrite';
43-
// Init your react-native SDK
54+
// Init your Web SDK
4455
const client = new Client();
4556

4657
client
@@ -63,6 +74,7 @@ account.create(ID.unique(), '[email protected]', 'password', 'Jane Doe')
6374
}, function (error) {
6475
console.log(error);
6576
});
77+
6678
```
6779

6880
### Full Example
@@ -90,14 +102,15 @@ account.create(ID.unique(), '[email protected]', 'password', 'Jane Doe')
90102

91103
### Learn more
92104
You can use the following resources to learn more and get help
93-
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/quick-starts/react-native)
105+
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/quick-starts/react-native)```
94106
- 📜 [Appwrite Docs](https://appwrite.io/docs)
95107
- 💬 [Discord Community](https://appwrite.io/discord)
96108
- 🚂 [Appwrite React Native Playground](https://github.com/appwrite/playground-for-react-native)
97109

98-
99110
## Contribution
111+
100112
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.
101113

102114
## License
103-
Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information.
115+
116+
Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information.

Diff for: docs/examples/account/create-anonymous-session.md

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
1-
import { Client, Account } from "appwrite";
1+
import { Client, Account } from "react-native-appwrite";
22

3-
const client = new Client();
3+
const client = new Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
46

57
const account = new Account(client);
68

7-
client
8-
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9-
.setProject('5df5acd0d48c2') // Your project ID
10-
;
11-
12-
const promise = account.createAnonymousSession();
9+
const result = await account.createAnonymousSession();
1310

14-
promise.then(function (response) {
15-
console.log(response); // Success
16-
}, function (error) {
17-
console.log(error); // Failure
18-
});
11+
console.log(response);
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Client, Account } from "react-native-appwrite";
2+
3+
const client = new Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new Account(client);
8+
9+
const result = await account.createEmailPasswordSession(
10+
'[email protected]', // email
11+
'password' // password
12+
);
13+
14+
console.log(response);

Diff for: docs/examples/account/create-email-session.md

-18
This file was deleted.

Diff for: docs/examples/account/create-email-token.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Client, Account } from "react-native-appwrite";
2+
3+
const client = new Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new Account(client);
8+
9+
const result = await account.createEmailToken(
10+
'<USER_ID>', // userId
11+
'[email protected]', // email
12+
false // phrase (optional)
13+
);
14+
15+
console.log(response);

Diff for: docs/examples/account/create-j-w-t.md

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
1-
import { Client, Account } from "appwrite";
1+
import { Client, Account } from "react-native-appwrite";
22

3-
const client = new Client();
3+
const client = new Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
46

57
const account = new Account(client);
68

7-
client
8-
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9-
.setProject('5df5acd0d48c2') // Your project ID
10-
;
11-
12-
const promise = account.createJWT();
9+
const result = await account.createJWT();
1310

14-
promise.then(function (response) {
15-
console.log(response); // Success
16-
}, function (error) {
17-
console.log(error); // Failure
18-
});
11+
console.log(response);

Diff for: docs/examples/account/create-magic-u-r-l-session.md

-18
This file was deleted.

Diff for: docs/examples/account/create-magic-u-r-l-token.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Client, Account } from "react-native-appwrite";
2+
3+
const client = new Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new Account(client);
8+
9+
const result = await account.createMagicURLToken(
10+
'<USER_ID>', // userId
11+
'[email protected]', // email
12+
'https://example.com', // url (optional)
13+
false // phrase (optional)
14+
);
15+
16+
console.log(response);

Diff for: docs/examples/account/create-mfa-authenticator.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Client, Account, AuthenticatorType } from "react-native-appwrite";
2+
3+
const client = new Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new Account(client);
8+
9+
const result = await account.createMfaAuthenticator(
10+
AuthenticatorType.Totp // type
11+
);
12+
13+
console.log(response);

Diff for: docs/examples/account/create-mfa-challenge.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Client, Account, AuthenticationFactor } from "react-native-appwrite";
2+
3+
const client = new Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new Account(client);
8+
9+
const result = await account.createMfaChallenge(
10+
AuthenticationFactor.Email // factor
11+
);
12+
13+
console.log(response);

Diff for: docs/examples/account/create-mfa-recovery-codes.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Client, Account } from "react-native-appwrite";
2+
3+
const client = new Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new Account(client);
8+
9+
const result = await account.createMfaRecoveryCodes();
10+
11+
console.log(response);

Diff for: docs/examples/account/create-o-auth2session.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
import { Client, Account } from "appwrite";
1+
import { Client, Account, OAuthProvider } from "react-native-appwrite";
22

3-
const client = new Client();
3+
const client = new Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
46

57
const account = new Account(client);
68

7-
client
8-
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9-
.setProject('5df5acd0d48c2') // Your project ID
10-
;
11-
12-
// Go to OAuth provider login page
13-
account.createOAuth2Session('amazon');
9+
account.createOAuth2Session(
10+
OAuthProvider.Amazon, // provider
11+
'https://example.com', // success (optional)
12+
'https://example.com', // failure (optional)
13+
[] // scopes (optional)
14+
);
1415

Diff for: docs/examples/account/create-o-auth2token.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Client, Account, OAuthProvider } from "react-native-appwrite";
2+
3+
const client = new Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new Account(client);
8+
9+
account.createOAuth2Token(
10+
OAuthProvider.Amazon, // provider
11+
'https://example.com', // success (optional)
12+
'https://example.com', // failure (optional)
13+
[] // scopes (optional)
14+
);
15+

Diff for: docs/examples/account/create-phone-session.md

-18
This file was deleted.

Diff for: docs/examples/account/create-phone-token.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Client, Account } from "react-native-appwrite";
2+
3+
const client = new Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new Account(client);
8+
9+
const result = await account.createPhoneToken(
10+
'<USER_ID>', // userId
11+
'+12065550100' // phone
12+
);
13+
14+
console.log(response);

0 commit comments

Comments
 (0)