Skip to content

Commit d572ce0

Browse files
feat: introduce 0.15.x support
1 parent 516eeda commit d572ce0

File tree

87 files changed

+4676
-4000
lines changed

Some content is hidden

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

87 files changed

+4676
-4000
lines changed

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Appwrite Web SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-web.svg?style=flat-square)
4-
![Version](https://img.shields.io/badge/api%20version-0.14.0-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-0.15.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 0.14.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-web/releases).**
9+
**This SDK is compatible with Appwrite server version 0.15.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-web/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 Web 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

@@ -25,15 +25,15 @@ npm install appwrite --save
2525
If you're using a bundler (like [Rollup](https://rollupjs.org/) or [webpack](https://webpack.js.org/)), you can import the Appwrite module when you need it:
2626

2727
```js
28-
import { Appwrite } from "appwrite";
28+
import { Client, Account } from "appwrite";
2929
```
3030

3131
### CDN
3232

3333
To install with a CDN (content delivery network) add the following scripts to the bottom of your <body> tag, but before you use any Appwrite services:
3434

3535
```html
36-
<script src="https://cdn.jsdelivr.net/npm/appwrite@8.0.1"></script>
36+
<script src="https://cdn.jsdelivr.net/npm/appwrite@9.0.0"></script>
3737
```
3838

3939

@@ -49,9 +49,9 @@ Initialize your SDK with your Appwrite server API endpoint and project ID which
4949

5050
```js
5151
// Init your Web SDK
52-
const sdk = new Appwrite();
52+
const client = new Client();
5353

54-
sdk
54+
client
5555
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
5656
.setProject('455x34dfkj') // Your project ID
5757
;
@@ -61,8 +61,10 @@ sdk
6161
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.
6262

6363
```js
64+
const account = new Account(client);
65+
6466
// Register User
65-
sdk.account.create('[USER_ID]', '[email protected]', 'password', 'Jane Doe')
67+
account.create('[USER_ID]', '[email protected]', 'password', 'Jane Doe')
6668
.then(function (response) {
6769
console.log(response);
6870
}, function (error) {
@@ -74,15 +76,17 @@ sdk.account.create('[USER_ID]', '[email protected]', 'password', 'Jane Doe')
7476
### Full Example
7577
```js
7678
// Init your Web SDK
77-
const sdk = new Appwrite();
79+
const client = new Client();
7880

79-
sdk
81+
client
8082
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
8183
.setProject('455x34dfkj')
8284
;
8385

86+
const account = new Account(client);
87+
8488
// Register User
85-
sdk.account.create('[USER_ID]', '[email protected]', 'password', 'Jane Doe')
89+
account.create('[USER_ID]', '[email protected]', 'password', 'Jane Doe')
8690
.then(function (response) {
8791
console.log(response);
8892
}, function (error) {

docs/examples/account/create-anonymous-session.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
const sdk = new Appwrite();
1+
import { Client, Account } from "appwrite";
22

3-
sdk
3+
const client = new Client();
4+
5+
const account = new Account(client);
6+
7+
client
48
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
59
.setProject('5df5acd0d48c2') // Your project ID
610
;
711

8-
let promise = sdk.account.createAnonymousSession();
12+
const promise = account.createAnonymousSession();
913

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

docs/examples/account/create-j-w-t.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
const sdk = new Appwrite();
1+
import { Client, Account } from "appwrite";
22

3-
sdk
3+
const client = new Client();
4+
5+
const account = new Account(client);
6+
7+
client
48
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
59
.setProject('5df5acd0d48c2') // Your project ID
610
;
711

8-
let promise = sdk.account.createJWT();
12+
const promise = account.createJWT();
913

1014
promise.then(function (response) {
1115
console.log(response); // Success

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
const sdk = new Appwrite();
1+
import { Client, Account } from "appwrite";
22

3-
sdk
3+
const client = new Client();
4+
5+
const account = new Account(client);
6+
7+
client
48
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
59
.setProject('5df5acd0d48c2') // Your project ID
610
;
711

8-
let promise = sdk.account.createMagicURLSession('[USER_ID]', '[email protected]');
12+
const promise = account.createMagicURLSession('[USER_ID]', '[email protected]');
913

1014
promise.then(function (response) {
1115
console.log(response); // Success
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
const sdk = new Appwrite();
1+
import { Client, Account } from "appwrite";
22

3-
sdk
3+
const client = new Client();
4+
5+
const account = new Account(client);
6+
7+
client
48
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
59
.setProject('5df5acd0d48c2') // Your project ID
610
;
711

812
// Go to OAuth provider login page
9-
sdk.account.createOAuth2Session('amazon');
13+
account.createOAuth2Session('amazon');
1014

docs/examples/database/delete-document.md renamed to docs/examples/account/create-phone-session.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
const sdk = new Appwrite();
1+
import { Client, Account } from "appwrite";
22

3-
sdk
3+
const client = new Client();
4+
5+
const account = new Account(client);
6+
7+
client
48
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
59
.setProject('5df5acd0d48c2') // Your project ID
610
;
711

8-
let promise = sdk.database.deleteDocument('[COLLECTION_ID]', '[DOCUMENT_ID]');
12+
const promise = account.createPhoneSession('[USER_ID]', '');
913

1014
promise.then(function (response) {
1115
console.log(response); // Success

docs/examples/account/create-session.md renamed to docs/examples/account/create-phone-verification.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
const sdk = new Appwrite();
1+
import { Client, Account } from "appwrite";
22

3-
sdk
3+
const client = new Client();
4+
5+
const account = new Account(client);
6+
7+
client
48
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
59
.setProject('5df5acd0d48c2') // Your project ID
610
;
711

8-
let promise = sdk.account.createSession('[email protected]', 'password');
12+
const promise = account.createPhoneVerification();
913

1014
promise.then(function (response) {
1115
console.log(response); // Success

docs/examples/account/create-recovery.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
const sdk = new Appwrite();
1+
import { Client, Account } from "appwrite";
22

3-
sdk
3+
const client = new Client();
4+
5+
const account = new Account(client);
6+
7+
client
48
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
59
.setProject('5df5acd0d48c2') // Your project ID
610
;
711

8-
let promise = sdk.account.createRecovery('[email protected]', 'https://example.com');
12+
const promise = account.createRecovery('[email protected]', 'https://example.com');
913

1014
promise.then(function (response) {
1115
console.log(response); // Success

docs/examples/account/create-verification.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
const sdk = new Appwrite();
1+
import { Client, Account } from "appwrite";
22

3-
sdk
3+
const client = new Client();
4+
5+
const account = new Account(client);
6+
7+
client
48
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
59
.setProject('5df5acd0d48c2') // Your project ID
610
;
711

8-
let promise = sdk.account.createVerification('https://example.com');
12+
const promise = account.createVerification('https://example.com');
913

1014
promise.then(function (response) {
1115
console.log(response); // Success

0 commit comments

Comments
 (0)