node-appwrite 8.2.0 → 9.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.
Files changed (30) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +2 -2
  3. package/docs/examples/account/update-password.md +1 -1
  4. package/docs/examples/databases/create-relationship-attribute.md +20 -0
  5. package/docs/examples/databases/update-boolean-attribute.md +20 -0
  6. package/docs/examples/databases/update-datetime-attribute.md +20 -0
  7. package/docs/examples/databases/update-email-attribute.md +20 -0
  8. package/docs/examples/databases/update-enum-attribute.md +20 -0
  9. package/docs/examples/databases/update-float-attribute.md +20 -0
  10. package/docs/examples/databases/update-integer-attribute.md +20 -0
  11. package/docs/examples/databases/update-ip-attribute.md +20 -0
  12. package/docs/examples/databases/update-relationship-attribute.md +20 -0
  13. package/docs/examples/databases/update-string-attribute.md +20 -0
  14. package/docs/examples/databases/update-url-attribute.md +20 -0
  15. package/docs/examples/functions/create.md +1 -1
  16. package/docs/examples/functions/update.md +1 -1
  17. package/docs/examples/teams/create-membership.md +1 -1
  18. package/docs/examples/teams/get-prefs.md +20 -0
  19. package/docs/examples/teams/{update.md → update-name.md} +1 -1
  20. package/docs/examples/teams/update-prefs.md +20 -0
  21. package/docs/examples/users/update-password.md +1 -1
  22. package/index.d.ts +334 -112
  23. package/lib/client.js +2 -1
  24. package/lib/inputFile.js +6 -8
  25. package/lib/query.js +18 -0
  26. package/lib/services/databases.js +720 -104
  27. package/lib/services/functions.js +45 -45
  28. package/lib/services/storage.js +43 -35
  29. package/lib/services/teams.js +87 -19
  30. package/package.json +6 -4
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2022 Appwrite (https://appwrite.io) and individual contributors.
1
+ Copyright (c) 2023 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
  ![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.2.0-blue.svg?style=flat-square)
4
+ ![Version](https://img.shields.io/badge/api%20version-1.3.2-blue.svg?style=flat-square)
5
5
  [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
6
6
  [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
7
7
  [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
8
8
 
9
- **This SDK is compatible with Appwrite server version 1.2.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.3.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)
@@ -11,7 +11,7 @@ client
11
11
  .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
12
12
  ;
13
13
 
14
- const promise = account.updatePassword('password');
14
+ const promise = account.updatePassword('');
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
+ const client = new sdk.Client();
5
+
6
+ const databases = new sdk.Databases(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 = databases.createRelationshipAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '[RELATED_COLLECTION_ID]', 'oneToOne');
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
+ const client = new sdk.Client();
5
+
6
+ const databases = new sdk.Databases(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 = databases.updateBooleanAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, 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
+ const client = new sdk.Client();
5
+
6
+ const databases = new sdk.Databases(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 = databases.updateDatetimeAttribute('[DATABASE_ID]', '[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
+ const client = new sdk.Client();
5
+
6
+ const databases = new sdk.Databases(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 = databases.updateEmailAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, 'email@example.com');
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
+ const client = new sdk.Client();
5
+
6
+ const databases = new sdk.Databases(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 = databases.updateEnumAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', [], false, '[DEFAULT]');
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
+ const client = new sdk.Client();
5
+
6
+ const databases = new sdk.Databases(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 = databases.updateFloatAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, null, null, null);
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
+ const client = new sdk.Client();
5
+
6
+ const databases = new sdk.Databases(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 = databases.updateIntegerAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, null, null, null);
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
+ const client = new sdk.Client();
5
+
6
+ const databases = new sdk.Databases(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 = databases.updateIpAttribute('[DATABASE_ID]', '[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
+ const client = new sdk.Client();
5
+
6
+ const databases = new sdk.Databases(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 = databases.updateRelationshipAttribute('[DATABASE_ID]', '[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
+ const client = new sdk.Client();
5
+
6
+ const databases = new sdk.Databases(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 = databases.updateStringAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, '[DEFAULT]');
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
+ const client = new sdk.Client();
5
+
6
+ const databases = new sdk.Databases(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 = databases.updateUrlAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, 'https://example.com');
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
- const promise = functions.create('[FUNCTION_ID]', '[NAME]', ["any"], 'node-14.5');
14
+ const promise = functions.create('[FUNCTION_ID]', '[NAME]', 'node-14.5');
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
- const promise = functions.update('[FUNCTION_ID]', '[NAME]', ["any"]);
14
+ const promise = functions.update('[FUNCTION_ID]', '[NAME]');
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
- const promise = teams.createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com');
14
+ const promise = teams.createMembership('[TEAM_ID]', [], 'https://example.com');
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
+ 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
+ .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
12
+ ;
13
+
14
+ const promise = teams.getPrefs('[TEAM_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
- const promise = teams.update('[TEAM_ID]', '[NAME]');
14
+ const promise = teams.updateName('[TEAM_ID]', '[NAME]');
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
+ 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
+ .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
12
+ ;
13
+
14
+ const promise = teams.updatePrefs('[TEAM_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
- const promise = users.updatePassword('[USER_ID]', 'password');
14
+ const promise = users.updatePassword('[USER_ID]', '');
15
15
 
16
16
  promise.then(function (response) {
17
17
  console.log(response);