Skip to content

Commit b1039ac

Browse files
authored
Merge pull request #71 from appwrite/dev
Dev
2 parents 9e4e014 + 511bf41 commit b1039ac

File tree

297 files changed

+9111
-2849
lines changed

Some content is hidden

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

297 files changed

+9111
-2849
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ node_js:
55
jobs:
66
include:
77
- stage: NPM RC Release
8-
if: tag =~ /-(rc|RC)/
8+
if: tag == *-rc*
99
node_js: "14.16"
1010
script: echo "Deploying RC to NPM..."
1111
deploy:
@@ -14,7 +14,7 @@ jobs:
1414
api_key: $NPM_API_KEY
1515
tag: next
1616
- stage: NPM Release
17-
if: not tag =~ /-(rc|RC)/
17+
if: tag != *-rc*
1818
node_js: "14.16"
1919
script: echo "Deploying to NPM..."
2020
deploy:

LICENSE

Lines changed: 1 addition & 1 deletion
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:

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
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.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-node/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-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)
1313

1414
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 Node.js 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)
1515

16-
![Appwrite](https://appwrite.io/images/github.png)
16+
![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png)
1717

1818
## Installation
1919

@@ -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(sdk.ID.unique(), '[email protected]', undefined, 'password', 'Jane Doe');
51+
let promise = users.create(sdk.ID.unique(), "[email protected]", "+123456789", "password", "Walter O'Brien");
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(sdk.ID.unique(), '[email protected]', undefined, 'password', 'Jane Doe');
74+
let promise = users.create(sdk.ID.unique(), "[email protected]", "+123456789", "password", "Walter O'Brien");
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(sdk.ID.unique(), '[email protected]', 'password');
90+
let res = await users.create(sdk.ID.unique(), "[email protected]", "+123456789", "password", "Walter O'Brien");
9191
} catch(e) {
9292
console.log(e.message);
9393
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const sdk = require('node-appwrite');
2+
3+
const client = new sdk.Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new sdk.Account(client);
8+
9+
const result = await account.createAnonymousSession();
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const sdk = require('node-appwrite');
2+
3+
const client = new sdk.Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new sdk.Account(client);
8+
9+
const result = await account.createEmailPasswordSession(
10+
'[email protected]', // email
11+
'password' // password
12+
);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const sdk = require('node-appwrite');
2+
3+
const client = new sdk.Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new sdk.Account(client);
8+
9+
const result = await account.createEmailToken(
10+
'<USER_ID>', // userId
11+
'[email protected]', // email
12+
false // phrase (optional)
13+
);

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const sdk = require('node-appwrite');
2+
3+
const client = new sdk.Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new sdk.Account(client);
8+
9+
const result = await account.createJWT();
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const sdk = require('node-appwrite');
2+
3+
const client = new sdk.Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new sdk.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+
);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const sdk = require('node-appwrite');
2+
3+
const client = new sdk.Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2') // Your project ID
6+
.setSession(''); // The user session to authenticate with
7+
8+
const account = new sdk.Account(client);
9+
10+
const result = await account.createMfaAuthenticator(
11+
sdk.AuthenticatorType.Totp // type
12+
);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const sdk = require('node-appwrite');
2+
3+
const client = new sdk.Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new sdk.Account(client);
8+
9+
const result = await account.createMfaChallenge(
10+
sdk.AuthenticationFactor.Email // factor
11+
);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const sdk = require('node-appwrite');
2+
3+
const client = new sdk.Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2') // Your project ID
6+
.setSession(''); // The user session to authenticate with
7+
8+
const account = new sdk.Account(client);
9+
10+
const result = await account.createMfaRecoveryCodes();
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const sdk = require('node-appwrite');
2+
3+
const client = new sdk.Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new sdk.Account(client);
8+
9+
const result = await account.createOAuth2Token(
10+
sdk.OAuthProvider.Amazon, // provider
11+
'https://example.com', // success (optional)
12+
'https://example.com', // failure (optional)
13+
[] // scopes (optional)
14+
);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const sdk = require('node-appwrite');
2+
3+
const client = new sdk.Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new sdk.Account(client);
8+
9+
const result = await account.createPhoneToken(
10+
'<USER_ID>', // userId
11+
'+12065550100' // phone
12+
);
Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
const sdk = require('node-appwrite');
22

3-
// Init SDK
4-
const client = new sdk.Client();
5-
6-
const account = new sdk.Account(client);
7-
8-
client
3+
const client = new sdk.Client()
94
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
105
.setProject('5df5acd0d48c2') // Your project ID
11-
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
12-
;
6+
.setSession(''); // The user session to authenticate with
137

14-
const promise = account.createPhoneVerification();
8+
const account = new sdk.Account(client);
159

16-
promise.then(function (response) {
17-
console.log(response);
18-
}, function (error) {
19-
console.log(error);
20-
});
10+
const result = await account.createPhoneVerification();
Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
const sdk = require('node-appwrite');
22

3-
// Init SDK
4-
const client = new sdk.Client();
5-
6-
const account = new sdk.Account(client);
7-
8-
client
3+
const client = new sdk.Client()
94
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
105
.setProject('5df5acd0d48c2') // Your project ID
11-
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
12-
;
6+
.setSession(''); // The user session to authenticate with
137

14-
const promise = account.createRecovery('[email protected]', 'https://example.com');
8+
const account = new sdk.Account(client);
159

16-
promise.then(function (response) {
17-
console.log(response);
18-
}, function (error) {
19-
console.log(error);
20-
});
10+
const result = await account.createRecovery(
11+
'[email protected]', // email
12+
'https://example.com' // url
13+
);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const sdk = require('node-appwrite');
2+
3+
const client = new sdk.Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new sdk.Account(client);
8+
9+
const result = await account.createSession(
10+
'<USER_ID>', // userId
11+
'<SECRET>' // secret
12+
);
Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
const sdk = require('node-appwrite');
22

3-
// Init SDK
4-
const client = new sdk.Client();
5-
6-
const account = new sdk.Account(client);
7-
8-
client
3+
const client = new sdk.Client()
94
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
105
.setProject('5df5acd0d48c2') // Your project ID
11-
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
12-
;
6+
.setSession(''); // The user session to authenticate with
137

14-
const promise = account.createVerification('https://example.com');
8+
const account = new sdk.Account(client);
159

16-
promise.then(function (response) {
17-
console.log(response);
18-
}, function (error) {
19-
console.log(error);
20-
});
10+
const result = await account.createVerification(
11+
'https://example.com' // url
12+
);

docs/examples/account/create.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const sdk = require('node-appwrite');
2+
3+
const client = new sdk.Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2'); // Your project ID
6+
7+
const account = new sdk.Account(client);
8+
9+
const result = await account.create(
10+
'<USER_ID>', // userId
11+
'[email protected]', // email
12+
'', // password
13+
'<NAME>' // name (optional)
14+
);
Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
const sdk = require('node-appwrite');
22

3-
// Init SDK
4-
const client = new sdk.Client();
5-
6-
const account = new sdk.Account(client);
7-
8-
client
3+
const client = new sdk.Client()
94
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
105
.setProject('5df5acd0d48c2') // Your project ID
11-
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
12-
;
6+
.setSession(''); // The user session to authenticate with
137

14-
const promise = account.deleteIdentity('[IDENTITY_ID]');
8+
const account = new sdk.Account(client);
159

16-
promise.then(function (response) {
17-
console.log(response);
18-
}, function (error) {
19-
console.log(error);
20-
});
10+
const result = await account.deleteIdentity(
11+
'<IDENTITY_ID>' // identityId
12+
);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const sdk = require('node-appwrite');
2+
3+
const client = new sdk.Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('5df5acd0d48c2') // Your project ID
6+
.setSession(''); // The user session to authenticate with
7+
8+
const account = new sdk.Account(client);
9+
10+
const result = await account.deleteMfaAuthenticator(
11+
sdk.AuthenticatorType.Totp, // type
12+
'<OTP>' // otp
13+
);
Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
const sdk = require('node-appwrite');
22

3-
// Init SDK
4-
const client = new sdk.Client();
5-
6-
const account = new sdk.Account(client);
7-
8-
client
3+
const client = new sdk.Client()
94
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
105
.setProject('5df5acd0d48c2') // Your project ID
11-
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
12-
;
6+
.setSession(''); // The user session to authenticate with
137

14-
const promise = account.deleteSession('[SESSION_ID]');
8+
const account = new sdk.Account(client);
159

16-
promise.then(function (response) {
17-
console.log(response);
18-
}, function (error) {
19-
console.log(error);
20-
});
10+
const result = await account.deleteSession(
11+
'<SESSION_ID>' // sessionId
12+
);

0 commit comments

Comments
 (0)