Skip to content

Commit 0fbc5a6

Browse files
Merge pull request #35 from appwrite/dev
feat: update for appwrite 1.0.0
2 parents 50c070c + 0b9911f commit 0fbc5a6

23 files changed

+337
-75
lines changed

.travis.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
21
language: node_js
32
node_js:
43
- "14.16"
54

65
jobs:
76
include:
8-
- stage: npm release
7+
- stage: NPM RC Release
8+
if: tag == *-RC*
99
node_js: "14.16"
10-
script: echo "Deploying to npm ..."
10+
script: echo "Deploying RC to NPM..."
11+
deploy:
12+
provider: npm
13+
email: $NPM_EMAIL
14+
api_key: $NPM_API_KEY
15+
tag: next
16+
- stage: NPM Release
17+
if: tag != *-RC*
18+
node_js: "14.16"
19+
script: echo "Deploying to NPM..."
1120
deploy:
1221
provider: npm
1322
email: $NPM_EMAIL

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Appwrite Node.js SDK
22

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

1111
> This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code.
1212
If you're looking to integrate from the browser, you should check [appwrite/sdk-for-web](https://github.com/appwrite/sdk-for-web)
@@ -48,7 +48,7 @@ Once your SDK object is set, create any of the Appwrite service objects and choo
4848
```js
4949
let users = new sdk.Users(client);
5050

51-
let promise = users.create('[USER_ID]', '[email protected]', 'password');
51+
let promise = users.create(ID.unique(), '[email protected]', 'password');
5252

5353
promise.then(function (response) {
5454
console.log(response);
@@ -71,7 +71,7 @@ client
7171
;
7272

7373
let users = new sdk.Users(client);
74-
let promise = users.create('[USER_ID]', '[email protected]', 'password');
74+
let promise = users.create(ID.unique(), '[email protected]', 'password');
7575

7676
promise.then(function (response) {
7777
console.log(response);
@@ -87,7 +87,7 @@ The Appwrite Node SDK raises `AppwriteException` object with `message`, `code` a
8787
let users = new sdk.Users(client);
8888

8989
try {
90-
let res = await users.create('[USER_ID]', '[email protected]', 'password');
90+
let res = await users.create(ID.unique(), '[email protected]', 'password');
9191
} catch(e) {
9292
console.log(e.message);
9393
}

docs/examples/account/list-logs.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const sdk = require('node-appwrite');
2+
3+
// Init SDK
4+
const client = new sdk.Client();
5+
6+
const account = new sdk.Account(client);
7+
8+
client
9+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
10+
.setProject('5df5acd0d48c2') // Your project ID
11+
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
12+
;
13+
14+
const promise = account.listLogs();
15+
16+
promise.then(function (response) {
17+
console.log(response);
18+
}, function (error) {
19+
console.log(error);
20+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const sdk = require('node-appwrite');
2+
3+
// Init SDK
4+
const client = new sdk.Client();
5+
6+
const account = new sdk.Account(client);
7+
8+
client
9+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
10+
.setProject('5df5acd0d48c2') // Your project ID
11+
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
12+
;
13+
14+
const promise = account.listSessions();
15+
16+
promise.then(function (response) {
17+
console.log(response);
18+
}, function (error) {
19+
console.log(error);
20+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const sdk = require('node-appwrite');
2+
3+
// Init SDK
4+
const client = new sdk.Client();
5+
6+
const locale = new sdk.Locale(client);
7+
8+
client
9+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
10+
.setProject('5df5acd0d48c2') // Your project ID
11+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12+
;
13+
14+
const promise = locale.listContinents();
15+
16+
promise.then(function (response) {
17+
console.log(response);
18+
}, function (error) {
19+
console.log(error);
20+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const sdk = require('node-appwrite');
2+
3+
// Init SDK
4+
const client = new sdk.Client();
5+
6+
const locale = new sdk.Locale(client);
7+
8+
client
9+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
10+
.setProject('5df5acd0d48c2') // Your project ID
11+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12+
;
13+
14+
const promise = locale.listCountriesEU();
15+
16+
promise.then(function (response) {
17+
console.log(response);
18+
}, function (error) {
19+
console.log(error);
20+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const sdk = require('node-appwrite');
2+
3+
// Init SDK
4+
const client = new sdk.Client();
5+
6+
const locale = new sdk.Locale(client);
7+
8+
client
9+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
10+
.setProject('5df5acd0d48c2') // Your project ID
11+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12+
;
13+
14+
const promise = locale.listCountriesPhones();
15+
16+
promise.then(function (response) {
17+
console.log(response);
18+
}, function (error) {
19+
console.log(error);
20+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const sdk = require('node-appwrite');
2+
3+
// Init SDK
4+
const client = new sdk.Client();
5+
6+
const locale = new sdk.Locale(client);
7+
8+
client
9+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
10+
.setProject('5df5acd0d48c2') // Your project ID
11+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12+
;
13+
14+
const promise = locale.listCountries();
15+
16+
promise.then(function (response) {
17+
console.log(response);
18+
}, function (error) {
19+
console.log(error);
20+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const sdk = require('node-appwrite');
2+
3+
// Init SDK
4+
const client = new sdk.Client();
5+
6+
const locale = new sdk.Locale(client);
7+
8+
client
9+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
10+
.setProject('5df5acd0d48c2') // Your project ID
11+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12+
;
13+
14+
const promise = locale.listCurrencies();
15+
16+
promise.then(function (response) {
17+
console.log(response);
18+
}, function (error) {
19+
console.log(error);
20+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const sdk = require('node-appwrite');
2+
3+
// Init SDK
4+
const client = new sdk.Client();
5+
6+
const locale = new sdk.Locale(client);
7+
8+
client
9+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
10+
.setProject('5df5acd0d48c2') // Your project ID
11+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12+
;
13+
14+
const promise = locale.listLanguages();
15+
16+
promise.then(function (response) {
17+
console.log(response);
18+
}, function (error) {
19+
console.log(error);
20+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const sdk = require('node-appwrite');
2+
3+
// Init SDK
4+
const client = new sdk.Client();
5+
6+
const teams = new sdk.Teams(client);
7+
8+
client
9+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
10+
.setProject('5df5acd0d48c2') // Your project ID
11+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12+
;
13+
14+
const promise = teams.listMemberships('[TEAM_ID]');
15+
16+
promise.then(function (response) {
17+
console.log(response);
18+
}, function (error) {
19+
console.log(error);
20+
});

docs/examples/users/list-logs.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const sdk = require('node-appwrite');
2+
3+
// Init SDK
4+
const client = new sdk.Client();
5+
6+
const users = new sdk.Users(client);
7+
8+
client
9+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
10+
.setProject('5df5acd0d48c2') // Your project ID
11+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12+
;
13+
14+
const promise = users.listLogs('[USER_ID]');
15+
16+
promise.then(function (response) {
17+
console.log(response);
18+
}, function (error) {
19+
console.log(error);
20+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const sdk = require('node-appwrite');
2+
3+
// Init SDK
4+
const client = new sdk.Client();
5+
6+
const users = new sdk.Users(client);
7+
8+
client
9+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
10+
.setProject('5df5acd0d48c2') // Your project ID
11+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12+
;
13+
14+
const promise = users.listMemberships('[USER_ID]');
15+
16+
promise.then(function (response) {
17+
console.log(response);
18+
}, function (error) {
19+
console.log(error);
20+
});

docs/examples/users/list-sessions.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const sdk = require('node-appwrite');
2+
3+
// Init SDK
4+
const client = new sdk.Client();
5+
6+
const users = new sdk.Users(client);
7+
8+
client
9+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
10+
.setProject('5df5acd0d48c2') // Your project ID
11+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12+
;
13+
14+
const promise = users.listSessions('[USER_ID]');
15+
16+
promise.then(function (response) {
17+
console.log(response);
18+
}, function (error) {
19+
console.log(error);
20+
});

0 commit comments

Comments
 (0)