node-appwrite 4.0.2 → 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.
Files changed (36) hide show
  1. package/README.md +2 -2
  2. package/docs/examples/account/update-session.md +20 -0
  3. package/docs/examples/account/{delete.md → update-status.md} +1 -1
  4. package/docs/examples/functions/{create-tag.md → create-deployment.md} +1 -1
  5. package/docs/examples/functions/{delete-tag.md → delete-deployment.md} +1 -1
  6. package/docs/examples/functions/{update-tag.md → get-deployment.md} +1 -1
  7. package/docs/examples/functions/{list-tags.md → list-deployments.md} +1 -1
  8. package/docs/examples/functions/retry-build.md +20 -0
  9. package/docs/examples/functions/{get-tag.md → update-deployment.md} +1 -1
  10. package/docs/examples/storage/create-bucket.md +20 -0
  11. package/docs/examples/storage/create-file.md +1 -1
  12. package/docs/examples/storage/delete-bucket.md +20 -0
  13. package/docs/examples/storage/delete-file.md +1 -1
  14. package/docs/examples/storage/get-bucket.md +20 -0
  15. package/docs/examples/storage/get-file-download.md +1 -1
  16. package/docs/examples/storage/get-file-preview.md +1 -1
  17. package/docs/examples/storage/get-file-view.md +1 -1
  18. package/docs/examples/storage/get-file.md +1 -1
  19. package/docs/examples/{health/get-queue-usage.md → storage/list-buckets.md} +2 -2
  20. package/docs/examples/storage/list-files.md +1 -1
  21. package/docs/examples/storage/update-bucket.md +20 -0
  22. package/docs/examples/storage/update-file.md +1 -1
  23. package/docs/examples/users/get-memberships.md +20 -0
  24. package/index.d.ts +485 -188
  25. package/lib/client.js +7 -5
  26. package/lib/exception.js +2 -1
  27. package/lib/services/account.js +49 -23
  28. package/lib/services/avatars.js +36 -3
  29. package/lib/services/database.js +7 -6
  30. package/lib/services/functions.js +213 -118
  31. package/lib/services/health.js +3 -18
  32. package/lib/services/locale.js +3 -0
  33. package/lib/services/storage.js +390 -33
  34. package/lib/services/teams.js +7 -0
  35. package/lib/services/users.js +32 -2
  36. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -1,13 +1,26 @@
1
1
  declare module "node-appwrite" {
2
2
  export namespace Models {
3
+ /**
4
+ * Documents List
5
+ */
6
+ export type DocumentList<Document extends Models.Document> = {
7
+ /**
8
+ * Total number of documents documents that matched your query.
9
+ */
10
+ total: number;
11
+ /**
12
+ * List of documents.
13
+ */
14
+ documents: Document[];
15
+ }
3
16
  /**
4
17
  * Collections List
5
18
  */
6
19
  export type CollectionList = {
7
20
  /**
8
- * Total number of items available on the server.
21
+ * Total number of collections documents that matched your query.
9
22
  */
10
- sum: number;
23
+ total: number;
11
24
  /**
12
25
  * List of collections.
13
26
  */
@@ -18,35 +31,22 @@ declare module "node-appwrite" {
18
31
  */
19
32
  export type IndexList = {
20
33
  /**
21
- * Total number of items available on the server.
34
+ * Total number of indexes documents that matched your query.
22
35
  */
23
- sum: number;
36
+ total: number;
24
37
  /**
25
38
  * List of indexes.
26
39
  */
27
40
  indexes: Index[];
28
41
  }
29
42
  /**
30
- * Documents List
31
- */
32
- export type DocumentList<Document extends Models.Document> = {
33
- /**
34
- * Total number of items available on the server.
35
- */
36
- sum: number;
37
- /**
38
- * List of documents.
39
- */
40
- documents: Document[];
41
- }
42
- /**
43
43
  * Users List
44
44
  */
45
45
  export type UserList<Preferences extends Models.Preferences> = {
46
46
  /**
47
- * Total number of items available on the server.
47
+ * Total number of users documents that matched your query.
48
48
  */
49
- sum: number;
49
+ total: number;
50
50
  /**
51
51
  * List of users.
52
52
  */
@@ -57,9 +57,9 @@ declare module "node-appwrite" {
57
57
  */
58
58
  export type SessionList = {
59
59
  /**
60
- * Total number of items available on the server.
60
+ * Total number of sessions documents that matched your query.
61
61
  */
62
- sum: number;
62
+ total: number;
63
63
  /**
64
64
  * List of sessions.
65
65
  */
@@ -70,9 +70,9 @@ declare module "node-appwrite" {
70
70
  */
71
71
  export type LogList = {
72
72
  /**
73
- * Total number of items available on the server.
73
+ * Total number of logs documents that matched your query.
74
74
  */
75
- sum: number;
75
+ total: number;
76
76
  /**
77
77
  * List of logs.
78
78
  */
@@ -83,22 +83,35 @@ declare module "node-appwrite" {
83
83
  */
84
84
  export type FileList = {
85
85
  /**
86
- * Total number of items available on the server.
86
+ * Total number of files documents that matched your query.
87
87
  */
88
- sum: number;
88
+ total: number;
89
89
  /**
90
90
  * List of files.
91
91
  */
92
92
  files: File[];
93
93
  }
94
94
  /**
95
+ * Buckets List
96
+ */
97
+ export type BucketList = {
98
+ /**
99
+ * Total number of buckets documents that matched your query.
100
+ */
101
+ total: number;
102
+ /**
103
+ * List of buckets.
104
+ */
105
+ buckets: Bucket[];
106
+ }
107
+ /**
95
108
  * Teams List
96
109
  */
97
110
  export type TeamList = {
98
111
  /**
99
- * Total number of items available on the server.
112
+ * Total number of teams documents that matched your query.
100
113
  */
101
- sum: number;
114
+ total: number;
102
115
  /**
103
116
  * List of teams.
104
117
  */
@@ -109,9 +122,9 @@ declare module "node-appwrite" {
109
122
  */
110
123
  export type MembershipList = {
111
124
  /**
112
- * Total number of items available on the server.
125
+ * Total number of memberships documents that matched your query.
113
126
  */
114
- sum: number;
127
+ total: number;
115
128
  /**
116
129
  * List of memberships.
117
130
  */
@@ -122,9 +135,9 @@ declare module "node-appwrite" {
122
135
  */
123
136
  export type FunctionList = {
124
137
  /**
125
- * Total number of items available on the server.
138
+ * Total number of functions documents that matched your query.
126
139
  */
127
- sum: number;
140
+ total: number;
128
141
  /**
129
142
  * List of functions.
130
143
  */
@@ -135,35 +148,35 @@ declare module "node-appwrite" {
135
148
  */
136
149
  export type RuntimeList = {
137
150
  /**
138
- * Total number of items available on the server.
151
+ * Total number of runtimes documents that matched your query.
139
152
  */
140
- sum: number;
153
+ total: number;
141
154
  /**
142
155
  * List of runtimes.
143
156
  */
144
157
  runtimes: Runtime[];
145
158
  }
146
159
  /**
147
- * Tags List
160
+ * Deployments List
148
161
  */
149
- export type TagList = {
162
+ export type DeploymentList = {
150
163
  /**
151
- * Total number of items available on the server.
164
+ * Total number of deployments documents that matched your query.
152
165
  */
153
- sum: number;
166
+ total: number;
154
167
  /**
155
- * List of tags.
168
+ * List of deployments.
156
169
  */
157
- tags: Tag[];
170
+ deployments: Deployment[];
158
171
  }
159
172
  /**
160
173
  * Executions List
161
174
  */
162
175
  export type ExecutionList = {
163
176
  /**
164
- * Total number of items available on the server.
177
+ * Total number of executions documents that matched your query.
165
178
  */
166
- sum: number;
179
+ total: number;
167
180
  /**
168
181
  * List of executions.
169
182
  */
@@ -174,9 +187,9 @@ declare module "node-appwrite" {
174
187
  */
175
188
  export type CountryList = {
176
189
  /**
177
- * Total number of items available on the server.
190
+ * Total number of countries documents that matched your query.
178
191
  */
179
- sum: number;
192
+ total: number;
180
193
  /**
181
194
  * List of countries.
182
195
  */
@@ -187,9 +200,9 @@ declare module "node-appwrite" {
187
200
  */
188
201
  export type ContinentList = {
189
202
  /**
190
- * Total number of items available on the server.
203
+ * Total number of continents documents that matched your query.
191
204
  */
192
- sum: number;
205
+ total: number;
193
206
  /**
194
207
  * List of continents.
195
208
  */
@@ -200,9 +213,9 @@ declare module "node-appwrite" {
200
213
  */
201
214
  export type LanguageList = {
202
215
  /**
203
- * Total number of items available on the server.
216
+ * Total number of languages documents that matched your query.
204
217
  */
205
- sum: number;
218
+ total: number;
206
219
  /**
207
220
  * List of languages.
208
221
  */
@@ -213,9 +226,9 @@ declare module "node-appwrite" {
213
226
  */
214
227
  export type CurrencyList = {
215
228
  /**
216
- * Total number of items available on the server.
229
+ * Total number of currencies documents that matched your query.
217
230
  */
218
- sum: number;
231
+ total: number;
219
232
  /**
220
233
  * List of currencies.
221
234
  */
@@ -226,9 +239,9 @@ declare module "node-appwrite" {
226
239
  */
227
240
  export type PhoneList = {
228
241
  /**
229
- * Total number of items available on the server.
242
+ * Total number of phones documents that matched your query.
230
243
  */
231
- sum: number;
244
+ total: number;
232
245
  /**
233
246
  * List of phones.
234
247
  */
@@ -276,9 +289,9 @@ declare module "node-appwrite" {
276
289
  */
277
290
  export type AttributeList = {
278
291
  /**
279
- * Total sum of items in the list.
292
+ * Total number of attributes in the given collection.
280
293
  */
281
- sum: number;
294
+ total: number;
282
295
  /**
283
296
  * List of attributes.
284
297
  */
@@ -758,9 +771,17 @@ declare module "node-appwrite" {
758
771
  */
759
772
  providerUid: string;
760
773
  /**
761
- * Session Provider Token.
774
+ * Session Provider Access Token.
762
775
  */
763
- providerToken: string;
776
+ providerAccessToken: string;
777
+ /**
778
+ * Date, the Unix timestamp of when the access token expires.
779
+ */
780
+ providerAccessTokenExpiry: number;
781
+ /**
782
+ * Session Provider Refresh Token.
783
+ */
784
+ providerRefreshToken: string;
764
785
  /**
765
786
  * IP in use when the session was created.
766
787
  */
@@ -889,6 +910,10 @@ declare module "node-appwrite" {
889
910
  */
890
911
  $id: string;
891
912
  /**
913
+ * Bucket ID.
914
+ */
915
+ bucketId: string;
916
+ /**
892
917
  * File read permissions.
893
918
  */
894
919
  $read: string[];
@@ -916,6 +941,67 @@ declare module "node-appwrite" {
916
941
  * File original size in bytes.
917
942
  */
918
943
  sizeOriginal: number;
944
+ /**
945
+ * Total number of chunks available
946
+ */
947
+ chunksTotal: number;
948
+ /**
949
+ * Total number of chunks uploaded
950
+ */
951
+ chunksUploaded: number;
952
+ }
953
+ /**
954
+ * Bucket
955
+ */
956
+ export type Bucket = {
957
+ /**
958
+ * Bucket ID.
959
+ */
960
+ $id: string;
961
+ /**
962
+ * File read permissions.
963
+ */
964
+ $read: string[];
965
+ /**
966
+ * File write permissions.
967
+ */
968
+ $write: string[];
969
+ /**
970
+ * Bucket permission model. Possible values: `bucket` or `file`
971
+ */
972
+ permission: string;
973
+ /**
974
+ * Bucket creation date in Unix timestamp.
975
+ */
976
+ dateCreated: number;
977
+ /**
978
+ * Bucket update date in Unix timestamp.
979
+ */
980
+ dateUpdated: number;
981
+ /**
982
+ * Bucket name.
983
+ */
984
+ name: string;
985
+ /**
986
+ * Bucket enabled.
987
+ */
988
+ enabled: boolean;
989
+ /**
990
+ * Maximum file size supported.
991
+ */
992
+ maximumFileSize: number;
993
+ /**
994
+ * Allowed file extensions.
995
+ */
996
+ allowedFileExtensions: string[];
997
+ /**
998
+ * Bucket is encrypted.
999
+ */
1000
+ encryption: boolean;
1001
+ /**
1002
+ * Virus scanning is enabled.
1003
+ */
1004
+ antivirus: boolean;
919
1005
  }
920
1006
  /**
921
1007
  * Team
@@ -934,9 +1020,9 @@ declare module "node-appwrite" {
934
1020
  */
935
1021
  dateCreated: number;
936
1022
  /**
937
- * Total sum of team members.
1023
+ * Total number of team members.
938
1024
  */
939
- sum: number;
1025
+ total: number;
940
1026
  }
941
1027
  /**
942
1028
  * Membership
@@ -951,17 +1037,21 @@ declare module "node-appwrite" {
951
1037
  */
952
1038
  userId: string;
953
1039
  /**
954
- * Team ID.
955
- */
956
- teamId: string;
957
- /**
958
1040
  * User name.
959
1041
  */
960
- name: string;
1042
+ userName: string;
961
1043
  /**
962
1044
  * User email address.
963
1045
  */
964
- email: string;
1046
+ userEmail: string;
1047
+ /**
1048
+ * Team ID.
1049
+ */
1050
+ teamId: string;
1051
+ /**
1052
+ * Team name.
1053
+ */
1054
+ teamName: string;
965
1055
  /**
966
1056
  * Date, the user has been invited to join the team in Unix timestamp.
967
1057
  */
@@ -990,7 +1080,7 @@ declare module "node-appwrite" {
990
1080
  /**
991
1081
  * Execution permissions.
992
1082
  */
993
- execute: string;
1083
+ execute: string[];
994
1084
  /**
995
1085
  * Function name.
996
1086
  */
@@ -1012,13 +1102,13 @@ declare module "node-appwrite" {
1012
1102
  */
1013
1103
  runtime: string;
1014
1104
  /**
1015
- * Function active tag ID.
1105
+ * Function&#039;s active deployment ID.
1016
1106
  */
1017
- tag: string;
1107
+ deployment: string;
1018
1108
  /**
1019
1109
  * Function environment variables.
1020
1110
  */
1021
- vars: string;
1111
+ vars: object;
1022
1112
  /**
1023
1113
  * Function trigger events.
1024
1114
  */
@@ -1074,29 +1164,53 @@ declare module "node-appwrite" {
1074
1164
  supports: string[];
1075
1165
  }
1076
1166
  /**
1077
- * Tag
1167
+ * Deployment
1078
1168
  */
1079
- export type Tag = {
1169
+ export type Deployment = {
1080
1170
  /**
1081
- * Tag ID.
1171
+ * Deployment ID.
1082
1172
  */
1083
1173
  $id: string;
1084
1174
  /**
1085
- * Function ID.
1175
+ * Resource ID.
1086
1176
  */
1087
- functionId: string;
1177
+ resourceId: string;
1178
+ /**
1179
+ * Resource type.
1180
+ */
1181
+ resourceType: string;
1088
1182
  /**
1089
- * The tag creation date in Unix timestamp.
1183
+ * The deployment creation date in Unix timestamp.
1090
1184
  */
1091
1185
  dateCreated: number;
1092
1186
  /**
1093
- * The entrypoint command in use to execute the tag code.
1187
+ * The entrypoint file to use to execute the deployment code.
1094
1188
  */
1095
- command: string;
1189
+ entrypoint: string;
1096
1190
  /**
1097
1191
  * The code size in bytes.
1098
1192
  */
1099
- size: string;
1193
+ size: number;
1194
+ /**
1195
+ * The current build ID.
1196
+ */
1197
+ buildId: string;
1198
+ /**
1199
+ * Whether the deployment should be automatically activated.
1200
+ */
1201
+ activate: boolean;
1202
+ /**
1203
+ * The deployment status.
1204
+ */
1205
+ status: string;
1206
+ /**
1207
+ * The build stdout.
1208
+ */
1209
+ buildStdout: string;
1210
+ /**
1211
+ * The build stderr.
1212
+ */
1213
+ buildStderr: string;
1100
1214
  }
1101
1215
  /**
1102
1216
  * Execution
@@ -1127,13 +1241,13 @@ declare module "node-appwrite" {
1127
1241
  */
1128
1242
  status: string;
1129
1243
  /**
1130
- * The script exit code.
1244
+ * The script status code.
1131
1245
  */
1132
- exitCode: number;
1246
+ statusCode: number;
1133
1247
  /**
1134
- * The script stdout output string. Logs the last 4,000 characters of the execution stdout output.
1248
+ * The script response output string. Logs the last 4,000 characters of the execution response output.
1135
1249
  */
1136
- stdout: string;
1250
+ response: string;
1137
1251
  /**
1138
1252
  * The script stderr output string. Logs the last 4,000 characters of the execution stderr output
1139
1253
  */
@@ -1362,6 +1476,30 @@ declare module "node-appwrite" {
1362
1476
  constructor(client: Client);
1363
1477
  }
1364
1478
 
1479
+ type QueryTypesSingle = string | number | boolean;
1480
+ type QueryTypesList = string[] | number[] | boolean[];
1481
+ type QueryTypes = QueryTypesSingle | QueryTypesList;
1482
+
1483
+ export class Query {
1484
+ static equal(attribute: string, value: QueryTypes): string;
1485
+
1486
+ static notEqual(attribute: string, value: QueryTypes): string;
1487
+
1488
+ static lesser(attribute: string, value: QueryTypes): string;
1489
+
1490
+ static lesserEqual(attribute: string, value: QueryTypes): string;
1491
+
1492
+ static greater(attribute: string, value: QueryTypes): string;
1493
+
1494
+ static greaterEqual(attribute: string, value: QueryTypes): string;
1495
+
1496
+ static search(attribute: string, value: string): string;
1497
+
1498
+ private static addQuery(attribute: string, oper: string, value: QueryTypes): string;
1499
+
1500
+ private static parseValues(value: QueryTypes): string;
1501
+ }
1502
+
1365
1503
  export class Account extends Service {
1366
1504
  /**
1367
1505
  * Get Account
@@ -1372,19 +1510,6 @@ declare module "node-appwrite" {
1372
1510
  * @returns {Promise}
1373
1511
  */
1374
1512
  get<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>>;
1375
- /**
1376
- * Delete Account
1377
- *
1378
- * Delete a currently logged in user account. Behind the scene, the user
1379
- * record is not deleted but permanently blocked from any access. This is done
1380
- * to avoid deleted accounts being overtaken by new users with the same email
1381
- * address. Any user-related resources like documents or storage files should
1382
- * be deleted separately.
1383
- *
1384
- * @throws {AppwriteException}
1385
- * @returns {Promise}
1386
- */
1387
- delete(): Promise<Response>;
1388
1513
  /**
1389
1514
  * Update Account Email
1390
1515
  *
@@ -1430,7 +1555,7 @@ declare module "node-appwrite" {
1430
1555
  *
1431
1556
  * Update currently logged in user password. For validation, user is required
1432
1557
  * to pass in the new password, and the old password. For users created with
1433
- * OAuth and Team Invites, oldPassword is optional.
1558
+ * OAuth, Team Invites and Magic URL, oldPassword is optional.
1434
1559
  *
1435
1560
  * @param {string} password
1436
1561
  * @param {string} oldPassword
@@ -1529,18 +1654,42 @@ declare module "node-appwrite" {
1529
1654
  * @returns {Promise}
1530
1655
  */
1531
1656
  getSession(sessionId: string): Promise<Models.Session>;
1657
+ /**
1658
+ * Update Session (Refresh Tokens)
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
+ *
1664
+ * @param {string} sessionId
1665
+ * @throws {AppwriteException}
1666
+ * @returns {Promise}
1667
+ */
1668
+ updateSession(sessionId: string): Promise<Models.Session>;
1532
1669
  /**
1533
1670
  * Delete Account Session
1534
1671
  *
1535
1672
  * Use this endpoint to log out the currently logged in user from all their
1536
1673
  * account sessions across all of their different devices. When using the
1537
- * option id argument, only the session unique ID provider will be deleted.
1674
+ * Session ID argument, only the unique session ID provided is deleted.
1675
+ *
1538
1676
  *
1539
1677
  * @param {string} sessionId
1540
1678
  * @throws {AppwriteException}
1541
1679
  * @returns {Promise}
1542
1680
  */
1543
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>>;
1544
1693
  /**
1545
1694
  * Create Email Verification
1546
1695
  *
@@ -1585,9 +1734,14 @@ declare module "node-appwrite" {
1585
1734
  * Get Browser Icon
1586
1735
  *
1587
1736
  * You can use this endpoint to show different browser icons to your users.
1588
- * The code argument receives the browser code as it appears in your user
1589
- * /account/sessions endpoint. Use width, height and quality arguments to
1590
- * 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.
1591
1745
  *
1592
1746
  * @param {string} code
1593
1747
  * @param {number} width
@@ -1603,6 +1757,12 @@ declare module "node-appwrite" {
1603
1757
  * The credit card endpoint will return you the icon of the credit card
1604
1758
  * provider you need. Use width, height and quality arguments to change the
1605
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
+ *
1606
1766
  *
1607
1767
  * @param {string} code
1608
1768
  * @param {number} width
@@ -1630,6 +1790,12 @@ declare module "node-appwrite" {
1630
1790
  * You can use this endpoint to show different country flags icons to your
1631
1791
  * users. The code argument receives the 2 letter country code. Use width,
1632
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
+ *
1633
1799
  *
1634
1800
  * @param {string} code
1635
1801
  * @param {number} width
@@ -1646,6 +1812,12 @@ declare module "node-appwrite" {
1646
1812
  * you want. This endpoint is very useful if you need to crop and display
1647
1813
  * remote images in your app or in case you want to make sure a 3rd party
1648
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
+ *
1649
1821
  *
1650
1822
  * @param {string} url
1651
1823
  * @param {number} width
@@ -1667,6 +1839,12 @@ declare module "node-appwrite" {
1667
1839
  * default, a random theme will be selected. The random theme will persist for
1668
1840
  * the user's initials when reloading the same theme will always return for
1669
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
+ *
1670
1848
  *
1671
1849
  * @param {string} name
1672
1850
  * @param {number} width
@@ -1682,6 +1860,7 @@ declare module "node-appwrite" {
1682
1860
  *
1683
1861
  * Converts a given plain text to a QR code image. You can use the query
1684
1862
  * parameters to change the size and style of the resulting image.
1863
+ *
1685
1864
  *
1686
1865
  * @param {string} text
1687
1866
  * @param {number} size
@@ -1823,14 +2002,14 @@ declare module "node-appwrite" {
1823
2002
  * @param {string} collectionId
1824
2003
  * @param {string} key
1825
2004
  * @param {boolean} required
1826
- * @param {string} min
1827
- * @param {string} max
1828
- * @param {string} default
2005
+ * @param {number} min
2006
+ * @param {number} max
2007
+ * @param {number} default
1829
2008
  * @param {boolean} array
1830
2009
  * @throws {AppwriteException}
1831
2010
  * @returns {Promise}
1832
2011
  */
1833
- createFloatAttribute(collectionId: string, key: string, required: boolean, min?: string, max?: string, xdefault?: string, array?: boolean): Promise<Models.AttributeFloat>;
2012
+ createFloatAttribute(collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat>;
1834
2013
  /**
1835
2014
  * Create Integer Attribute
1836
2015
  *
@@ -1980,9 +2159,7 @@ declare module "node-appwrite" {
1980
2159
  /**
1981
2160
  * Delete Document
1982
2161
  *
1983
- * Delete a document by its unique ID. This endpoint deletes only the parent
1984
- * documents, its attributes and relations to other documents. Child documents
1985
- * **will not** be deleted.
2162
+ * Delete a document by its unique ID.
1986
2163
  *
1987
2164
  * @param {string} collectionId
1988
2165
  * @param {string} documentId
@@ -2066,9 +2243,9 @@ declare module "node-appwrite" {
2066
2243
  */
2067
2244
  create(functionId: string, name: string, execute: string[], runtime: string, vars?: object, events?: string[], schedule?: string, timeout?: number): Promise<Models.Function>;
2068
2245
  /**
2069
- * List the currently active function runtimes.
2246
+ * List runtimes
2070
2247
  *
2071
- * Get a list of all runtimes that are currently active in your project.
2248
+ * Get a list of all runtimes that are currently active on your instance.
2072
2249
  *
2073
2250
  * @throws {AppwriteException}
2074
2251
  * @returns {Promise}
@@ -2111,121 +2288,133 @@ declare module "node-appwrite" {
2111
2288
  */
2112
2289
  delete(functionId: string): Promise<Response>;
2113
2290
  /**
2114
- * List Executions
2291
+ * List Deployments
2115
2292
  *
2116
- * Get a list of all the current user function execution logs. You can use the
2117
- * query params to filter your results. On admin mode, this endpoint will
2118
- * return a list of all of the project's executions. [Learn more about
2119
- * different API modes](/docs/admin).
2293
+ * Get a list of all the project's code deployments. You can use the query
2294
+ * params to filter your results.
2120
2295
  *
2121
2296
  * @param {string} functionId
2297
+ * @param {string} search
2122
2298
  * @param {number} limit
2123
2299
  * @param {number} offset
2124
- * @param {string} search
2125
2300
  * @param {string} cursor
2126
2301
  * @param {string} cursorDirection
2302
+ * @param {string} orderType
2127
2303
  * @throws {AppwriteException}
2128
2304
  * @returns {Promise}
2129
2305
  */
2130
- listExecutions(functionId: string, limit?: number, offset?: number, search?: string, cursor?: string, cursorDirection?: string): Promise<Models.ExecutionList>;
2306
+ listDeployments(functionId: string, search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.DeploymentList>;
2131
2307
  /**
2132
- * Create Execution
2308
+ * Create Deployment
2133
2309
  *
2134
- * Trigger a function execution. The returned object will return you the
2135
- * current execution status. You can ping the `Get Execution` endpoint to get
2136
- * updates on the current execution status. Once this endpoint is called, your
2137
- * function execution process will start asynchronously.
2310
+ * Create a new function code deployment. Use this endpoint to upload a new
2311
+ * version of your code function. To execute your newly uploaded code, you'll
2312
+ * need to update the function's deployment to use your new deployment UID.
2313
+ *
2314
+ * This endpoint accepts a tar.gz file compressed with your code. Make sure to
2315
+ * include any dependencies your code has within the compressed file. You can
2316
+ * learn more about code packaging in the [Appwrite Cloud Functions
2317
+ * tutorial](/docs/functions).
2318
+ *
2319
+ * Use the "command" param to set the entry point used to execute your code.
2138
2320
  *
2139
2321
  * @param {string} functionId
2140
- * @param {string} data
2322
+ * @param {string} entrypoint
2323
+ * @param {string} code
2324
+ * @param {boolean} activate
2141
2325
  * @throws {AppwriteException}
2142
2326
  * @returns {Promise}
2143
2327
  */
2144
- createExecution(functionId: string, data?: string): Promise<Models.Execution>;
2328
+ createDeployment(functionId: string, entrypoint: string, code: string, activate: boolean): Promise<Models.Deployment>;
2145
2329
  /**
2146
- * Get Execution
2330
+ * Get Deployment
2147
2331
  *
2148
- * Get a function execution log by its unique ID.
2332
+ * Get a code deployment by its unique ID.
2149
2333
  *
2150
2334
  * @param {string} functionId
2151
- * @param {string} executionId
2335
+ * @param {string} deploymentId
2152
2336
  * @throws {AppwriteException}
2153
2337
  * @returns {Promise}
2154
2338
  */
2155
- getExecution(functionId: string, executionId: string): Promise<Models.Execution>;
2339
+ getDeployment(functionId: string, deploymentId: string): Promise<Models.DeploymentList>;
2156
2340
  /**
2157
- * Update Function Tag
2341
+ * Update Function Deployment
2158
2342
  *
2159
- * Update the function code tag ID using the unique function ID. Use this
2160
- * endpoint to switch the code tag that should be executed by the execution
2161
- * endpoint.
2343
+ * Update the function code deployment ID using the unique function ID. Use
2344
+ * this endpoint to switch the code deployment that should be executed by the
2345
+ * execution endpoint.
2162
2346
  *
2163
2347
  * @param {string} functionId
2164
- * @param {string} tag
2348
+ * @param {string} deploymentId
2165
2349
  * @throws {AppwriteException}
2166
2350
  * @returns {Promise}
2167
2351
  */
2168
- updateTag(functionId: string, tag: string): Promise<Models.Function>;
2352
+ updateDeployment(functionId: string, deploymentId: string): Promise<Models.Function>;
2169
2353
  /**
2170
- * List Tags
2354
+ * Delete Deployment
2171
2355
  *
2172
- * Get a list of all the project's code tags. You can use the query params to
2173
- * filter your results.
2356
+ * Delete a code deployment by its unique ID.
2174
2357
  *
2175
2358
  * @param {string} functionId
2176
- * @param {string} search
2177
- * @param {number} limit
2178
- * @param {number} offset
2179
- * @param {string} cursor
2180
- * @param {string} cursorDirection
2181
- * @param {string} orderType
2359
+ * @param {string} deploymentId
2182
2360
  * @throws {AppwriteException}
2183
2361
  * @returns {Promise}
2184
2362
  */
2185
- listTags(functionId: string, search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.TagList>;
2363
+ deleteDeployment(functionId: string, deploymentId: string): Promise<Response>;
2186
2364
  /**
2187
- * Create Tag
2365
+ * Retry Build
2188
2366
  *
2189
- * Create a new function code tag. Use this endpoint to upload a new version
2190
- * of your code function. To execute your newly uploaded code, you'll need to
2191
- * update the function's tag to use your new tag UID.
2192
- *
2193
- * This endpoint accepts a tar.gz file compressed with your code. Make sure to
2194
- * include any dependencies your code has within the compressed file. You can
2195
- * learn more about code packaging in the [Appwrite Cloud Functions
2196
- * tutorial](/docs/functions).
2197
- *
2198
- * Use the "command" param to set the entry point used to execute your code.
2367
+ * @param {string} functionId
2368
+ * @param {string} deploymentId
2369
+ * @param {string} buildId
2370
+ * @throws {AppwriteException}
2371
+ * @returns {Promise}
2372
+ */
2373
+ retryBuild(functionId: string, deploymentId: string, buildId: string): Promise<Response>;
2374
+ /**
2375
+ * List Executions
2376
+ *
2377
+ * Get a list of all the current user function execution logs. You can use the
2378
+ * query params to filter your results. On admin mode, this endpoint will
2379
+ * return a list of all of the project's executions. [Learn more about
2380
+ * different API modes](/docs/admin).
2199
2381
  *
2200
2382
  * @param {string} functionId
2201
- * @param {string} command
2202
- * @param {File} code
2383
+ * @param {number} limit
2384
+ * @param {number} offset
2385
+ * @param {string} search
2386
+ * @param {string} cursor
2387
+ * @param {string} cursorDirection
2203
2388
  * @throws {AppwriteException}
2204
2389
  * @returns {Promise}
2205
2390
  */
2206
- createTag(functionId: string, command: string, code: File): Promise<Models.Tag>;
2391
+ listExecutions(functionId: string, limit?: number, offset?: number, search?: string, cursor?: string, cursorDirection?: string): Promise<Models.ExecutionList>;
2207
2392
  /**
2208
- * Get Tag
2393
+ * Create Execution
2209
2394
  *
2210
- * Get a code tag by its unique ID.
2395
+ * Trigger a function execution. The returned object will return you the
2396
+ * current execution status. You can ping the `Get Execution` endpoint to get
2397
+ * updates on the current execution status. Once this endpoint is called, your
2398
+ * function execution process will start asynchronously.
2211
2399
  *
2212
2400
  * @param {string} functionId
2213
- * @param {string} tagId
2401
+ * @param {string} data
2402
+ * @param {boolean} async
2214
2403
  * @throws {AppwriteException}
2215
2404
  * @returns {Promise}
2216
2405
  */
2217
- getTag(functionId: string, tagId: string): Promise<Models.Tag>;
2406
+ createExecution(functionId: string, data?: string, async?: boolean): Promise<Models.Execution>;
2218
2407
  /**
2219
- * Delete Tag
2408
+ * Get Execution
2220
2409
  *
2221
- * Delete a code tag by its unique ID.
2410
+ * Get a function execution log by its unique ID.
2222
2411
  *
2223
2412
  * @param {string} functionId
2224
- * @param {string} tagId
2413
+ * @param {string} executionId
2225
2414
  * @throws {AppwriteException}
2226
2415
  * @returns {Promise}
2227
2416
  */
2228
- deleteTag(functionId: string, tagId: string): Promise<Response>;
2417
+ getExecution(functionId: string, executionId: string): Promise<Models.Execution>;
2229
2418
  }
2230
2419
  export class Health extends Service {
2231
2420
  /**
@@ -2293,16 +2482,6 @@ declare module "node-appwrite" {
2293
2482
  * @returns {Promise}
2294
2483
  */
2295
2484
  getQueueLogs(): Promise<Models.HealthQueue>;
2296
- /**
2297
- * Get Usage Queue
2298
- *
2299
- * Get the number of usage stats that are waiting to be processed in the
2300
- * Appwrite internal queue server.
2301
- *
2302
- * @throws {AppwriteException}
2303
- * @returns {Promise}
2304
- */
2305
- getQueueUsage(): Promise<Models.HealthQueue>;
2306
2485
  /**
2307
2486
  * Get Webhooks Queue
2308
2487
  *
@@ -2416,6 +2595,81 @@ declare module "node-appwrite" {
2416
2595
  getLanguages(): Promise<Models.LanguageList>;
2417
2596
  }
2418
2597
  export class Storage extends Service {
2598
+ /**
2599
+ * List buckets
2600
+ *
2601
+ * Get a list of all the storage buckets. You can use the query params to
2602
+ * filter your results.
2603
+ *
2604
+ * @param {string} search
2605
+ * @param {number} limit
2606
+ * @param {number} offset
2607
+ * @param {string} cursor
2608
+ * @param {string} cursorDirection
2609
+ * @param {string} orderType
2610
+ * @throws {AppwriteException}
2611
+ * @returns {Promise}
2612
+ */
2613
+ listBuckets(search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.BucketList>;
2614
+ /**
2615
+ * Create bucket
2616
+ *
2617
+ * Create a new storage bucket.
2618
+ *
2619
+ * @param {string} bucketId
2620
+ * @param {string} name
2621
+ * @param {string} permission
2622
+ * @param {string[]} read
2623
+ * @param {string[]} write
2624
+ * @param {boolean} enabled
2625
+ * @param {number} maximumFileSize
2626
+ * @param {string[]} allowedFileExtensions
2627
+ * @param {boolean} encryption
2628
+ * @param {boolean} antivirus
2629
+ * @throws {AppwriteException}
2630
+ * @returns {Promise}
2631
+ */
2632
+ createBucket(bucketId: string, name: string, permission: string, read?: string[], write?: string[], enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], encryption?: boolean, antivirus?: boolean): Promise<Models.Bucket>;
2633
+ /**
2634
+ * Get Bucket
2635
+ *
2636
+ * Get a storage bucket by its unique ID. This endpoint response returns a
2637
+ * JSON object with the storage bucket metadata.
2638
+ *
2639
+ * @param {string} bucketId
2640
+ * @throws {AppwriteException}
2641
+ * @returns {Promise}
2642
+ */
2643
+ getBucket(bucketId: string): Promise<Models.Bucket>;
2644
+ /**
2645
+ * Update Bucket
2646
+ *
2647
+ * Update a storage bucket by its unique ID.
2648
+ *
2649
+ * @param {string} bucketId
2650
+ * @param {string} name
2651
+ * @param {string} permission
2652
+ * @param {string[]} read
2653
+ * @param {string[]} write
2654
+ * @param {boolean} enabled
2655
+ * @param {number} maximumFileSize
2656
+ * @param {string[]} allowedFileExtensions
2657
+ * @param {boolean} encryption
2658
+ * @param {boolean} antivirus
2659
+ * @throws {AppwriteException}
2660
+ * @returns {Promise}
2661
+ */
2662
+ updateBucket(bucketId: string, name: string, permission: string, read?: string[], write?: string[], enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], encryption?: boolean, antivirus?: boolean): Promise<Models.Bucket>;
2663
+ /**
2664
+ * Delete Bucket
2665
+ *
2666
+ * Delete a storage bucket by its unique ID.
2667
+ *
2668
+ * @param {string} bucketId
2669
+ * @throws {AppwriteException}
2670
+ * @returns {Promise}
2671
+ */
2672
+ deleteBucket(bucketId: string): Promise<Response>;
2419
2673
  /**
2420
2674
  * List Files
2421
2675
  *
@@ -2423,6 +2677,7 @@ declare module "node-appwrite" {
2423
2677
  * your results. On admin mode, this endpoint will return a list of all of the
2424
2678
  * project's files. [Learn more about different API modes](/docs/admin).
2425
2679
  *
2680
+ * @param {string} bucketId
2426
2681
  * @param {string} search
2427
2682
  * @param {number} limit
2428
2683
  * @param {number} offset
@@ -2432,57 +2687,76 @@ declare module "node-appwrite" {
2432
2687
  * @throws {AppwriteException}
2433
2688
  * @returns {Promise}
2434
2689
  */
2435
- listFiles(search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.FileList>;
2690
+ listFiles(bucketId: string, search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.FileList>;
2436
2691
  /**
2437
2692
  * Create File
2438
2693
  *
2439
- * Create a new file. The user who creates the file will automatically be
2440
- * assigned to read and write access unless he has passed custom values for
2441
- * read and write arguments.
2694
+ * Create a new file. Before using this route, you should create a new bucket
2695
+ * resource using either a [server
2696
+ * integration](/docs/server/database#storageCreateBucket) API or directly
2697
+ * from your Appwrite console.
2698
+ *
2699
+ * Larger files should be uploaded using multiple requests with the
2700
+ * [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
2701
+ * header to send a partial request with a maximum supported chunk of `5MB`.
2702
+ * The `content-range` header values should always be in bytes.
2703
+ *
2704
+ * When the first request is sent, the server will return the **File** object,
2705
+ * and the subsequent part request must include the file's **id** in
2706
+ * `x-appwrite-id` header to allow the server to know that the partial upload
2707
+ * is for the existing file and not for a new one.
2708
+ *
2709
+ * If you're creating a new file using one of the Appwrite SDKs, all the
2710
+ * chunking logic will be managed by the SDK internally.
2711
+ *
2442
2712
  *
2713
+ * @param {string} bucketId
2443
2714
  * @param {string} fileId
2444
- * @param {File} file
2715
+ * @param {string} file
2445
2716
  * @param {string[]} read
2446
2717
  * @param {string[]} write
2447
2718
  * @throws {AppwriteException}
2448
2719
  * @returns {Promise}
2449
2720
  */
2450
- createFile(fileId: string, file: File, read?: string[], write?: string[]): Promise<Models.File>;
2721
+ createFile(bucketId: string, fileId: string, file: string, read?: string[], write?: string[]): Promise<Models.File>;
2451
2722
  /**
2452
2723
  * Get File
2453
2724
  *
2454
2725
  * Get a file by its unique ID. This endpoint response returns a JSON object
2455
2726
  * with the file metadata.
2456
2727
  *
2728
+ * @param {string} bucketId
2457
2729
  * @param {string} fileId
2458
2730
  * @throws {AppwriteException}
2459
2731
  * @returns {Promise}
2460
2732
  */
2461
- getFile(fileId: string): Promise<Models.File>;
2733
+ getFile(bucketId: string, fileId: string): Promise<Models.File>;
2462
2734
  /**
2463
2735
  * Update File
2464
2736
  *
2465
2737
  * Update a file by its unique ID. Only users with write permissions have
2466
2738
  * access to update this resource.
2467
2739
  *
2740
+ * @param {string} bucketId
2468
2741
  * @param {string} fileId
2469
2742
  * @param {string[]} read
2470
2743
  * @param {string[]} write
2471
2744
  * @throws {AppwriteException}
2472
2745
  * @returns {Promise}
2473
2746
  */
2474
- updateFile(fileId: string, read: string[], write: string[]): Promise<Models.File>;
2747
+ updateFile(bucketId: string, fileId: string, read?: string[], write?: string[]): Promise<Models.File>;
2475
2748
  /**
2476
2749
  * Delete File
2477
2750
  *
2478
2751
  * Delete a file by its unique ID. Only users with write permissions have
2479
2752
  * access to delete this resource.
2480
2753
  *
2754
+ * @param {string} bucketId
2481
2755
  * @param {string} fileId
2482
2756
  * @throws {AppwriteException}
2483
2757
  * @returns {Promise}
2484
2758
  */
2485
- deleteFile(fileId: string): Promise<Response>;
2759
+ deleteFile(bucketId: string, fileId: string): Promise<Response>;
2486
2760
  /**
2487
2761
  * Get File for Download
2488
2762
  *
@@ -2490,19 +2764,22 @@ declare module "node-appwrite" {
2490
2764
  * 'Content-Disposition: attachment' header that tells the browser to start
2491
2765
  * downloading the file to user downloads directory.
2492
2766
  *
2767
+ * @param {string} bucketId
2493
2768
  * @param {string} fileId
2494
2769
  * @throws {AppwriteException}
2495
2770
  * @returns {Promise}
2496
2771
  */
2497
- getFileDownload(fileId: string): Promise<Buffer>;
2772
+ getFileDownload(bucketId: string, fileId: string): Promise<Buffer>;
2498
2773
  /**
2499
2774
  * Get File Preview
2500
2775
  *
2501
2776
  * Get a file preview image. Currently, this method supports preview for image
2502
2777
  * files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
2503
2778
  * and spreadsheets, will return the file icon image. You can also pass query
2504
- * string arguments for cutting and resizing your preview image.
2779
+ * string arguments for cutting and resizing your preview image. Preview is
2780
+ * supported only for image files smaller than 10MB.
2505
2781
  *
2782
+ * @param {string} bucketId
2506
2783
  * @param {string} fileId
2507
2784
  * @param {number} width
2508
2785
  * @param {number} height
@@ -2518,7 +2795,7 @@ declare module "node-appwrite" {
2518
2795
  * @throws {AppwriteException}
2519
2796
  * @returns {Promise}
2520
2797
  */
2521
- getFilePreview(fileId: string, width?: number, height?: number, gravity?: string, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: string): Promise<Buffer>;
2798
+ getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: string, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: string): Promise<Buffer>;
2522
2799
  /**
2523
2800
  * Get File for View
2524
2801
  *
@@ -2526,11 +2803,12 @@ declare module "node-appwrite" {
2526
2803
  * download method but returns with no 'Content-Disposition: attachment'
2527
2804
  * header.
2528
2805
  *
2806
+ * @param {string} bucketId
2529
2807
  * @param {string} fileId
2530
2808
  * @throws {AppwriteException}
2531
2809
  * @returns {Promise}
2532
2810
  */
2533
- getFileView(fileId: string): Promise<Buffer>;
2811
+ getFileView(bucketId: string, fileId: string): Promise<Buffer>;
2534
2812
  }
2535
2813
  export class Teams extends Service {
2536
2814
  /**
@@ -2689,6 +2967,10 @@ declare module "node-appwrite" {
2689
2967
  * Use this endpoint to allow a user to accept an invitation to join a team
2690
2968
  * after being redirected back to your app from the invitation email received
2691
2969
  * by the user.
2970
+ *
2971
+ * If the request is successful, a session for the user is automatically
2972
+ * created.
2973
+ *
2692
2974
  *
2693
2975
  * @param {string} teamId
2694
2976
  * @param {string} membershipId
@@ -2742,7 +3024,11 @@ declare module "node-appwrite" {
2742
3024
  /**
2743
3025
  * Delete User
2744
3026
  *
2745
- * 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.
2746
3032
  *
2747
3033
  * @param {string} userId
2748
3034
  * @throws {AppwriteException}
@@ -2772,6 +3058,16 @@ declare module "node-appwrite" {
2772
3058
  * @returns {Promise}
2773
3059
  */
2774
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>;
2775
3071
  /**
2776
3072
  * Update Name
2777
3073
  *
@@ -2851,7 +3147,8 @@ declare module "node-appwrite" {
2851
3147
  /**
2852
3148
  * Update User Status
2853
3149
  *
2854
- * 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.
2855
3152
  *
2856
3153
  * @param {string} userId
2857
3154
  * @param {boolean} status