Skip to content

Commit a5a5411

Browse files
committed
Upgraded to support Appwrite 0.8
1 parent 866d738 commit a5a5411

Some content is hidden

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

67 files changed

+2571
-3630
lines changed

.travis.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
language: node_js
3+
node_js:
4+
- "14.16"
5+
6+
jobs:
7+
include:
8+
- stage: npm release
9+
node_js: "14.16"
10+
script:
11+
- echo "Installing dependencies ..."
12+
- npm i
13+
- echo "Building library ..."
14+
- npm run build
15+
- echo "Deploying to npm ..."
16+
deploy:
17+
provider: npm
18+
email: $NPM_EMAIL
19+
api_key: $NPM_API_KEY
20+
on:
21+
tags: true

README.md

Lines changed: 74 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Appwrite Web SDK
22

3-
![License](https://img.shields.io/github/license/appwrite/sdk-for-web.svg?v=1)
4-
![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1)
3+
![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.8.0-blue.svg?style=flat-square)
5+
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite_io?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite_io)
6+
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
57

6-
**This SDK is compatible with Appwrite server version 0.7.0. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-web/releases).**
8+
**This SDK is compatible with Appwrite server version 0.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-web/releases).**
79

810
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.
911
Use the Web SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
@@ -21,20 +23,86 @@ To install via [NPM](https://www.npmjs.com/):
2123
npm install appwrite --save
2224
```
2325

24-
If you're using a bundler (like [Browserify](http://browserify.org/) or [webpack](https://webpack.js.org/)), you can import the Appwrite module when you need it:
26+
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:
2527

2628
```js
27-
import * as Appwrite from "appwrite";
29+
import { Appwrite } from "appwrite";
2830
```
2931

3032
### CDN
3133

3234
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:
3335

3436
```html
35-
<script src="https://cdn.jsdelivr.net/npm/appwrite@2.0.0"></script>
37+
<script src="https://cdn.jsdelivr.net/npm/appwrite@3.0.0"></script>
3638
```
3739

40+
41+
## Getting Started
42+
43+
### Add your Web Platform
44+
For you to init your SDK and interact with Appwrite services you need to add a web platform to your project. To add a new platform, go to your Appwrite console, choose the project you created in the step before and click the 'Add Platform' button.
45+
46+
From the options, choose to add a **Web** platform and add your client app hostname. By adding your hostname to your project platform you are allowing cross-domain communication between your project and the Appwrite API.
47+
48+
### Init your SDK
49+
Initialize your SDK code with your project ID which can be found in your project settings page.
50+
51+
```js
52+
// Init your Web SDK
53+
const appwrite = new Appwrite();
54+
55+
appwrite
56+
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
57+
.setProject('455x34dfkj') // Your project ID
58+
.setSelfSigned() // Use only on dev mode with a self-signed SSL cert
59+
;
60+
```
61+
62+
### Make Your First Request
63+
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 section.
64+
65+
```js
66+
// Register User
67+
appwrite
68+
.account.create('[email protected]', 'password', 'Jane Doe')
69+
.then(function (response) {
70+
console.log(response);
71+
}, function (error) {
72+
console.log(error);
73+
});
74+
75+
```
76+
77+
### Full Example
78+
```js
79+
// Init your Web SDK
80+
const appwrite = new Appwrite();
81+
82+
appwrite
83+
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
84+
.setProject('455x34dfkj')
85+
.setSelfSigned() // Use only on dev mode with a self-signed SSL cert
86+
;
87+
88+
// Register User
89+
appwrite
90+
.account.create('[email protected]', 'password', 'Jane Doe')
91+
.then(function (response) {
92+
console.log(response);
93+
}, function (error) {
94+
console.log(error);
95+
});
96+
```
97+
98+
### Learn more
99+
You can use followng resources to learn more and get help
100+
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-flutter)
101+
- 📜 [Appwrite Docs](https://appwrite.io/docs)
102+
- 💬 [Discord Community](https://appwrite.io/discord)
103+
- 🚂 [Appwrite Flutter Playground](https://github.com/appwrite/playground-for-flutter)
104+
105+
38106
## Getting Started
39107

40108
Initialise the Appwrite SDK in your code, and setup your API credentials:

dist/cjs/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "commonjs"
3+
}

dist/esm/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "module"
3+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
let sdk = new Appwrite();
2+
3+
sdk
4+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2') // Your project ID
6+
;
7+
8+
let promise = sdk.account.createAnonymousSession();
9+
10+
promise.then(function (response) {
11+
console.log(response); // Success
12+
}, function (error) {
13+
console.log(error); // Failure
14+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
let sdk = new Appwrite();
2+
3+
sdk
4+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2') // Your project ID
6+
;
7+
8+
let promise = sdk.account.createJWT();
9+
10+
promise.then(function (response) {
11+
console.log(response); // Success
12+
}, function (error) {
13+
console.log(error); // Failure
14+
});

docs/examples/account/create-recovery.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ let sdk = new Appwrite();
33
sdk
44
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
55
.setProject('5df5acd0d48c2') // Your project ID
6+
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
67
;
78

89
let promise = sdk.account.createRecovery('[email protected]', 'https://example.com');

docs/examples/account/create-verification.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ let sdk = new Appwrite();
33
sdk
44
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
55
.setProject('5df5acd0d48c2') // Your project ID
6+
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
67
;
78

89
let promise = sdk.account.createVerification('https://example.com');

docs/examples/account/delete-session.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ let sdk = new Appwrite();
33
sdk
44
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
55
.setProject('5df5acd0d48c2') // Your project ID
6+
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
67
;
78

89
let promise = sdk.account.deleteSession('[SESSION_ID]');

docs/examples/account/delete-sessions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ let sdk = new Appwrite();
33
sdk
44
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
55
.setProject('5df5acd0d48c2') // Your project ID
6+
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
67
;
78

89
let promise = sdk.account.deleteSessions();

0 commit comments

Comments
 (0)