node-appwrite 8.0.0-RC1 → 8.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/.travis.yml CHANGED
@@ -1,13 +1,22 @@
1
-
2
1
  language: node_js
3
2
  node_js:
4
3
  - "14.16"
5
4
 
6
5
  jobs:
7
6
  include:
8
- - stage: npm release
7
+ - stage: NPM RC Release
8
+ if: tag == *-RC*
9
9
  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..."
11
20
  deploy:
12
21
  provider: npm
13
22
  email: $NPM_EMAIL
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.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)
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.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).**
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('[USER_ID]', 'email@example.com', 'password');
51
+ let promise = users.create(ID.unique(), '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('[USER_ID]', 'email@example.com', 'password');
74
+ let promise = users.create(ID.unique(), '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('[USER_ID]', 'email@example.com', 'password');
90
+ let res = await users.create(ID.unique(), '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
+ 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
+ });
@@ -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
+ });
@@ -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
+ });
@@ -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
+ });
@@ -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
+ });
@@ -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
+ });
@@ -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
+ });
@@ -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
+ });
@@ -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
+ });
@@ -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
+ });
@@ -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
+ });
@@ -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
+ });
package/index.d.ts CHANGED
@@ -693,7 +693,11 @@ declare module "node-appwrite" {
693
693
  /**
694
694
  * Collection ID.
695
695
  */
696
- $collection: string;
696
+ $collectionId: string;
697
+ /**
698
+ * Database ID.
699
+ */
700
+ $databaseId: string;
697
701
  /**
698
702
  * Document creation date in ISO 8601 format.
699
703
  */
@@ -1229,7 +1233,7 @@ declare module "node-appwrite" {
1229
1233
  /**
1230
1234
  * Whether file-level security is enabled. [Learn more about permissions](/docs/permissions).
1231
1235
  */
1232
- fileSecurity: string;
1236
+ fileSecurity: boolean;
1233
1237
  /**
1234
1238
  * Bucket name.
1235
1239
  */
@@ -1362,9 +1366,9 @@ declare module "node-appwrite" {
1362
1366
  */
1363
1367
  name: string;
1364
1368
  /**
1365
- * Function status. Possible values: `disabled`, `enabled`
1369
+ * Function enabled.
1366
1370
  */
1367
- status: string;
1371
+ enabled: boolean;
1368
1372
  /**
1369
1373
  * Function execution runtime.
1370
1374
  */
@@ -1533,9 +1537,9 @@ declare module "node-appwrite" {
1533
1537
  */
1534
1538
  stderr: string;
1535
1539
  /**
1536
- * The script execution time in seconds.
1540
+ * The script execution duration in seconds.
1537
1541
  */
1538
- time: number;
1542
+ duration: number;
1539
1543
  }
1540
1544
  /**
1541
1545
  * Variable
@@ -1864,7 +1868,7 @@ declare module "node-appwrite" {
1864
1868
  */
1865
1869
  updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.Account<Preferences>>;
1866
1870
  /**
1867
- * Get Account Logs
1871
+ * List Account Logs
1868
1872
  *
1869
1873
  * Get currently logged in user list of latest security activity logs. Each
1870
1874
  * log returns user IP address, location and date and time of log.
@@ -1873,7 +1877,7 @@ declare module "node-appwrite" {
1873
1877
  * @throws {AppwriteException}
1874
1878
  * @returns {Promise}
1875
1879
  */
1876
- getLogs(queries?: string[]): Promise<Models.LogList>;
1880
+ listLogs(queries?: string[]): Promise<Models.LogList>;
1877
1881
  /**
1878
1882
  * Update Account Name
1879
1883
  *
@@ -1973,7 +1977,7 @@ declare module "node-appwrite" {
1973
1977
  */
1974
1978
  updateRecovery(userId: string, secret: string, password: string, passwordAgain: string): Promise<Models.Token>;
1975
1979
  /**
1976
- * Get Account Sessions
1980
+ * List Account Sessions
1977
1981
  *
1978
1982
  * Get currently logged in user list of active sessions across different
1979
1983
  * devices.
@@ -1981,7 +1985,7 @@ declare module "node-appwrite" {
1981
1985
  * @throws {AppwriteException}
1982
1986
  * @returns {Promise}
1983
1987
  */
1984
- getSessions(): Promise<Models.SessionList>;
1988
+ listSessions(): Promise<Models.SessionList>;
1985
1989
  /**
1986
1990
  * Delete All Account Sessions
1987
1991
  *
@@ -2698,10 +2702,11 @@ declare module "node-appwrite" {
2698
2702
  * @param {string[]} events
2699
2703
  * @param {string} schedule
2700
2704
  * @param {number} timeout
2705
+ * @param {boolean} enabled
2701
2706
  * @throws {AppwriteException}
2702
2707
  * @returns {Promise}
2703
2708
  */
2704
- create(functionId: string, name: string, execute: string[], runtime: string, events?: string[], schedule?: string, timeout?: number): Promise<Models.Function>;
2709
+ create(functionId: string, name: string, execute: string[], runtime: string, events?: string[], schedule?: string, timeout?: number, enabled?: boolean): Promise<Models.Function>;
2705
2710
  /**
2706
2711
  * List runtimes
2707
2712
  *
@@ -2732,10 +2737,11 @@ declare module "node-appwrite" {
2732
2737
  * @param {string[]} events
2733
2738
  * @param {string} schedule
2734
2739
  * @param {number} timeout
2740
+ * @param {boolean} enabled
2735
2741
  * @throws {AppwriteException}
2736
2742
  * @returns {Promise}
2737
2743
  */
2738
- update(functionId: string, name: string, execute: string[], events?: string[], schedule?: string, timeout?: number): Promise<Models.Function>;
2744
+ update(functionId: string, name: string, execute: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean): Promise<Models.Function>;
2739
2745
  /**
2740
2746
  * Delete Function
2741
2747
  *
@@ -2873,12 +2879,10 @@ declare module "node-appwrite" {
2873
2879
  * Get a list of all variables of a specific function.
2874
2880
  *
2875
2881
  * @param {string} functionId
2876
- * @param {string[]} queries
2877
- * @param {string} search
2878
2882
  * @throws {AppwriteException}
2879
2883
  * @returns {Promise}
2880
2884
  */
2881
- listVariables(functionId: string, queries?: string[], search?: string): Promise<Models.VariableList>;
2885
+ listVariables(functionId: string): Promise<Models.VariableList>;
2882
2886
  /**
2883
2887
  * Create Variable
2884
2888
  *
@@ -3057,7 +3061,7 @@ declare module "node-appwrite" {
3057
3061
  * @throws {AppwriteException}
3058
3062
  * @returns {Promise}
3059
3063
  */
3060
- getContinents(): Promise<Models.ContinentList>;
3064
+ listContinents(): Promise<Models.ContinentList>;
3061
3065
  /**
3062
3066
  * List Countries
3063
3067
  *
@@ -3067,7 +3071,7 @@ declare module "node-appwrite" {
3067
3071
  * @throws {AppwriteException}
3068
3072
  * @returns {Promise}
3069
3073
  */
3070
- getCountries(): Promise<Models.CountryList>;
3074
+ listCountries(): Promise<Models.CountryList>;
3071
3075
  /**
3072
3076
  * List EU Countries
3073
3077
  *
@@ -3077,7 +3081,7 @@ declare module "node-appwrite" {
3077
3081
  * @throws {AppwriteException}
3078
3082
  * @returns {Promise}
3079
3083
  */
3080
- getCountriesEU(): Promise<Models.CountryList>;
3084
+ listCountriesEU(): Promise<Models.CountryList>;
3081
3085
  /**
3082
3086
  * List Countries Phone Codes
3083
3087
  *
@@ -3087,7 +3091,7 @@ declare module "node-appwrite" {
3087
3091
  * @throws {AppwriteException}
3088
3092
  * @returns {Promise}
3089
3093
  */
3090
- getCountriesPhones(): Promise<Models.PhoneList>;
3094
+ listCountriesPhones(): Promise<Models.PhoneList>;
3091
3095
  /**
3092
3096
  * List Currencies
3093
3097
  *
@@ -3098,7 +3102,7 @@ declare module "node-appwrite" {
3098
3102
  * @throws {AppwriteException}
3099
3103
  * @returns {Promise}
3100
3104
  */
3101
- getCurrencies(): Promise<Models.CurrencyList>;
3105
+ listCurrencies(): Promise<Models.CurrencyList>;
3102
3106
  /**
3103
3107
  * List Languages
3104
3108
  *
@@ -3108,7 +3112,7 @@ declare module "node-appwrite" {
3108
3112
  * @throws {AppwriteException}
3109
3113
  * @returns {Promise}
3110
3114
  */
3111
- getLanguages(): Promise<Models.LanguageList>;
3115
+ listLanguages(): Promise<Models.LanguageList>;
3112
3116
  }
3113
3117
  export class Storage extends Service {
3114
3118
  constructor(client: Client);
@@ -3384,7 +3388,7 @@ declare module "node-appwrite" {
3384
3388
  */
3385
3389
  delete(teamId: string): Promise<Response>;
3386
3390
  /**
3387
- * Get Team Memberships
3391
+ * List Team Memberships
3388
3392
  *
3389
3393
  * Use this endpoint to list a team's members using the team's ID. All team
3390
3394
  * members have read access to this endpoint.
@@ -3395,7 +3399,7 @@ declare module "node-appwrite" {
3395
3399
  * @throws {AppwriteException}
3396
3400
  * @returns {Promise}
3397
3401
  */
3398
- getMemberships(teamId: string, queries?: string[], search?: string): Promise<Models.MembershipList>;
3402
+ listMemberships(teamId: string, queries?: string[], search?: string): Promise<Models.MembershipList>;
3399
3403
  /**
3400
3404
  * Create Team Membership
3401
3405
  *
@@ -3669,7 +3673,7 @@ declare module "node-appwrite" {
3669
3673
  */
3670
3674
  updateEmail<Preferences extends Models.Preferences>(userId: string, email: string): Promise<Models.User<Preferences>>;
3671
3675
  /**
3672
- * Get User Logs
3676
+ * List User Logs
3673
3677
  *
3674
3678
  * Get the user activity logs list by its unique ID.
3675
3679
  *
@@ -3678,9 +3682,9 @@ declare module "node-appwrite" {
3678
3682
  * @throws {AppwriteException}
3679
3683
  * @returns {Promise}
3680
3684
  */
3681
- getLogs(userId: string, queries?: string[]): Promise<Models.LogList>;
3685
+ listLogs(userId: string, queries?: string[]): Promise<Models.LogList>;
3682
3686
  /**
3683
- * Get User Memberships
3687
+ * List User Memberships
3684
3688
  *
3685
3689
  * Get the user membership list by its unique ID.
3686
3690
  *
@@ -3688,7 +3692,7 @@ declare module "node-appwrite" {
3688
3692
  * @throws {AppwriteException}
3689
3693
  * @returns {Promise}
3690
3694
  */
3691
- getMemberships(userId: string): Promise<Models.MembershipList>;
3695
+ listMemberships(userId: string): Promise<Models.MembershipList>;
3692
3696
  /**
3693
3697
  * Update Name
3694
3698
  *
@@ -3746,7 +3750,7 @@ declare module "node-appwrite" {
3746
3750
  */
3747
3751
  updatePrefs<Preferences extends Models.Preferences>(userId: string, prefs: object): Promise<Preferences>;
3748
3752
  /**
3749
- * Get User Sessions
3753
+ * List User Sessions
3750
3754
  *
3751
3755
  * Get the user sessions list by its unique ID.
3752
3756
  *
@@ -3754,7 +3758,7 @@ declare module "node-appwrite" {
3754
3758
  * @throws {AppwriteException}
3755
3759
  * @returns {Promise}
3756
3760
  */
3757
- getSessions(userId: string): Promise<Models.SessionList>;
3761
+ listSessions(userId: string): Promise<Models.SessionList>;
3758
3762
  /**
3759
3763
  * Delete User Sessions
3760
3764
  *
package/lib/client.js CHANGED
@@ -13,8 +13,8 @@ class Client {
13
13
  'x-sdk-name': 'Node.js',
14
14
  'x-sdk-platform': 'server',
15
15
  'x-sdk-language': 'nodejs',
16
- 'x-sdk-version': '8.0.0-RC1',
17
- 'X-Appwrite-Response-Format' : '1.0.0-RC1',
16
+ 'x-sdk-version': '8.0.0',
17
+ 'X-Appwrite-Response-Format' : '1.0.0',
18
18
  };
19
19
  this.selfSigned = false;
20
20
  }
package/lib/role.js CHANGED
@@ -2,11 +2,17 @@ class Role {
2
2
  static any = () => {
3
3
  return 'any'
4
4
  }
5
- static user = (id) => {
6
- return 'user:' + id
5
+ static user = (id, status = '') => {
6
+ if(status === '') {
7
+ return `user:${id}`
8
+ }
9
+ return `user:${id}/${status}`
7
10
  }
8
- static users = () => {
9
- return 'users'
11
+ static users = (status = '') => {
12
+ if(status === '') {
13
+ return 'users'
14
+ }
15
+ return `users/${status}`
10
16
  }
11
17
  static guests = () => {
12
18
  return 'guests'
@@ -17,6 +23,9 @@ class Role {
17
23
  }
18
24
  return 'team:' + id + '/' + role
19
25
  }
26
+ static member = (id) => {
27
+ return 'member:' + id
28
+ }
20
29
  static status = (status) => {
21
30
  return 'status:' + status
22
31
  }
@@ -74,7 +74,7 @@ class Account extends Service {
74
74
  }
75
75
 
76
76
  /**
77
- * Get Account Logs
77
+ * List Account Logs
78
78
  *
79
79
  * Get currently logged in user list of latest security activity logs. Each
80
80
  * log returns user IP address, location and date and time of log.
@@ -83,7 +83,7 @@ class Account extends Service {
83
83
  * @throws {AppwriteException}
84
84
  * @returns {Promise}
85
85
  */
86
- async getLogs(queries) {
86
+ async listLogs(queries) {
87
87
  let path = '/account/logs';
88
88
  let payload = {};
89
89
 
@@ -343,7 +343,7 @@ class Account extends Service {
343
343
  }
344
344
 
345
345
  /**
346
- * Get Account Sessions
346
+ * List Account Sessions
347
347
  *
348
348
  * Get currently logged in user list of active sessions across different
349
349
  * devices.
@@ -351,7 +351,7 @@ class Account extends Service {
351
351
  * @throws {AppwriteException}
352
352
  * @returns {Promise}
353
353
  */
354
- async getSessions() {
354
+ async listSessions() {
355
355
  let path = '/account/sessions';
356
356
  let payload = {};
357
357
 
@@ -56,10 +56,11 @@ class Functions extends Service {
56
56
  * @param {string[]} events
57
57
  * @param {string} schedule
58
58
  * @param {number} timeout
59
+ * @param {boolean} enabled
59
60
  * @throws {AppwriteException}
60
61
  * @returns {Promise}
61
62
  */
62
- async create(functionId, name, execute, runtime, events, schedule, timeout) {
63
+ async create(functionId, name, execute, runtime, events, schedule, timeout, enabled) {
63
64
  let path = '/functions';
64
65
  let payload = {};
65
66
  if (typeof functionId === 'undefined') {
@@ -107,6 +108,10 @@ class Functions extends Service {
107
108
  payload['timeout'] = timeout;
108
109
  }
109
110
 
111
+ if (typeof enabled !== 'undefined') {
112
+ payload['enabled'] = enabled;
113
+ }
114
+
110
115
  return await this.client.call('post', path, {
111
116
  'content-type': 'application/json',
112
117
  }, payload);
@@ -162,10 +167,11 @@ class Functions extends Service {
162
167
  * @param {string[]} events
163
168
  * @param {string} schedule
164
169
  * @param {number} timeout
170
+ * @param {boolean} enabled
165
171
  * @throws {AppwriteException}
166
172
  * @returns {Promise}
167
173
  */
168
- async update(functionId, name, execute, events, schedule, timeout) {
174
+ async update(functionId, name, execute, events, schedule, timeout, enabled) {
169
175
  let path = '/functions/{functionId}'.replace('{functionId}', functionId);
170
176
  let payload = {};
171
177
  if (typeof functionId === 'undefined') {
@@ -201,6 +207,10 @@ class Functions extends Service {
201
207
  payload['timeout'] = timeout;
202
208
  }
203
209
 
210
+ if (typeof enabled !== 'undefined') {
211
+ payload['enabled'] = enabled;
212
+ }
213
+
204
214
  return await this.client.call('put', path, {
205
215
  'content-type': 'application/json',
206
216
  }, payload);
@@ -644,12 +654,10 @@ class Functions extends Service {
644
654
  * Get a list of all variables of a specific function.
645
655
  *
646
656
  * @param {string} functionId
647
- * @param {string[]} queries
648
- * @param {string} search
649
657
  * @throws {AppwriteException}
650
658
  * @returns {Promise}
651
659
  */
652
- async listVariables(functionId, queries, search) {
660
+ async listVariables(functionId) {
653
661
  let path = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
654
662
  let payload = {};
655
663
  if (typeof functionId === 'undefined') {
@@ -657,14 +665,6 @@ class Functions extends Service {
657
665
  }
658
666
 
659
667
 
660
- if (typeof queries !== 'undefined') {
661
- payload['queries'] = queries;
662
- }
663
-
664
- if (typeof search !== 'undefined') {
665
- payload['search'] = search;
666
- }
667
-
668
668
  return await this.client.call('get', path, {
669
669
  'content-type': 'application/json',
670
670
  }, payload);
@@ -45,7 +45,7 @@ class Locale extends Service {
45
45
  * @throws {AppwriteException}
46
46
  * @returns {Promise}
47
47
  */
48
- async getContinents() {
48
+ async listContinents() {
49
49
  let path = '/locale/continents';
50
50
  let payload = {};
51
51
 
@@ -63,7 +63,7 @@ class Locale extends Service {
63
63
  * @throws {AppwriteException}
64
64
  * @returns {Promise}
65
65
  */
66
- async getCountries() {
66
+ async listCountries() {
67
67
  let path = '/locale/countries';
68
68
  let payload = {};
69
69
 
@@ -81,7 +81,7 @@ class Locale extends Service {
81
81
  * @throws {AppwriteException}
82
82
  * @returns {Promise}
83
83
  */
84
- async getCountriesEU() {
84
+ async listCountriesEU() {
85
85
  let path = '/locale/countries/eu';
86
86
  let payload = {};
87
87
 
@@ -99,7 +99,7 @@ class Locale extends Service {
99
99
  * @throws {AppwriteException}
100
100
  * @returns {Promise}
101
101
  */
102
- async getCountriesPhones() {
102
+ async listCountriesPhones() {
103
103
  let path = '/locale/countries/phones';
104
104
  let payload = {};
105
105
 
@@ -118,7 +118,7 @@ class Locale extends Service {
118
118
  * @throws {AppwriteException}
119
119
  * @returns {Promise}
120
120
  */
121
- async getCurrencies() {
121
+ async listCurrencies() {
122
122
  let path = '/locale/currencies';
123
123
  let payload = {};
124
124
 
@@ -136,7 +136,7 @@ class Locale extends Service {
136
136
  * @throws {AppwriteException}
137
137
  * @returns {Promise}
138
138
  */
139
- async getLanguages() {
139
+ async listLanguages() {
140
140
  let path = '/locale/languages';
141
141
  let payload = {};
142
142
 
@@ -165,7 +165,7 @@ class Teams extends Service {
165
165
  }
166
166
 
167
167
  /**
168
- * Get Team Memberships
168
+ * List Team Memberships
169
169
  *
170
170
  * Use this endpoint to list a team's members using the team's ID. All team
171
171
  * members have read access to this endpoint.
@@ -176,7 +176,7 @@ class Teams extends Service {
176
176
  * @throws {AppwriteException}
177
177
  * @returns {Promise}
178
178
  */
179
- async getMemberships(teamId, queries, search) {
179
+ async listMemberships(teamId, queries, search) {
180
180
  let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
181
181
  let payload = {};
182
182
  if (typeof teamId === 'undefined') {
@@ -609,7 +609,7 @@ class Users extends Service {
609
609
  }
610
610
 
611
611
  /**
612
- * Get User Logs
612
+ * List User Logs
613
613
  *
614
614
  * Get the user activity logs list by its unique ID.
615
615
  *
@@ -618,7 +618,7 @@ class Users extends Service {
618
618
  * @throws {AppwriteException}
619
619
  * @returns {Promise}
620
620
  */
621
- async getLogs(userId, queries) {
621
+ async listLogs(userId, queries) {
622
622
  let path = '/users/{userId}/logs'.replace('{userId}', userId);
623
623
  let payload = {};
624
624
  if (typeof userId === 'undefined') {
@@ -636,7 +636,7 @@ class Users extends Service {
636
636
  }
637
637
 
638
638
  /**
639
- * Get User Memberships
639
+ * List User Memberships
640
640
  *
641
641
  * Get the user membership list by its unique ID.
642
642
  *
@@ -644,7 +644,7 @@ class Users extends Service {
644
644
  * @throws {AppwriteException}
645
645
  * @returns {Promise}
646
646
  */
647
- async getMemberships(userId) {
647
+ async listMemberships(userId) {
648
648
  let path = '/users/{userId}/memberships'.replace('{userId}', userId);
649
649
  let payload = {};
650
650
  if (typeof userId === 'undefined') {
@@ -806,7 +806,7 @@ class Users extends Service {
806
806
  }
807
807
 
808
808
  /**
809
- * Get User Sessions
809
+ * List User Sessions
810
810
  *
811
811
  * Get the user sessions list by its unique ID.
812
812
  *
@@ -814,7 +814,7 @@ class Users extends Service {
814
814
  * @throws {AppwriteException}
815
815
  * @returns {Promise}
816
816
  */
817
- async getSessions(userId) {
817
+ async listSessions(userId) {
818
818
  let path = '/users/{userId}/sessions'.replace('{userId}', userId);
819
819
  let payload = {};
820
820
  if (typeof userId === 'undefined') {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "node-appwrite",
3
3
  "homepage": "https://appwrite.io/support",
4
4
  "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
5
- "version": "8.0.0-RC1",
5
+ "version": "8.0.0",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "./index.js",
8
8
  "types": "./index.d.ts",