node-appwrite 2.5.0 → 4.0.1
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/.github/ISSUE_TEMPLATE/bug.yaml +82 -0
- package/.github/ISSUE_TEMPLATE/documentation.yaml +32 -0
- package/.github/ISSUE_TEMPLATE/feature.yaml +40 -0
- 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-tag.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 +1661 -242
- package/index.js +3 -1
- package/lib/client.js +5 -5
- 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 +93 -34
- package/lib/services/users.js +34 -5
- package/package.json +2 -2
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
name: '🐛 Bug Report'
|
|
2
|
+
description: 'Submit a bug report to help us improve'
|
|
3
|
+
title: '🐛 Bug Report: '
|
|
4
|
+
labels: [bug]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: |
|
|
9
|
+
Thanks for taking the time to fill out our bug report form 🙏
|
|
10
|
+
- type: textarea
|
|
11
|
+
id: steps-to-reproduce
|
|
12
|
+
validations:
|
|
13
|
+
required: true
|
|
14
|
+
attributes:
|
|
15
|
+
label: '👟 Reproduction steps'
|
|
16
|
+
description: 'How do you trigger this bug? Please walk us through it step by step.'
|
|
17
|
+
placeholder: 'When I ...'
|
|
18
|
+
- type: textarea
|
|
19
|
+
id: expected-behavior
|
|
20
|
+
validations:
|
|
21
|
+
required: true
|
|
22
|
+
attributes:
|
|
23
|
+
label: '👍 Expected behavior'
|
|
24
|
+
description: 'What did you think would happen?'
|
|
25
|
+
placeholder: 'It should ...'
|
|
26
|
+
- type: textarea
|
|
27
|
+
id: actual-behavior
|
|
28
|
+
validations:
|
|
29
|
+
required: true
|
|
30
|
+
attributes:
|
|
31
|
+
label: '👎 Actual Behavior'
|
|
32
|
+
description: 'What did actually happen? Add screenshots, if applicable.'
|
|
33
|
+
placeholder: 'It actually ...'
|
|
34
|
+
- type: dropdown
|
|
35
|
+
id: appwrite-version
|
|
36
|
+
attributes:
|
|
37
|
+
label: '🎲 Appwrite version'
|
|
38
|
+
description: 'What version of Appwrite are you running?'
|
|
39
|
+
options:
|
|
40
|
+
- Version 0.10.x
|
|
41
|
+
- Version 0.9.x
|
|
42
|
+
- Version 0.8.x
|
|
43
|
+
- Version 0.7.x
|
|
44
|
+
- Version 0.6.x
|
|
45
|
+
- Different version (specify in environment)
|
|
46
|
+
validations:
|
|
47
|
+
required: true
|
|
48
|
+
- type: dropdown
|
|
49
|
+
id: operating-system
|
|
50
|
+
attributes:
|
|
51
|
+
label: '💻 Operating system'
|
|
52
|
+
description: 'What OS is your server / device running on?'
|
|
53
|
+
options:
|
|
54
|
+
- Linux
|
|
55
|
+
- MacOS
|
|
56
|
+
- Windows
|
|
57
|
+
- Something else
|
|
58
|
+
validations:
|
|
59
|
+
required: true
|
|
60
|
+
- type: textarea
|
|
61
|
+
id: enviromnemt
|
|
62
|
+
validations:
|
|
63
|
+
required: false
|
|
64
|
+
attributes:
|
|
65
|
+
label: '🧱 Your Environment'
|
|
66
|
+
description: 'Is your environment customized in any way?'
|
|
67
|
+
placeholder: 'I use Cloudflare for ...'
|
|
68
|
+
- type: checkboxes
|
|
69
|
+
id: no-duplicate-issues
|
|
70
|
+
attributes:
|
|
71
|
+
label: '👀 Have you spent some time to check if this issue has been raised before?'
|
|
72
|
+
description: 'Have you Googled for a similar issue or checked our older issues for a similar bug?'
|
|
73
|
+
options:
|
|
74
|
+
- label: "I checked and didn't find similar issue"
|
|
75
|
+
required: true
|
|
76
|
+
- type: checkboxes
|
|
77
|
+
id: read-code-of-conduct
|
|
78
|
+
attributes:
|
|
79
|
+
label: '🏢 Have you read the Code of Conduct?'
|
|
80
|
+
options:
|
|
81
|
+
- label: 'I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)'
|
|
82
|
+
required: true
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: '📚 Documentation'
|
|
2
|
+
description: 'Report an issue related to documentation'
|
|
3
|
+
title: '📚 Documentation: '
|
|
4
|
+
labels: [documentation]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: |
|
|
9
|
+
Thanks for taking the time to make our documentation better 🙏
|
|
10
|
+
- type: textarea
|
|
11
|
+
id: issue-description
|
|
12
|
+
validations:
|
|
13
|
+
required: true
|
|
14
|
+
attributes:
|
|
15
|
+
label: '💭 Description'
|
|
16
|
+
description: 'A clear and concise description of what the issue is.'
|
|
17
|
+
placeholder: 'Documentation should not ...'
|
|
18
|
+
- type: checkboxes
|
|
19
|
+
id: no-duplicate-issues
|
|
20
|
+
attributes:
|
|
21
|
+
label: '👀 Have you spent some time to check if this issue has been raised before?'
|
|
22
|
+
description: 'Have you Googled for a similar issue or checked our older issues for a similar bug?'
|
|
23
|
+
options:
|
|
24
|
+
- label: "I checked and didn't find similar issue"
|
|
25
|
+
required: true
|
|
26
|
+
- type: checkboxes
|
|
27
|
+
id: read-code-of-conduct
|
|
28
|
+
attributes:
|
|
29
|
+
label: '🏢 Have you read the Code of Conduct?'
|
|
30
|
+
options:
|
|
31
|
+
- label: 'I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)'
|
|
32
|
+
required: true
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: 🚀 Feature
|
|
2
|
+
description: 'Submit a proposal for a new feature'
|
|
3
|
+
title: '🚀 Feature: '
|
|
4
|
+
labels: [feature]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: |
|
|
9
|
+
Thanks for taking the time to fill out our feature request form 🙏
|
|
10
|
+
- type: textarea
|
|
11
|
+
id: feature-description
|
|
12
|
+
validations:
|
|
13
|
+
required: true
|
|
14
|
+
attributes:
|
|
15
|
+
label: '🔖 Feature description'
|
|
16
|
+
description: 'A clear and concise description of what the feature is.'
|
|
17
|
+
placeholder: 'You should add ...'
|
|
18
|
+
- type: textarea
|
|
19
|
+
id: pitch
|
|
20
|
+
validations:
|
|
21
|
+
required: true
|
|
22
|
+
attributes:
|
|
23
|
+
label: '🎤 Pitch'
|
|
24
|
+
description: 'Please explain why this feature should be implemented and how it would be used. Add examples, if applicable.'
|
|
25
|
+
placeholder: 'In my use-case, ...'
|
|
26
|
+
- type: checkboxes
|
|
27
|
+
id: no-duplicate-issues
|
|
28
|
+
attributes:
|
|
29
|
+
label: '👀 Have you spent some time to check if this issue has been raised before?'
|
|
30
|
+
description: 'Have you Googled for a similar issue or checked our older issues for a similar bug?'
|
|
31
|
+
options:
|
|
32
|
+
- label: "I checked and didn't find similar issue"
|
|
33
|
+
required: true
|
|
34
|
+
- type: checkboxes
|
|
35
|
+
id: read-code-of-conduct
|
|
36
|
+
attributes:
|
|
37
|
+
label: '🏢 Have you read the Code of Conduct?'
|
|
38
|
+
options:
|
|
39
|
+
- label: 'I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)'
|
|
40
|
+
required: true
|
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);
|
|
@@ -12,7 +12,7 @@ client
|
|
|
12
12
|
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
13
13
|
;
|
|
14
14
|
|
|
15
|
-
let promise = functions.createTag('[FUNCTION_ID]', '[COMMAND]', fs.createReadStream(__dirname + '/file.png'))
|
|
15
|
+
let promise = functions.createTag('[FUNCTION_ID]', '[COMMAND]', fs.createReadStream(__dirname + '/file.png'));
|
|
16
16
|
|
|
17
17
|
promise.then(function (response) {
|
|
18
18
|
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);
|