node-appwrite 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +6 -6
- package/docs/examples/database/create-boolean-attribute.md +20 -0
- package/docs/examples/database/create-collection.md +1 -1
- package/docs/examples/database/create-document.md +1 -1
- package/docs/examples/database/create-email-attribute.md +20 -0
- package/docs/examples/database/create-enum-attribute.md +20 -0
- package/docs/examples/database/create-float-attribute.md +20 -0
- package/docs/examples/database/create-index.md +20 -0
- package/docs/examples/database/create-integer-attribute.md +20 -0
- package/docs/examples/database/create-ip-attribute.md +20 -0
- package/docs/examples/database/create-string-attribute.md +20 -0
- package/docs/examples/database/create-url-attribute.md +20 -0
- package/docs/examples/database/delete-attribute.md +20 -0
- package/docs/examples/database/delete-index.md +20 -0
- package/docs/examples/database/get-attribute.md +20 -0
- package/docs/examples/database/get-index.md +20 -0
- package/docs/examples/database/list-attributes.md +20 -0
- package/docs/examples/database/list-indexes.md +20 -0
- package/docs/examples/database/update-collection.md +1 -1
- package/docs/examples/functions/create.md +1 -1
- package/docs/examples/{health/get-queue-tasks.md → functions/list-runtimes.md} +2 -2
- package/docs/examples/health/{get-anti-virus.md → get-antivirus.md} +1 -1
- package/docs/examples/storage/create-file.md +1 -1
- package/docs/examples/teams/create.md +1 -1
- package/docs/examples/teams/get-membership.md +20 -0
- package/docs/examples/users/create.md +1 -1
- package/docs/examples/users/update-status.md +1 -1
- package/index.d.ts +771 -141
- package/lib/client.js +3 -3
- package/lib/query.js +34 -0
- package/lib/services/account.js +16 -4
- package/lib/services/database.js +706 -47
- package/lib/services/functions.js +63 -12
- package/lib/services/health.js +4 -22
- package/lib/services/storage.js +21 -2
- package/lib/services/teams.js +89 -30
- package/lib/services/users.js +34 -5
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c)
|
|
1
|
+
Copyright (c) 2022 Appwrite (https://appwrite.io) and individual contributors.
|
|
2
2
|
All rights reserved.
|
|
3
3
|
|
|
4
4
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Appwrite Node.js SDK
|
|
2
2
|
|
|
3
3
|

|
|
4
|
-

|
|
5
5
|
[](https://travis-ci.com/appwrite/sdk-generator)
|
|
6
|
-
[](https://twitter.com/appwrite)
|
|
7
7
|
[](https://appwrite.io/discord)
|
|
8
8
|
|
|
9
|
-
**This SDK is compatible with Appwrite server version 0.
|
|
9
|
+
**This SDK is compatible with Appwrite server version 0.12.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).**
|
|
10
10
|
|
|
11
11
|
> This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code.
|
|
12
12
|
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
|
|
|
48
48
|
```js
|
|
49
49
|
let users = new sdk.Users(client);
|
|
50
50
|
|
|
51
|
-
let promise = users.create('email@example.com', 'password');
|
|
51
|
+
let promise = users.create('[USER_ID]', 'email@example.com', 'password');
|
|
52
52
|
|
|
53
53
|
promise.then(function (response) {
|
|
54
54
|
console.log(response);
|
|
@@ -71,7 +71,7 @@ client
|
|
|
71
71
|
;
|
|
72
72
|
|
|
73
73
|
let users = new sdk.Users(client);
|
|
74
|
-
let promise = users.create('email@example.com', 'password');
|
|
74
|
+
let promise = users.create('[USER_ID]', 'email@example.com', 'password');
|
|
75
75
|
|
|
76
76
|
promise.then(function (response) {
|
|
77
77
|
console.log(response);
|
|
@@ -87,7 +87,7 @@ The Appwrite Node SDK raises `AppwriteException` object with `message`, `code` a
|
|
|
87
87
|
let users = new sdk.Users(client);
|
|
88
88
|
|
|
89
89
|
try {
|
|
90
|
-
let res = await users.create('email@example.com', 'password');
|
|
90
|
+
let res = await users.create('[USER_ID]', 'email@example.com', 'password');
|
|
91
91
|
} catch(e) {
|
|
92
92
|
console.log(e.message);
|
|
93
93
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
let client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
let database = new sdk.Database(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
|
+
let promise = database.createBooleanAttribute('[COLLECTION_ID]', '', false);
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -11,7 +11,7 @@ client
|
|
|
11
11
|
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
12
|
;
|
|
13
13
|
|
|
14
|
-
let promise = database.createCollection('[
|
|
14
|
+
let promise = database.createCollection('[COLLECTION_ID]', '[NAME]', 'document', ["role:all"], ["role:all"]);
|
|
15
15
|
|
|
16
16
|
promise.then(function (response) {
|
|
17
17
|
console.log(response);
|
|
@@ -11,7 +11,7 @@ client
|
|
|
11
11
|
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
12
|
;
|
|
13
13
|
|
|
14
|
-
let promise = database.createDocument('[COLLECTION_ID]', {});
|
|
14
|
+
let promise = database.createDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', {});
|
|
15
15
|
|
|
16
16
|
promise.then(function (response) {
|
|
17
17
|
console.log(response);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
let client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
let database = new sdk.Database(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
|
+
let promise = database.createEmailAttribute('[COLLECTION_ID]', '', false);
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
let client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
let database = new sdk.Database(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
|
+
let promise = database.createEnumAttribute('[COLLECTION_ID]', '', [], false);
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
let client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
let database = new sdk.Database(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
|
+
let promise = database.createFloatAttribute('[COLLECTION_ID]', '', false);
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
let client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
let database = new sdk.Database(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
|
+
let promise = database.createIndex('[COLLECTION_ID]', '', 'key', []);
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
let client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
let database = new sdk.Database(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
|
+
let promise = database.createIntegerAttribute('[COLLECTION_ID]', '', false);
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
let client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
let database = new sdk.Database(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
|
+
let promise = database.createIpAttribute('[COLLECTION_ID]', '', false);
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
let client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
let database = new sdk.Database(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
|
+
let promise = database.createStringAttribute('[COLLECTION_ID]', '', 1, false);
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
let client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
let database = new sdk.Database(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
|
+
let promise = database.createUrlAttribute('[COLLECTION_ID]', '', false);
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
let client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
let database = new sdk.Database(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
|
+
let promise = database.deleteAttribute('[COLLECTION_ID]', '');
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
let client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
let database = new sdk.Database(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
|
+
let promise = database.deleteIndex('[COLLECTION_ID]', '');
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
let client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
let database = new sdk.Database(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
|
+
let promise = database.getAttribute('[COLLECTION_ID]', '');
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
let client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
let database = new sdk.Database(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
|
+
let promise = database.getIndex('[COLLECTION_ID]', '');
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
let client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
let database = new sdk.Database(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
|
+
let promise = database.listAttributes('[COLLECTION_ID]');
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
let client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
let database = new sdk.Database(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
|
+
let promise = database.listIndexes('[COLLECTION_ID]');
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -11,7 +11,7 @@ client
|
|
|
11
11
|
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
12
|
;
|
|
13
13
|
|
|
14
|
-
let promise = database.updateCollection('[COLLECTION_ID]', '[NAME]');
|
|
14
|
+
let promise = database.updateCollection('[COLLECTION_ID]', '[NAME]', 'document');
|
|
15
15
|
|
|
16
16
|
promise.then(function (response) {
|
|
17
17
|
console.log(response);
|
|
@@ -11,7 +11,7 @@ client
|
|
|
11
11
|
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
12
|
;
|
|
13
13
|
|
|
14
|
-
let promise = functions.create('[NAME]', [], '
|
|
14
|
+
let promise = functions.create('[FUNCTION_ID]', '[NAME]', [], 'node-14.5');
|
|
15
15
|
|
|
16
16
|
promise.then(function (response) {
|
|
17
17
|
console.log(response);
|
|
@@ -3,7 +3,7 @@ const sdk = require('node-appwrite');
|
|
|
3
3
|
// Init SDK
|
|
4
4
|
let client = new sdk.Client();
|
|
5
5
|
|
|
6
|
-
let
|
|
6
|
+
let functions = new sdk.Functions(client);
|
|
7
7
|
|
|
8
8
|
client
|
|
9
9
|
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
|
@@ -11,7 +11,7 @@ client
|
|
|
11
11
|
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
12
|
;
|
|
13
13
|
|
|
14
|
-
let promise =
|
|
14
|
+
let promise = functions.listRuntimes();
|
|
15
15
|
|
|
16
16
|
promise.then(function (response) {
|
|
17
17
|
console.log(response);
|
|
@@ -12,7 +12,7 @@ client
|
|
|
12
12
|
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
13
13
|
;
|
|
14
14
|
|
|
15
|
-
let promise = storage.createFile(fs.createReadStream(__dirname + '/file.png'));
|
|
15
|
+
let promise = storage.createFile('[FILE_ID]', fs.createReadStream(__dirname + '/file.png'));
|
|
16
16
|
|
|
17
17
|
promise.then(function (response) {
|
|
18
18
|
console.log(response);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
let client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
let 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
|
+
let promise = teams.getMembership('[TEAM_ID]', '[MEMBERSHIP_ID]');
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -11,7 +11,7 @@ client
|
|
|
11
11
|
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
12
|
;
|
|
13
13
|
|
|
14
|
-
let promise = users.create('email@example.com', 'password');
|
|
14
|
+
let promise = users.create('[USER_ID]', 'email@example.com', 'password');
|
|
15
15
|
|
|
16
16
|
promise.then(function (response) {
|
|
17
17
|
console.log(response);
|
|
@@ -11,7 +11,7 @@ client
|
|
|
11
11
|
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
12
|
;
|
|
13
13
|
|
|
14
|
-
let promise = users.updateStatus('[USER_ID]',
|
|
14
|
+
let promise = users.updateStatus('[USER_ID]', false);
|
|
15
15
|
|
|
16
16
|
promise.then(function (response) {
|
|
17
17
|
console.log(response);
|