node-appwrite 5.1.0 → 6.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/README.md +2 -2
- package/docs/examples/account/{delete.md → update-status.md} +1 -1
- package/docs/examples/functions/create-deployment.md +1 -1
- package/docs/examples/storage/create-file.md +1 -1
- package/docs/examples/{health/get-queue-usage.md → users/get-memberships.md} +2 -2
- package/index.d.ts +80 -41
- package/lib/client.js +2 -2
- package/lib/services/account.js +24 -22
- package/lib/services/avatars.js +33 -3
- package/lib/services/database.js +1 -3
- package/lib/services/functions.js +1 -1
- package/lib/services/health.js +0 -18
- package/lib/services/users.js +29 -2
- package/package.json +2 -2
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
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.14.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)
|
|
@@ -12,7 +12,7 @@ client
|
|
|
12
12
|
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
13
13
|
;
|
|
14
14
|
|
|
15
|
-
let promise = functions.createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]',
|
|
15
|
+
let promise = functions.createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', 'file.png', false);
|
|
16
16
|
|
|
17
17
|
promise.then(function (response) {
|
|
18
18
|
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('[BUCKET_ID]', '[FILE_ID]',
|
|
15
|
+
let promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', 'file.png');
|
|
16
16
|
|
|
17
17
|
promise.then(function (response) {
|
|
18
18
|
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 users = new sdk.Users(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 = users.getMemberships('[USER_ID]');
|
|
15
15
|
|
|
16
16
|
promise.then(function (response) {
|
|
17
17
|
console.log(response);
|
package/index.d.ts
CHANGED
|
@@ -1037,17 +1037,21 @@ declare module "node-appwrite" {
|
|
|
1037
1037
|
*/
|
|
1038
1038
|
userId: string;
|
|
1039
1039
|
/**
|
|
1040
|
-
* Team ID.
|
|
1041
|
-
*/
|
|
1042
|
-
teamId: string;
|
|
1043
|
-
/**
|
|
1044
1040
|
* User name.
|
|
1045
1041
|
*/
|
|
1046
|
-
|
|
1042
|
+
userName: string;
|
|
1047
1043
|
/**
|
|
1048
1044
|
* User email address.
|
|
1049
1045
|
*/
|
|
1050
|
-
|
|
1046
|
+
userEmail: string;
|
|
1047
|
+
/**
|
|
1048
|
+
* Team ID.
|
|
1049
|
+
*/
|
|
1050
|
+
teamId: string;
|
|
1051
|
+
/**
|
|
1052
|
+
* Team name.
|
|
1053
|
+
*/
|
|
1054
|
+
teamName: string;
|
|
1051
1055
|
/**
|
|
1052
1056
|
* Date, the user has been invited to join the team in Unix timestamp.
|
|
1053
1057
|
*/
|
|
@@ -1241,9 +1245,9 @@ declare module "node-appwrite" {
|
|
|
1241
1245
|
*/
|
|
1242
1246
|
statusCode: number;
|
|
1243
1247
|
/**
|
|
1244
|
-
* The script
|
|
1248
|
+
* The script response output string. Logs the last 4,000 characters of the execution response output.
|
|
1245
1249
|
*/
|
|
1246
|
-
|
|
1250
|
+
response: string;
|
|
1247
1251
|
/**
|
|
1248
1252
|
* The script stderr output string. Logs the last 4,000 characters of the execution stderr output
|
|
1249
1253
|
*/
|
|
@@ -1506,19 +1510,6 @@ declare module "node-appwrite" {
|
|
|
1506
1510
|
* @returns {Promise}
|
|
1507
1511
|
*/
|
|
1508
1512
|
get<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>>;
|
|
1509
|
-
/**
|
|
1510
|
-
* Delete Account
|
|
1511
|
-
*
|
|
1512
|
-
* Delete a currently logged in user account. Behind the scene, the user
|
|
1513
|
-
* record is not deleted but permanently blocked from any access. This is done
|
|
1514
|
-
* to avoid deleted accounts being overtaken by new users with the same email
|
|
1515
|
-
* address. Any user-related resources like documents or storage files should
|
|
1516
|
-
* be deleted separately.
|
|
1517
|
-
*
|
|
1518
|
-
* @throws {AppwriteException}
|
|
1519
|
-
* @returns {Promise}
|
|
1520
|
-
*/
|
|
1521
|
-
delete(): Promise<Response>;
|
|
1522
1513
|
/**
|
|
1523
1514
|
* Update Account Email
|
|
1524
1515
|
*
|
|
@@ -1564,7 +1555,7 @@ declare module "node-appwrite" {
|
|
|
1564
1555
|
*
|
|
1565
1556
|
* Update currently logged in user password. For validation, user is required
|
|
1566
1557
|
* to pass in the new password, and the old password. For users created with
|
|
1567
|
-
* OAuth and
|
|
1558
|
+
* OAuth, Team Invites and Magic URL, oldPassword is optional.
|
|
1568
1559
|
*
|
|
1569
1560
|
* @param {string} password
|
|
1570
1561
|
* @param {string} oldPassword
|
|
@@ -1666,6 +1657,10 @@ declare module "node-appwrite" {
|
|
|
1666
1657
|
/**
|
|
1667
1658
|
* Update Session (Refresh Tokens)
|
|
1668
1659
|
*
|
|
1660
|
+
* Access tokens have limited lifespan and expire to mitigate security risks.
|
|
1661
|
+
* If session was created using an OAuth provider, this route can be used to
|
|
1662
|
+
* "refresh" the access token.
|
|
1663
|
+
*
|
|
1669
1664
|
* @param {string} sessionId
|
|
1670
1665
|
* @throws {AppwriteException}
|
|
1671
1666
|
* @returns {Promise}
|
|
@@ -1684,6 +1679,17 @@ declare module "node-appwrite" {
|
|
|
1684
1679
|
* @returns {Promise}
|
|
1685
1680
|
*/
|
|
1686
1681
|
deleteSession(sessionId: string): Promise<Response>;
|
|
1682
|
+
/**
|
|
1683
|
+
* Update Account Status
|
|
1684
|
+
*
|
|
1685
|
+
* Block the currently logged in user account. Behind the scene, the user
|
|
1686
|
+
* record is not deleted but permanently blocked from any access. To
|
|
1687
|
+
* completely delete a user, use the Users API instead.
|
|
1688
|
+
*
|
|
1689
|
+
* @throws {AppwriteException}
|
|
1690
|
+
* @returns {Promise}
|
|
1691
|
+
*/
|
|
1692
|
+
updateStatus<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>>;
|
|
1687
1693
|
/**
|
|
1688
1694
|
* Create Email Verification
|
|
1689
1695
|
*
|
|
@@ -1728,9 +1734,14 @@ declare module "node-appwrite" {
|
|
|
1728
1734
|
* Get Browser Icon
|
|
1729
1735
|
*
|
|
1730
1736
|
* You can use this endpoint to show different browser icons to your users.
|
|
1731
|
-
* The code argument receives the browser code as it appears in your user
|
|
1732
|
-
* /account/sessions endpoint. Use
|
|
1733
|
-
* change the output settings.
|
|
1737
|
+
* The code argument receives the browser code as it appears in your user [GET
|
|
1738
|
+
* /account/sessions](/docs/client/account#accountGetSessions) endpoint. Use
|
|
1739
|
+
* width, height and quality arguments to change the output settings.
|
|
1740
|
+
*
|
|
1741
|
+
* When one dimension is specified and the other is 0, the image is scaled
|
|
1742
|
+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
1743
|
+
* image at source quality. If dimensions are not specified, the default size
|
|
1744
|
+
* of image returned is 100x100px.
|
|
1734
1745
|
*
|
|
1735
1746
|
* @param {string} code
|
|
1736
1747
|
* @param {number} width
|
|
@@ -1746,6 +1757,12 @@ declare module "node-appwrite" {
|
|
|
1746
1757
|
* The credit card endpoint will return you the icon of the credit card
|
|
1747
1758
|
* provider you need. Use width, height and quality arguments to change the
|
|
1748
1759
|
* output settings.
|
|
1760
|
+
*
|
|
1761
|
+
* When one dimension is specified and the other is 0, the image is scaled
|
|
1762
|
+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
1763
|
+
* image at source quality. If dimensions are not specified, the default size
|
|
1764
|
+
* of image returned is 100x100px.
|
|
1765
|
+
*
|
|
1749
1766
|
*
|
|
1750
1767
|
* @param {string} code
|
|
1751
1768
|
* @param {number} width
|
|
@@ -1773,6 +1790,12 @@ declare module "node-appwrite" {
|
|
|
1773
1790
|
* You can use this endpoint to show different country flags icons to your
|
|
1774
1791
|
* users. The code argument receives the 2 letter country code. Use width,
|
|
1775
1792
|
* height and quality arguments to change the output settings.
|
|
1793
|
+
*
|
|
1794
|
+
* When one dimension is specified and the other is 0, the image is scaled
|
|
1795
|
+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
1796
|
+
* image at source quality. If dimensions are not specified, the default size
|
|
1797
|
+
* of image returned is 100x100px.
|
|
1798
|
+
*
|
|
1776
1799
|
*
|
|
1777
1800
|
* @param {string} code
|
|
1778
1801
|
* @param {number} width
|
|
@@ -1789,6 +1812,12 @@ declare module "node-appwrite" {
|
|
|
1789
1812
|
* you want. This endpoint is very useful if you need to crop and display
|
|
1790
1813
|
* remote images in your app or in case you want to make sure a 3rd party
|
|
1791
1814
|
* image is properly served using a TLS protocol.
|
|
1815
|
+
*
|
|
1816
|
+
* When one dimension is specified and the other is 0, the image is scaled
|
|
1817
|
+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
1818
|
+
* image at source quality. If dimensions are not specified, the default size
|
|
1819
|
+
* of image returned is 400x400px.
|
|
1820
|
+
*
|
|
1792
1821
|
*
|
|
1793
1822
|
* @param {string} url
|
|
1794
1823
|
* @param {number} width
|
|
@@ -1810,6 +1839,12 @@ declare module "node-appwrite" {
|
|
|
1810
1839
|
* default, a random theme will be selected. The random theme will persist for
|
|
1811
1840
|
* the user's initials when reloading the same theme will always return for
|
|
1812
1841
|
* the same initials.
|
|
1842
|
+
*
|
|
1843
|
+
* When one dimension is specified and the other is 0, the image is scaled
|
|
1844
|
+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
1845
|
+
* image at source quality. If dimensions are not specified, the default size
|
|
1846
|
+
* of image returned is 100x100px.
|
|
1847
|
+
*
|
|
1813
1848
|
*
|
|
1814
1849
|
* @param {string} name
|
|
1815
1850
|
* @param {number} width
|
|
@@ -1825,6 +1860,7 @@ declare module "node-appwrite" {
|
|
|
1825
1860
|
*
|
|
1826
1861
|
* Converts a given plain text to a QR code image. You can use the query
|
|
1827
1862
|
* parameters to change the size and style of the resulting image.
|
|
1863
|
+
*
|
|
1828
1864
|
*
|
|
1829
1865
|
* @param {string} text
|
|
1830
1866
|
* @param {number} size
|
|
@@ -2123,9 +2159,7 @@ declare module "node-appwrite" {
|
|
|
2123
2159
|
/**
|
|
2124
2160
|
* Delete Document
|
|
2125
2161
|
*
|
|
2126
|
-
* Delete a document by its unique ID.
|
|
2127
|
-
* documents, its attributes and relations to other documents. Child documents
|
|
2128
|
-
* **will not** be deleted.
|
|
2162
|
+
* Delete a document by its unique ID.
|
|
2129
2163
|
*
|
|
2130
2164
|
* @param {string} collectionId
|
|
2131
2165
|
* @param {string} documentId
|
|
@@ -2209,7 +2243,7 @@ declare module "node-appwrite" {
|
|
|
2209
2243
|
*/
|
|
2210
2244
|
create(functionId: string, name: string, execute: string[], runtime: string, vars?: object, events?: string[], schedule?: string, timeout?: number): Promise<Models.Function>;
|
|
2211
2245
|
/**
|
|
2212
|
-
* List
|
|
2246
|
+
* List runtimes
|
|
2213
2247
|
*
|
|
2214
2248
|
* Get a list of all runtimes that are currently active on your instance.
|
|
2215
2249
|
*
|
|
@@ -2448,16 +2482,6 @@ declare module "node-appwrite" {
|
|
|
2448
2482
|
* @returns {Promise}
|
|
2449
2483
|
*/
|
|
2450
2484
|
getQueueLogs(): Promise<Models.HealthQueue>;
|
|
2451
|
-
/**
|
|
2452
|
-
* Get Usage Queue
|
|
2453
|
-
*
|
|
2454
|
-
* Get the number of usage stats that are waiting to be processed in the
|
|
2455
|
-
* Appwrite internal queue server.
|
|
2456
|
-
*
|
|
2457
|
-
* @throws {AppwriteException}
|
|
2458
|
-
* @returns {Promise}
|
|
2459
|
-
*/
|
|
2460
|
-
getQueueUsage(): Promise<Models.HealthQueue>;
|
|
2461
2485
|
/**
|
|
2462
2486
|
* Get Webhooks Queue
|
|
2463
2487
|
*
|
|
@@ -3000,7 +3024,11 @@ declare module "node-appwrite" {
|
|
|
3000
3024
|
/**
|
|
3001
3025
|
* Delete User
|
|
3002
3026
|
*
|
|
3003
|
-
* Delete a user by its unique ID.
|
|
3027
|
+
* Delete a user by its unique ID, thereby releasing it's ID. Since ID is
|
|
3028
|
+
* released and can be reused, all user-related resources like documents or
|
|
3029
|
+
* storage files should be deleted before user deletion. If you want to keep
|
|
3030
|
+
* ID reserved, use the [updateStatus](/docs/server/users#usersUpdateStatus)
|
|
3031
|
+
* endpoint instead.
|
|
3004
3032
|
*
|
|
3005
3033
|
* @param {string} userId
|
|
3006
3034
|
* @throws {AppwriteException}
|
|
@@ -3030,6 +3058,16 @@ declare module "node-appwrite" {
|
|
|
3030
3058
|
* @returns {Promise}
|
|
3031
3059
|
*/
|
|
3032
3060
|
getLogs(userId: string, limit?: number, offset?: number): Promise<Models.LogList>;
|
|
3061
|
+
/**
|
|
3062
|
+
* Get User Memberships
|
|
3063
|
+
*
|
|
3064
|
+
* Get the user membership list by its unique ID.
|
|
3065
|
+
*
|
|
3066
|
+
* @param {string} userId
|
|
3067
|
+
* @throws {AppwriteException}
|
|
3068
|
+
* @returns {Promise}
|
|
3069
|
+
*/
|
|
3070
|
+
getMemberships(userId: string): Promise<Models.MembershipList>;
|
|
3033
3071
|
/**
|
|
3034
3072
|
* Update Name
|
|
3035
3073
|
*
|
|
@@ -3109,7 +3147,8 @@ declare module "node-appwrite" {
|
|
|
3109
3147
|
/**
|
|
3110
3148
|
* Update User Status
|
|
3111
3149
|
*
|
|
3112
|
-
* Update the user status by its unique ID.
|
|
3150
|
+
* Update the user status by its unique ID. Use this endpoint as an
|
|
3151
|
+
* alternative to deleting a user if you want to keep user's ID reserved.
|
|
3113
3152
|
*
|
|
3114
3153
|
* @param {string} userId
|
|
3115
3154
|
* @param {boolean} status
|
package/lib/client.js
CHANGED
|
@@ -10,8 +10,8 @@ class Client {
|
|
|
10
10
|
this.endpoint = 'https://HOSTNAME/v1';
|
|
11
11
|
this.headers = {
|
|
12
12
|
'content-type': '',
|
|
13
|
-
'x-sdk-version': 'appwrite:nodejs:
|
|
14
|
-
'X-Appwrite-Response-Format' : '0.
|
|
13
|
+
'x-sdk-version': 'appwrite:nodejs:6.0.0',
|
|
14
|
+
'X-Appwrite-Response-Format' : '0.14.0',
|
|
15
15
|
};
|
|
16
16
|
this.selfSigned = false;
|
|
17
17
|
}
|
package/lib/services/account.js
CHANGED
|
@@ -23,27 +23,6 @@ class Account extends Service {
|
|
|
23
23
|
}, payload);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
/**
|
|
27
|
-
* Delete Account
|
|
28
|
-
*
|
|
29
|
-
* Delete a currently logged in user account. Behind the scene, the user
|
|
30
|
-
* record is not deleted but permanently blocked from any access. This is done
|
|
31
|
-
* to avoid deleted accounts being overtaken by new users with the same email
|
|
32
|
-
* address. Any user-related resources like documents or storage files should
|
|
33
|
-
* be deleted separately.
|
|
34
|
-
*
|
|
35
|
-
* @throws {AppwriteException}
|
|
36
|
-
* @returns {Promise}
|
|
37
|
-
*/
|
|
38
|
-
async delete() {
|
|
39
|
-
let path = '/account';
|
|
40
|
-
let payload = {};
|
|
41
|
-
|
|
42
|
-
return await this.client.call('delete', path, {
|
|
43
|
-
'content-type': 'application/json',
|
|
44
|
-
}, payload);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
26
|
/**
|
|
48
27
|
* Update Account Email
|
|
49
28
|
*
|
|
@@ -145,7 +124,7 @@ class Account extends Service {
|
|
|
145
124
|
*
|
|
146
125
|
* Update currently logged in user password. For validation, user is required
|
|
147
126
|
* to pass in the new password, and the old password. For users created with
|
|
148
|
-
* OAuth and
|
|
127
|
+
* OAuth, Team Invites and Magic URL, oldPassword is optional.
|
|
149
128
|
*
|
|
150
129
|
* @param {string} password
|
|
151
130
|
* @param {string} oldPassword
|
|
@@ -383,6 +362,10 @@ class Account extends Service {
|
|
|
383
362
|
/**
|
|
384
363
|
* Update Session (Refresh Tokens)
|
|
385
364
|
*
|
|
365
|
+
* Access tokens have limited lifespan and expire to mitigate security risks.
|
|
366
|
+
* If session was created using an OAuth provider, this route can be used to
|
|
367
|
+
* "refresh" the access token.
|
|
368
|
+
*
|
|
386
369
|
* @param {string} sessionId
|
|
387
370
|
* @throws {AppwriteException}
|
|
388
371
|
* @returns {Promise}
|
|
@@ -425,6 +408,25 @@ class Account extends Service {
|
|
|
425
408
|
}, payload);
|
|
426
409
|
}
|
|
427
410
|
|
|
411
|
+
/**
|
|
412
|
+
* Update Account Status
|
|
413
|
+
*
|
|
414
|
+
* Block the currently logged in user account. Behind the scene, the user
|
|
415
|
+
* record is not deleted but permanently blocked from any access. To
|
|
416
|
+
* completely delete a user, use the Users API instead.
|
|
417
|
+
*
|
|
418
|
+
* @throws {AppwriteException}
|
|
419
|
+
* @returns {Promise}
|
|
420
|
+
*/
|
|
421
|
+
async updateStatus() {
|
|
422
|
+
let path = '/account/status';
|
|
423
|
+
let payload = {};
|
|
424
|
+
|
|
425
|
+
return await this.client.call('patch', path, {
|
|
426
|
+
'content-type': 'application/json',
|
|
427
|
+
}, payload);
|
|
428
|
+
}
|
|
429
|
+
|
|
428
430
|
/**
|
|
429
431
|
* Create Email Verification
|
|
430
432
|
*
|
package/lib/services/avatars.js
CHANGED
|
@@ -10,9 +10,14 @@ class Avatars extends Service {
|
|
|
10
10
|
* Get Browser Icon
|
|
11
11
|
*
|
|
12
12
|
* You can use this endpoint to show different browser icons to your users.
|
|
13
|
-
* The code argument receives the browser code as it appears in your user
|
|
14
|
-
* /account/sessions endpoint. Use
|
|
15
|
-
* change the output settings.
|
|
13
|
+
* The code argument receives the browser code as it appears in your user [GET
|
|
14
|
+
* /account/sessions](/docs/client/account#accountGetSessions) endpoint. Use
|
|
15
|
+
* width, height and quality arguments to change the output settings.
|
|
16
|
+
*
|
|
17
|
+
* When one dimension is specified and the other is 0, the image is scaled
|
|
18
|
+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
19
|
+
* image at source quality. If dimensions are not specified, the default size
|
|
20
|
+
* of image returned is 100x100px.
|
|
16
21
|
*
|
|
17
22
|
* @param {string} code
|
|
18
23
|
* @param {number} width
|
|
@@ -52,6 +57,12 @@ class Avatars extends Service {
|
|
|
52
57
|
* The credit card endpoint will return you the icon of the credit card
|
|
53
58
|
* provider you need. Use width, height and quality arguments to change the
|
|
54
59
|
* output settings.
|
|
60
|
+
*
|
|
61
|
+
* When one dimension is specified and the other is 0, the image is scaled
|
|
62
|
+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
63
|
+
* image at source quality. If dimensions are not specified, the default size
|
|
64
|
+
* of image returned is 100x100px.
|
|
65
|
+
*
|
|
55
66
|
*
|
|
56
67
|
* @param {string} code
|
|
57
68
|
* @param {number} width
|
|
@@ -119,6 +130,12 @@ class Avatars extends Service {
|
|
|
119
130
|
* You can use this endpoint to show different country flags icons to your
|
|
120
131
|
* users. The code argument receives the 2 letter country code. Use width,
|
|
121
132
|
* height and quality arguments to change the output settings.
|
|
133
|
+
*
|
|
134
|
+
* When one dimension is specified and the other is 0, the image is scaled
|
|
135
|
+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
136
|
+
* image at source quality. If dimensions are not specified, the default size
|
|
137
|
+
* of image returned is 100x100px.
|
|
138
|
+
*
|
|
122
139
|
*
|
|
123
140
|
* @param {string} code
|
|
124
141
|
* @param {number} width
|
|
@@ -159,6 +176,12 @@ class Avatars extends Service {
|
|
|
159
176
|
* you want. This endpoint is very useful if you need to crop and display
|
|
160
177
|
* remote images in your app or in case you want to make sure a 3rd party
|
|
161
178
|
* image is properly served using a TLS protocol.
|
|
179
|
+
*
|
|
180
|
+
* When one dimension is specified and the other is 0, the image is scaled
|
|
181
|
+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
182
|
+
* image at source quality. If dimensions are not specified, the default size
|
|
183
|
+
* of image returned is 400x400px.
|
|
184
|
+
*
|
|
162
185
|
*
|
|
163
186
|
* @param {string} url
|
|
164
187
|
* @param {number} width
|
|
@@ -204,6 +227,12 @@ class Avatars extends Service {
|
|
|
204
227
|
* default, a random theme will be selected. The random theme will persist for
|
|
205
228
|
* the user's initials when reloading the same theme will always return for
|
|
206
229
|
* the same initials.
|
|
230
|
+
*
|
|
231
|
+
* When one dimension is specified and the other is 0, the image is scaled
|
|
232
|
+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
233
|
+
* image at source quality. If dimensions are not specified, the default size
|
|
234
|
+
* of image returned is 100x100px.
|
|
235
|
+
*
|
|
207
236
|
*
|
|
208
237
|
* @param {string} name
|
|
209
238
|
* @param {number} width
|
|
@@ -247,6 +276,7 @@ class Avatars extends Service {
|
|
|
247
276
|
*
|
|
248
277
|
* Converts a given plain text to a QR code image. You can use the query
|
|
249
278
|
* parameters to change the size and style of the resulting image.
|
|
279
|
+
*
|
|
250
280
|
*
|
|
251
281
|
* @param {string} text
|
|
252
282
|
* @param {number} size
|
package/lib/services/database.js
CHANGED
|
@@ -925,9 +925,7 @@ class Database extends Service {
|
|
|
925
925
|
/**
|
|
926
926
|
* Delete Document
|
|
927
927
|
*
|
|
928
|
-
* Delete a document by its unique ID.
|
|
929
|
-
* documents, its attributes and relations to other documents. Child documents
|
|
930
|
-
* **will not** be deleted.
|
|
928
|
+
* Delete a document by its unique ID.
|
|
931
929
|
*
|
|
932
930
|
* @param {string} collectionId
|
|
933
931
|
* @param {string} documentId
|
package/lib/services/health.js
CHANGED
|
@@ -127,24 +127,6 @@ class Health extends Service {
|
|
|
127
127
|
}, payload);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
/**
|
|
131
|
-
* Get Usage Queue
|
|
132
|
-
*
|
|
133
|
-
* Get the number of usage stats that are waiting to be processed in the
|
|
134
|
-
* Appwrite internal queue server.
|
|
135
|
-
*
|
|
136
|
-
* @throws {AppwriteException}
|
|
137
|
-
* @returns {Promise}
|
|
138
|
-
*/
|
|
139
|
-
async getQueueUsage() {
|
|
140
|
-
let path = '/health/queue/usage';
|
|
141
|
-
let payload = {};
|
|
142
|
-
|
|
143
|
-
return await this.client.call('get', path, {
|
|
144
|
-
'content-type': 'application/json',
|
|
145
|
-
}, payload);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
130
|
/**
|
|
149
131
|
* Get Webhooks Queue
|
|
150
132
|
*
|
package/lib/services/users.js
CHANGED
|
@@ -128,7 +128,11 @@ class Users extends Service {
|
|
|
128
128
|
/**
|
|
129
129
|
* Delete User
|
|
130
130
|
*
|
|
131
|
-
* Delete a user by its unique ID.
|
|
131
|
+
* Delete a user by its unique ID, thereby releasing it's ID. Since ID is
|
|
132
|
+
* released and can be reused, all user-related resources like documents or
|
|
133
|
+
* storage files should be deleted before user deletion. If you want to keep
|
|
134
|
+
* ID reserved, use the [updateStatus](/docs/server/users#usersUpdateStatus)
|
|
135
|
+
* endpoint instead.
|
|
132
136
|
*
|
|
133
137
|
* @param {string} userId
|
|
134
138
|
* @throws {AppwriteException}
|
|
@@ -210,6 +214,28 @@ class Users extends Service {
|
|
|
210
214
|
}, payload);
|
|
211
215
|
}
|
|
212
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Get User Memberships
|
|
219
|
+
*
|
|
220
|
+
* Get the user membership list by its unique ID.
|
|
221
|
+
*
|
|
222
|
+
* @param {string} userId
|
|
223
|
+
* @throws {AppwriteException}
|
|
224
|
+
* @returns {Promise}
|
|
225
|
+
*/
|
|
226
|
+
async getMemberships(userId) {
|
|
227
|
+
if (typeof userId === 'undefined') {
|
|
228
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
let path = '/users/{userId}/memberships'.replace('{userId}', userId);
|
|
232
|
+
let payload = {};
|
|
233
|
+
|
|
234
|
+
return await this.client.call('get', path, {
|
|
235
|
+
'content-type': 'application/json',
|
|
236
|
+
}, payload);
|
|
237
|
+
}
|
|
238
|
+
|
|
213
239
|
/**
|
|
214
240
|
* Update Name
|
|
215
241
|
*
|
|
@@ -401,7 +427,8 @@ class Users extends Service {
|
|
|
401
427
|
/**
|
|
402
428
|
* Update User Status
|
|
403
429
|
*
|
|
404
|
-
* Update the user status by its unique ID.
|
|
430
|
+
* Update the user status by its unique ID. Use this endpoint as an
|
|
431
|
+
* alternative to deleting a user if you want to keep user's ID reserved.
|
|
405
432
|
*
|
|
406
433
|
* @param {string} userId
|
|
407
434
|
* @param {boolean} status
|
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": "
|
|
5
|
+
"version": "6.0.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.
|
|
15
|
+
"axios": "^0.27.2",
|
|
16
16
|
"form-data": "^4.0.0"
|
|
17
17
|
}
|
|
18
18
|
}
|