node-appwrite 8.1.0 → 8.2.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 CHANGED
@@ -7,6 +7,6 @@ Redistribution and use in source and binary forms, with or without modification,
7
7
 
8
8
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
9
 
10
- 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
11
 
12
12
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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-blue.svg?style=flat-square)
4
+ ![Version](https://img.shields.io/badge/api%20version-1.2.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.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.2.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(ID.unique(), 'email@example.com', 'password');
51
+ let promise = users.create(sdk.ID.unique(), 'email@example.com', undefined, 'password', 'Jane Doe');
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(ID.unique(), 'email@example.com', 'password');
74
+ let promise = users.create(sdk.ID.unique(), 'email@example.com', undefined, 'password', 'Jane Doe');
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(ID.unique(), 'email@example.com', 'password');
90
+ let res = await users.create(sdk.ID.unique(), 'email@example.com', 'password');
91
91
  } catch(e) {
92
92
  console.log(e.message);
93
93
  }
@@ -11,7 +11,7 @@ client
11
11
  .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
12
12
  ;
13
13
 
14
- const promise = account.updatePhone('', 'password');
14
+ const promise = account.updatePhone('+12065550100', '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
- const promise = functions.retryBuild('[FUNCTION_ID]', '[DEPLOYMENT_ID]', '[BUILD_ID]');
14
+ const promise = functions.createBuild('[FUNCTION_ID]', '[DEPLOYMENT_ID]', '[BUILD_ID]');
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
  const client = new sdk.Client();
5
5
 
6
- const locale = new sdk.Locale(client);
6
+ const graphql = new sdk.Graphql(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
- const promise = locale.getCurrencies();
14
+ const promise = graphql.mutation({});
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
  const client = new sdk.Client();
5
5
 
6
- const locale = new sdk.Locale(client);
6
+ const graphql = new sdk.Graphql(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
- const promise = locale.getLanguages();
14
+ const promise = graphql.query({});
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 = users.updatePhone('[USER_ID]', '');
14
+ const promise = users.updatePhone('[USER_ID]', '+12065550100');
15
15
 
16
16
  promise.then(function (response) {
17
17
  console.log(response);
package/index.d.ts CHANGED
@@ -869,26 +869,46 @@ declare module "node-appwrite" {
869
869
  * AlgoMD5
870
870
  */
871
871
  export type AlgoMd5 = {
872
+ /**
873
+ * Algo type.
874
+ */
875
+ type: string;
872
876
  }
873
877
  /**
874
878
  * AlgoSHA
875
879
  */
876
880
  export type AlgoSha = {
881
+ /**
882
+ * Algo type.
883
+ */
884
+ type: string;
877
885
  }
878
886
  /**
879
887
  * AlgoPHPass
880
888
  */
881
889
  export type AlgoPhpass = {
890
+ /**
891
+ * Algo type.
892
+ */
893
+ type: string;
882
894
  }
883
895
  /**
884
896
  * AlgoBcrypt
885
897
  */
886
898
  export type AlgoBcrypt = {
899
+ /**
900
+ * Algo type.
901
+ */
902
+ type: string;
887
903
  }
888
904
  /**
889
905
  * AlgoScrypt
890
906
  */
891
907
  export type AlgoScrypt = {
908
+ /**
909
+ * Algo type.
910
+ */
911
+ type: string;
892
912
  /**
893
913
  * CPU complexity of computed hash.
894
914
  */
@@ -910,6 +930,10 @@ declare module "node-appwrite" {
910
930
  * AlgoScryptModified
911
931
  */
912
932
  export type AlgoScryptModified = {
933
+ /**
934
+ * Algo type.
935
+ */
936
+ type: string;
913
937
  /**
914
938
  * Salt used to compute hash.
915
939
  */
@@ -927,6 +951,10 @@ declare module "node-appwrite" {
927
951
  * AlgoArgon2
928
952
  */
929
953
  export type AlgoArgon2 = {
954
+ /**
955
+ * Algo type.
956
+ */
957
+ type: string;
930
958
  /**
931
959
  * Memory used to compute hash.
932
960
  */
@@ -1487,6 +1515,10 @@ declare module "node-appwrite" {
1487
1515
  * The build stderr.
1488
1516
  */
1489
1517
  buildStderr: string;
1518
+ /**
1519
+ * The current build time in seconds.
1520
+ */
1521
+ buildTime: number;
1490
1522
  }
1491
1523
  /**
1492
1524
  * Execution
@@ -1872,7 +1904,7 @@ declare module "node-appwrite" {
1872
1904
  */
1873
1905
  get<Preferences extends Models.Preferences>(): Promise<Models.Account<Preferences>>;
1874
1906
  /**
1875
- * Update Account Email
1907
+ * Update Email
1876
1908
  *
1877
1909
  * Update currently logged in user account email address. After changing user
1878
1910
  * address, the user confirmation status will get reset. A new confirmation
@@ -1890,7 +1922,7 @@ declare module "node-appwrite" {
1890
1922
  */
1891
1923
  updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.Account<Preferences>>;
1892
1924
  /**
1893
- * List Account Logs
1925
+ * List Logs
1894
1926
  *
1895
1927
  * Get currently logged in user list of latest security activity logs. Each
1896
1928
  * log returns user IP address, location and date and time of log.
@@ -1901,7 +1933,7 @@ declare module "node-appwrite" {
1901
1933
  */
1902
1934
  listLogs(queries?: string[]): Promise<Models.LogList>;
1903
1935
  /**
1904
- * Update Account Name
1936
+ * Update Name
1905
1937
  *
1906
1938
  * Update currently logged in user account name.
1907
1939
  *
@@ -1911,7 +1943,7 @@ declare module "node-appwrite" {
1911
1943
  */
1912
1944
  updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.Account<Preferences>>;
1913
1945
  /**
1914
- * Update Account Password
1946
+ * Update Password
1915
1947
  *
1916
1948
  * Update currently logged in user password. For validation, user is required
1917
1949
  * to pass in the new password, and the old password. For users created with
@@ -1924,7 +1956,7 @@ declare module "node-appwrite" {
1924
1956
  */
1925
1957
  updatePassword<Preferences extends Models.Preferences>(password: string, oldPassword?: string): Promise<Models.Account<Preferences>>;
1926
1958
  /**
1927
- * Update Account Phone
1959
+ * Update Phone
1928
1960
  *
1929
1961
  * Update the currently logged in user's phone number. After updating the
1930
1962
  * phone number, the phone verification status will be reset. A confirmation
@@ -1948,7 +1980,7 @@ declare module "node-appwrite" {
1948
1980
  */
1949
1981
  getPrefs<Preferences extends Models.Preferences>(): Promise<Preferences>;
1950
1982
  /**
1951
- * Update Account Preferences
1983
+ * Update Preferences
1952
1984
  *
1953
1985
  * Update currently logged in user account preferences. The object you pass is
1954
1986
  * stored as is, and replaces any previous value. The maximum allowed prefs
@@ -1999,7 +2031,7 @@ declare module "node-appwrite" {
1999
2031
  */
2000
2032
  updateRecovery(userId: string, secret: string, password: string, passwordAgain: string): Promise<Models.Token>;
2001
2033
  /**
2002
- * List Account Sessions
2034
+ * List Sessions
2003
2035
  *
2004
2036
  * Get currently logged in user list of active sessions across different
2005
2037
  * devices.
@@ -2009,7 +2041,7 @@ declare module "node-appwrite" {
2009
2041
  */
2010
2042
  listSessions(): Promise<Models.SessionList>;
2011
2043
  /**
2012
- * Delete All Account Sessions
2044
+ * Delete Sessions
2013
2045
  *
2014
2046
  * Delete all sessions from the user account and remove any sessions cookies
2015
2047
  * from the end client.
@@ -2019,7 +2051,7 @@ declare module "node-appwrite" {
2019
2051
  */
2020
2052
  deleteSessions(): Promise<Response>;
2021
2053
  /**
2022
- * Get Session By ID
2054
+ * Get Session
2023
2055
  *
2024
2056
  * Use this endpoint to get a logged in user's session using a Session ID.
2025
2057
  * Inputting 'current' will return the current session being used.
@@ -2030,7 +2062,7 @@ declare module "node-appwrite" {
2030
2062
  */
2031
2063
  getSession(sessionId: string): Promise<Models.Session>;
2032
2064
  /**
2033
- * Update Session (Refresh Tokens)
2065
+ * Update OAuth Session (Refresh Tokens)
2034
2066
  *
2035
2067
  * Access tokens have limited lifespan and expire to mitigate security risks.
2036
2068
  * If session was created using an OAuth provider, this route can be used to
@@ -2042,7 +2074,7 @@ declare module "node-appwrite" {
2042
2074
  */
2043
2075
  updateSession(sessionId: string): Promise<Models.Session>;
2044
2076
  /**
2045
- * Delete Account Session
2077
+ * Delete Session
2046
2078
  *
2047
2079
  * Use this endpoint to log out the currently logged in user from all their
2048
2080
  * account sessions across all of their different devices. When using the
@@ -2055,7 +2087,7 @@ declare module "node-appwrite" {
2055
2087
  */
2056
2088
  deleteSession(sessionId: string): Promise<Response>;
2057
2089
  /**
2058
- * Update Account Status
2090
+ * Update Status
2059
2091
  *
2060
2092
  * Block the currently logged in user account. Behind the scene, the user
2061
2093
  * record is not deleted but permanently blocked from any access. To
@@ -2584,9 +2616,7 @@ declare module "node-appwrite" {
2584
2616
  * List Documents
2585
2617
  *
2586
2618
  * Get a list of all the user's documents in a given collection. You can use
2587
- * the query params to filter your results. On admin mode, this endpoint will
2588
- * return a list of all of documents belonging to the provided collectionId.
2589
- * [Learn more about different API modes](/docs/admin).
2619
+ * the query params to filter your results.
2590
2620
  *
2591
2621
  * @param {string} databaseId
2592
2622
  * @param {string} collectionId
@@ -2845,7 +2875,7 @@ declare module "node-appwrite" {
2845
2875
  */
2846
2876
  deleteDeployment(functionId: string, deploymentId: string): Promise<Response>;
2847
2877
  /**
2848
- * Retry Build
2878
+ * Create Build
2849
2879
  *
2850
2880
  * @param {string} functionId
2851
2881
  * @param {string} deploymentId
@@ -2853,14 +2883,12 @@ declare module "node-appwrite" {
2853
2883
  * @throws {AppwriteException}
2854
2884
  * @returns {Promise}
2855
2885
  */
2856
- retryBuild(functionId: string, deploymentId: string, buildId: string): Promise<Response>;
2886
+ createBuild(functionId: string, deploymentId: string, buildId: string): Promise<Response>;
2857
2887
  /**
2858
2888
  * List Executions
2859
2889
  *
2860
2890
  * Get a list of all the current user function execution logs. You can use the
2861
- * query params to filter your results. On admin mode, this endpoint will
2862
- * return a list of all of the project's executions. [Learn more about
2863
- * different API modes](/docs/admin).
2891
+ * query params to filter your results.
2864
2892
  *
2865
2893
  * @param {string} functionId
2866
2894
  * @param {string[]} queries
@@ -2954,6 +2982,30 @@ declare module "node-appwrite" {
2954
2982
  */
2955
2983
  deleteVariable(functionId: string, variableId: string): Promise<Response>;
2956
2984
  }
2985
+ export class Graphql extends Service {
2986
+ constructor(client: Client);
2987
+
2988
+ /**
2989
+ * GraphQL Endpoint
2990
+ *
2991
+ * Execute a GraphQL mutation.
2992
+ *
2993
+ * @param {object} query
2994
+ * @throws {AppwriteException}
2995
+ * @returns {Promise}
2996
+ */
2997
+ query(query: object): Promise<Response>;
2998
+ /**
2999
+ * GraphQL Endpoint
3000
+ *
3001
+ * Execute a GraphQL mutation.
3002
+ *
3003
+ * @param {object} query
3004
+ * @throws {AppwriteException}
3005
+ * @returns {Promise}
3006
+ */
3007
+ mutation(query: object): Promise<Response>;
3008
+ }
2957
3009
  export class Health extends Service {
2958
3010
  constructor(client: Client);
2959
3011
 
@@ -3214,8 +3266,7 @@ declare module "node-appwrite" {
3214
3266
  * List Files
3215
3267
  *
3216
3268
  * Get a list of all the user files. You can use the query params to filter
3217
- * your results. On admin mode, this endpoint will return a list of all of the
3218
- * project's files. [Learn more about different API modes](/docs/admin).
3269
+ * your results.
3219
3270
  *
3220
3271
  * @param {string} bucketId
3221
3272
  * @param {string[]} queries
@@ -3351,10 +3402,7 @@ declare module "node-appwrite" {
3351
3402
  * List Teams
3352
3403
  *
3353
3404
  * Get a list of all the teams in which the current user is a member. You can
3354
- * use the parameters to filter your results.
3355
- *
3356
- * In admin mode, this endpoint returns a list of all the teams in the current
3357
- * project. [Learn more about different API modes](/docs/admin).
3405
+ * use the parameters to filter your results.
3358
3406
  *
3359
3407
  * @param {string[]} queries
3360
3408
  * @param {string} search
@@ -3461,7 +3509,7 @@ declare module "node-appwrite" {
3461
3509
  * @throws {AppwriteException}
3462
3510
  * @returns {Promise}
3463
3511
  */
3464
- getMembership(teamId: string, membershipId: string): Promise<Models.MembershipList>;
3512
+ getMembership(teamId: string, membershipId: string): Promise<Models.Membership>;
3465
3513
  /**
3466
3514
  * Update Membership Roles
3467
3515
  *
package/index.js CHANGED
@@ -9,6 +9,7 @@ const Account = require('./lib/services/account.js');
9
9
  const Avatars = require('./lib/services/avatars.js');
10
10
  const Databases = require('./lib/services/databases.js');
11
11
  const Functions = require('./lib/services/functions.js');
12
+ const Graphql = require('./lib/services/graphql.js');
12
13
  const Health = require('./lib/services/health.js');
13
14
  const Locale = require('./lib/services/locale.js');
14
15
  const Storage = require('./lib/services/storage.js');
@@ -27,6 +28,7 @@ module.exports = {
27
28
  Avatars,
28
29
  Databases,
29
30
  Functions,
31
+ Graphql,
30
32
  Health,
31
33
  Locale,
32
34
  Storage,
package/lib/client.js CHANGED
@@ -13,7 +13,7 @@ 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.1.0',
16
+ 'x-sdk-version': '8.2.0',
17
17
  'X-Appwrite-Response-Format' : '1.0.0',
18
18
  };
19
19
  this.selfSigned = false;
@@ -32,7 +32,7 @@ class Account extends Service {
32
32
  }
33
33
 
34
34
  /**
35
- * Update Account Email
35
+ * Update Email
36
36
  *
37
37
  * Update currently logged in user account email address. After changing user
38
38
  * address, the user confirmation status will get reset. A new confirmation
@@ -74,7 +74,7 @@ class Account extends Service {
74
74
  }
75
75
 
76
76
  /**
77
- * List Account Logs
77
+ * List 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.
@@ -97,7 +97,7 @@ class Account extends Service {
97
97
  }
98
98
 
99
99
  /**
100
- * Update Account Name
100
+ * Update Name
101
101
  *
102
102
  * Update currently logged in user account name.
103
103
  *
@@ -123,7 +123,7 @@ class Account extends Service {
123
123
  }
124
124
 
125
125
  /**
126
- * Update Account Password
126
+ * Update Password
127
127
  *
128
128
  * Update currently logged in user password. For validation, user is required
129
129
  * to pass in the new password, and the old password. For users created with
@@ -156,7 +156,7 @@ class Account extends Service {
156
156
  }
157
157
 
158
158
  /**
159
- * Update Account Phone
159
+ * Update Phone
160
160
  *
161
161
  * Update the currently logged in user's phone number. After updating the
162
162
  * phone number, the phone verification status will be reset. A confirmation
@@ -212,7 +212,7 @@ class Account extends Service {
212
212
  }
213
213
 
214
214
  /**
215
- * Update Account Preferences
215
+ * Update Preferences
216
216
  *
217
217
  * Update currently logged in user account preferences. The object you pass is
218
218
  * stored as is, and replaces any previous value. The maximum allowed prefs
@@ -343,7 +343,7 @@ class Account extends Service {
343
343
  }
344
344
 
345
345
  /**
346
- * List Account Sessions
346
+ * List Sessions
347
347
  *
348
348
  * Get currently logged in user list of active sessions across different
349
349
  * devices.
@@ -361,7 +361,7 @@ class Account extends Service {
361
361
  }
362
362
 
363
363
  /**
364
- * Delete All Account Sessions
364
+ * Delete Sessions
365
365
  *
366
366
  * Delete all sessions from the user account and remove any sessions cookies
367
367
  * from the end client.
@@ -379,7 +379,7 @@ class Account extends Service {
379
379
  }
380
380
 
381
381
  /**
382
- * Get Session By ID
382
+ * Get Session
383
383
  *
384
384
  * Use this endpoint to get a logged in user's session using a Session ID.
385
385
  * Inputting 'current' will return the current session being used.
@@ -402,7 +402,7 @@ class Account extends Service {
402
402
  }
403
403
 
404
404
  /**
405
- * Update Session (Refresh Tokens)
405
+ * Update OAuth Session (Refresh Tokens)
406
406
  *
407
407
  * Access tokens have limited lifespan and expire to mitigate security risks.
408
408
  * If session was created using an OAuth provider, this route can be used to
@@ -426,7 +426,7 @@ class Account extends Service {
426
426
  }
427
427
 
428
428
  /**
429
- * Delete Account Session
429
+ * Delete Session
430
430
  *
431
431
  * Use this endpoint to log out the currently logged in user from all their
432
432
  * account sessions across all of their different devices. When using the
@@ -451,7 +451,7 @@ class Account extends Service {
451
451
  }
452
452
 
453
453
  /**
454
- * Update Account Status
454
+ * Update Status
455
455
  *
456
456
  * Block the currently logged in user account. Behind the scene, the user
457
457
  * record is not deleted but permanently blocked from any access. To
@@ -975,9 +975,7 @@ class Databases extends Service {
975
975
  * List Documents
976
976
  *
977
977
  * Get a list of all the user's documents in a given collection. You can use
978
- * the query params to filter your results. On admin mode, this endpoint will
979
- * return a list of all of documents belonging to the provided collectionId.
980
- * [Learn more about different API modes](/docs/admin).
978
+ * the query params to filter your results.
981
979
  *
982
980
  * @param {string} databaseId
983
981
  * @param {string} collectionId
@@ -522,7 +522,7 @@ class Functions extends Service {
522
522
  }
523
523
 
524
524
  /**
525
- * Retry Build
525
+ * Create Build
526
526
  *
527
527
  * @param {string} functionId
528
528
  * @param {string} deploymentId
@@ -530,7 +530,7 @@ class Functions extends Service {
530
530
  * @throws {AppwriteException}
531
531
  * @returns {Promise}
532
532
  */
533
- async retryBuild(functionId, deploymentId, buildId) {
533
+ async createBuild(functionId, deploymentId, buildId) {
534
534
  let path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
535
535
  let payload = {};
536
536
  if (typeof functionId === 'undefined') {
@@ -555,9 +555,7 @@ class Functions extends Service {
555
555
  * List Executions
556
556
  *
557
557
  * Get a list of all the current user function execution logs. You can use the
558
- * query params to filter your results. On admin mode, this endpoint will
559
- * return a list of all of the project's executions. [Learn more about
560
- * different API modes](/docs/admin).
558
+ * query params to filter your results.
561
559
  *
562
560
  * @param {string} functionId
563
561
  * @param {string[]} queries
@@ -0,0 +1,72 @@
1
+ const Service = require('../service.js');
2
+ const AppwriteException = require('../exception.js');
3
+ const InputFile = require('../inputFile.js');
4
+ const client = require('../client.js');
5
+ const Stream = require('stream');
6
+ const { promisify } = require('util');
7
+ const fs = require('fs');
8
+
9
+ class Graphql extends Service {
10
+
11
+ constructor(client)
12
+ {
13
+ super(client);
14
+ }
15
+
16
+
17
+ /**
18
+ * GraphQL Endpoint
19
+ *
20
+ * Execute a GraphQL mutation.
21
+ *
22
+ * @param {object} query
23
+ * @throws {AppwriteException}
24
+ * @returns {Promise}
25
+ */
26
+ async query(query) {
27
+ let path = '/graphql';
28
+ let payload = {};
29
+ if (typeof query === 'undefined') {
30
+ throw new AppwriteException('Missing required parameter: "query"');
31
+ }
32
+
33
+
34
+ if (typeof query !== 'undefined') {
35
+ payload['query'] = query;
36
+ }
37
+
38
+ return await this.client.call('post', path, {
39
+ 'x-sdk-graphql': 'true',
40
+ 'content-type': 'application/json',
41
+ }, payload);
42
+ }
43
+
44
+ /**
45
+ * GraphQL Endpoint
46
+ *
47
+ * Execute a GraphQL mutation.
48
+ *
49
+ * @param {object} query
50
+ * @throws {AppwriteException}
51
+ * @returns {Promise}
52
+ */
53
+ async mutation(query) {
54
+ let path = '/graphql/mutation';
55
+ let payload = {};
56
+ if (typeof query === 'undefined') {
57
+ throw new AppwriteException('Missing required parameter: "query"');
58
+ }
59
+
60
+
61
+ if (typeof query !== 'undefined') {
62
+ payload['query'] = query;
63
+ }
64
+
65
+ return await this.client.call('post', path, {
66
+ 'x-sdk-graphql': 'true',
67
+ 'content-type': 'application/json',
68
+ }, payload);
69
+ }
70
+ }
71
+
72
+ module.exports = Graphql;
@@ -237,8 +237,7 @@ class Storage extends Service {
237
237
  * List Files
238
238
  *
239
239
  * Get a list of all the user files. You can use the query params to filter
240
- * your results. On admin mode, this endpoint will return a list of all of the
241
- * project's files. [Learn more about different API modes](/docs/admin).
240
+ * your results.
242
241
  *
243
242
  * @param {string} bucketId
244
243
  * @param {string[]} queries
@@ -18,10 +18,7 @@ class Teams extends Service {
18
18
  * List Teams
19
19
  *
20
20
  * Get a list of all the teams in which the current user is a member. You can
21
- * use the parameters to filter your results.
22
- *
23
- * In admin mode, this endpoint returns a list of all the teams in the current
24
- * project. [Learn more about different API modes](/docs/admin).
21
+ * use the parameters to filter your results.
25
22
  *
26
23
  * @param {string[]} queries
27
24
  * @param {string} search
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.1.0",
5
+ "version": "8.2.0",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "./index.js",
8
8
  "types": "./index.d.ts",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "devDependencies": {},
14
14
  "dependencies": {
15
- "axios": "^0.27.2",
15
+ "axios": "^1.1.2",
16
16
  "form-data": "^4.0.0"
17
17
  }
18
18
  }
@@ -1,20 +0,0 @@
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.getLogs();
15
-
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
@@ -1,20 +0,0 @@
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.getSessions();
15
-
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
@@ -1,20 +0,0 @@
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.getContinents();
15
-
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
@@ -1,20 +0,0 @@
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.getCountriesEU();
15
-
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
@@ -1,20 +0,0 @@
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.getCountriesPhones();
15
-
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
@@ -1,20 +0,0 @@
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.getCountries();
15
-
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
@@ -1,20 +0,0 @@
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.getMemberships('[TEAM_ID]');
15
-
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
@@ -1,20 +0,0 @@
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.getLogs('[USER_ID]');
15
-
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
@@ -1,20 +0,0 @@
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.getMemberships('[USER_ID]');
15
-
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
@@ -1,20 +0,0 @@
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.getSessions('[USER_ID]');
15
-
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });