node-appwrite 4.0.1 → 5.1.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 (35) hide show
  1. package/README.md +2 -2
  2. package/docs/examples/account/update-session.md +20 -0
  3. package/docs/examples/functions/{create-tag.md → create-deployment.md} +1 -1
  4. package/docs/examples/functions/{delete-tag.md → delete-deployment.md} +1 -1
  5. package/docs/examples/functions/{update-tag.md → get-deployment.md} +1 -1
  6. package/docs/examples/functions/{list-tags.md → list-deployments.md} +1 -1
  7. package/docs/examples/functions/retry-build.md +20 -0
  8. package/docs/examples/functions/{get-tag.md → update-deployment.md} +1 -1
  9. package/docs/examples/storage/create-bucket.md +20 -0
  10. package/docs/examples/storage/create-file.md +1 -1
  11. package/docs/examples/storage/delete-bucket.md +20 -0
  12. package/docs/examples/storage/delete-file.md +1 -1
  13. package/docs/examples/storage/get-bucket.md +20 -0
  14. package/docs/examples/storage/get-file-download.md +1 -1
  15. package/docs/examples/storage/get-file-preview.md +1 -1
  16. package/docs/examples/storage/get-file-view.md +1 -1
  17. package/docs/examples/storage/get-file.md +1 -1
  18. package/docs/examples/storage/list-buckets.md +20 -0
  19. package/docs/examples/storage/list-files.md +1 -1
  20. package/docs/examples/storage/update-bucket.md +20 -0
  21. package/docs/examples/storage/update-file.md +1 -1
  22. package/index.d.ts +412 -152
  23. package/lib/client.js +7 -5
  24. package/lib/exception.js +2 -1
  25. package/lib/query.js +2 -0
  26. package/lib/services/account.js +28 -3
  27. package/lib/services/avatars.js +3 -0
  28. package/lib/services/database.js +6 -3
  29. package/lib/services/functions.js +212 -117
  30. package/lib/services/health.js +3 -0
  31. package/lib/services/locale.js +3 -0
  32. package/lib/services/storage.js +390 -33
  33. package/lib/services/teams.js +7 -0
  34. package/lib/services/users.js +6 -2
  35. 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
  */
@@ -311,7 +324,7 @@ declare module "node-appwrite" {
311
324
  /**
312
325
  * Attribute size.
313
326
  */
314
- size: string;
327
+ size: number;
315
328
  /**
316
329
  * Default value for attribute when not provided. Cannot be set when attribute is required.
317
330
  */
@@ -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
@@ -990,7 +1076,7 @@ declare module "node-appwrite" {
990
1076
  /**
991
1077
  * Execution permissions.
992
1078
  */
993
- execute: string;
1079
+ execute: string[];
994
1080
  /**
995
1081
  * Function name.
996
1082
  */
@@ -1012,13 +1098,13 @@ declare module "node-appwrite" {
1012
1098
  */
1013
1099
  runtime: string;
1014
1100
  /**
1015
- * Function active tag ID.
1101
+ * Function&#039;s active deployment ID.
1016
1102
  */
1017
- tag: string;
1103
+ deployment: string;
1018
1104
  /**
1019
1105
  * Function environment variables.
1020
1106
  */
1021
- vars: string;
1107
+ vars: object;
1022
1108
  /**
1023
1109
  * Function trigger events.
1024
1110
  */
@@ -1074,29 +1160,53 @@ declare module "node-appwrite" {
1074
1160
  supports: string[];
1075
1161
  }
1076
1162
  /**
1077
- * Tag
1163
+ * Deployment
1078
1164
  */
1079
- export type Tag = {
1165
+ export type Deployment = {
1080
1166
  /**
1081
- * Tag ID.
1167
+ * Deployment ID.
1082
1168
  */
1083
1169
  $id: string;
1084
1170
  /**
1085
- * Function ID.
1171
+ * Resource ID.
1086
1172
  */
1087
- functionId: string;
1173
+ resourceId: string;
1174
+ /**
1175
+ * Resource type.
1176
+ */
1177
+ resourceType: string;
1088
1178
  /**
1089
- * The tag creation date in Unix timestamp.
1179
+ * The deployment creation date in Unix timestamp.
1090
1180
  */
1091
1181
  dateCreated: number;
1092
1182
  /**
1093
- * The entrypoint command in use to execute the tag code.
1183
+ * The entrypoint file to use to execute the deployment code.
1094
1184
  */
1095
- command: string;
1185
+ entrypoint: string;
1096
1186
  /**
1097
1187
  * The code size in bytes.
1098
1188
  */
1099
- size: string;
1189
+ size: number;
1190
+ /**
1191
+ * The current build ID.
1192
+ */
1193
+ buildId: string;
1194
+ /**
1195
+ * Whether the deployment should be automatically activated.
1196
+ */
1197
+ activate: boolean;
1198
+ /**
1199
+ * The deployment status.
1200
+ */
1201
+ status: string;
1202
+ /**
1203
+ * The build stdout.
1204
+ */
1205
+ buildStdout: string;
1206
+ /**
1207
+ * The build stderr.
1208
+ */
1209
+ buildStderr: string;
1100
1210
  }
1101
1211
  /**
1102
1212
  * Execution
@@ -1127,9 +1237,9 @@ declare module "node-appwrite" {
1127
1237
  */
1128
1238
  status: string;
1129
1239
  /**
1130
- * The script exit code.
1240
+ * The script status code.
1131
1241
  */
1132
- exitCode: number;
1242
+ statusCode: number;
1133
1243
  /**
1134
1244
  * The script stdout output string. Logs the last 4,000 characters of the execution stdout output.
1135
1245
  */
@@ -1362,6 +1472,30 @@ declare module "node-appwrite" {
1362
1472
  constructor(client: Client);
1363
1473
  }
1364
1474
 
1475
+ type QueryTypesSingle = string | number | boolean;
1476
+ type QueryTypesList = string[] | number[] | boolean[];
1477
+ type QueryTypes = QueryTypesSingle | QueryTypesList;
1478
+
1479
+ export class Query {
1480
+ static equal(attribute: string, value: QueryTypes): string;
1481
+
1482
+ static notEqual(attribute: string, value: QueryTypes): string;
1483
+
1484
+ static lesser(attribute: string, value: QueryTypes): string;
1485
+
1486
+ static lesserEqual(attribute: string, value: QueryTypes): string;
1487
+
1488
+ static greater(attribute: string, value: QueryTypes): string;
1489
+
1490
+ static greaterEqual(attribute: string, value: QueryTypes): string;
1491
+
1492
+ static search(attribute: string, value: string): string;
1493
+
1494
+ private static addQuery(attribute: string, oper: string, value: QueryTypes): string;
1495
+
1496
+ private static parseValues(value: QueryTypes): string;
1497
+ }
1498
+
1365
1499
  export class Account extends Service {
1366
1500
  /**
1367
1501
  * Get Account
@@ -1450,8 +1584,9 @@ declare module "node-appwrite" {
1450
1584
  /**
1451
1585
  * Update Account Preferences
1452
1586
  *
1453
- * Update currently logged in user account preferences. You can pass only the
1454
- * specific settings you wish to update.
1587
+ * Update currently logged in user account preferences. The object you pass is
1588
+ * stored as is, and replaces any previous value. The maximum allowed prefs
1589
+ * size is 64kB and throws error if exceeded.
1455
1590
  *
1456
1591
  * @param {object} prefs
1457
1592
  * @throws {AppwriteException}
@@ -1528,12 +1663,21 @@ declare module "node-appwrite" {
1528
1663
  * @returns {Promise}
1529
1664
  */
1530
1665
  getSession(sessionId: string): Promise<Models.Session>;
1666
+ /**
1667
+ * Update Session (Refresh Tokens)
1668
+ *
1669
+ * @param {string} sessionId
1670
+ * @throws {AppwriteException}
1671
+ * @returns {Promise}
1672
+ */
1673
+ updateSession(sessionId: string): Promise<Models.Session>;
1531
1674
  /**
1532
1675
  * Delete Account Session
1533
1676
  *
1534
1677
  * Use this endpoint to log out the currently logged in user from all their
1535
1678
  * account sessions across all of their different devices. When using the
1536
- * option id argument, only the session unique ID provider will be deleted.
1679
+ * Session ID argument, only the unique session ID provided is deleted.
1680
+ *
1537
1681
  *
1538
1682
  * @param {string} sessionId
1539
1683
  * @throws {AppwriteException}
@@ -1822,14 +1966,14 @@ declare module "node-appwrite" {
1822
1966
  * @param {string} collectionId
1823
1967
  * @param {string} key
1824
1968
  * @param {boolean} required
1825
- * @param {string} min
1826
- * @param {string} max
1827
- * @param {string} default
1969
+ * @param {number} min
1970
+ * @param {number} max
1971
+ * @param {number} default
1828
1972
  * @param {boolean} array
1829
1973
  * @throws {AppwriteException}
1830
1974
  * @returns {Promise}
1831
1975
  */
1832
- createFloatAttribute(collectionId: string, key: string, required: boolean, min?: string, max?: string, xdefault?: string, array?: boolean): Promise<Models.AttributeFloat>;
1976
+ createFloatAttribute(collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat>;
1833
1977
  /**
1834
1978
  * Create Integer Attribute
1835
1979
  *
@@ -2067,7 +2211,7 @@ declare module "node-appwrite" {
2067
2211
  /**
2068
2212
  * List the currently active function runtimes.
2069
2213
  *
2070
- * Get a list of all runtimes that are currently active in your project.
2214
+ * Get a list of all runtimes that are currently active on your instance.
2071
2215
  *
2072
2216
  * @throws {AppwriteException}
2073
2217
  * @returns {Promise}
@@ -2110,121 +2254,133 @@ declare module "node-appwrite" {
2110
2254
  */
2111
2255
  delete(functionId: string): Promise<Response>;
2112
2256
  /**
2113
- * List Executions
2257
+ * List Deployments
2114
2258
  *
2115
- * Get a list of all the current user function execution logs. You can use the
2116
- * query params to filter your results. On admin mode, this endpoint will
2117
- * return a list of all of the project's executions. [Learn more about
2118
- * different API modes](/docs/admin).
2259
+ * Get a list of all the project's code deployments. You can use the query
2260
+ * params to filter your results.
2119
2261
  *
2120
2262
  * @param {string} functionId
2263
+ * @param {string} search
2121
2264
  * @param {number} limit
2122
2265
  * @param {number} offset
2123
- * @param {string} search
2124
2266
  * @param {string} cursor
2125
2267
  * @param {string} cursorDirection
2268
+ * @param {string} orderType
2126
2269
  * @throws {AppwriteException}
2127
2270
  * @returns {Promise}
2128
2271
  */
2129
- listExecutions(functionId: string, limit?: number, offset?: number, search?: string, cursor?: string, cursorDirection?: string): Promise<Models.ExecutionList>;
2272
+ listDeployments(functionId: string, search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.DeploymentList>;
2130
2273
  /**
2131
- * Create Execution
2274
+ * Create Deployment
2132
2275
  *
2133
- * Trigger a function execution. The returned object will return you the
2134
- * current execution status. You can ping the `Get Execution` endpoint to get
2135
- * updates on the current execution status. Once this endpoint is called, your
2136
- * function execution process will start asynchronously.
2276
+ * Create a new function code deployment. Use this endpoint to upload a new
2277
+ * version of your code function. To execute your newly uploaded code, you'll
2278
+ * need to update the function's deployment to use your new deployment UID.
2279
+ *
2280
+ * This endpoint accepts a tar.gz file compressed with your code. Make sure to
2281
+ * include any dependencies your code has within the compressed file. You can
2282
+ * learn more about code packaging in the [Appwrite Cloud Functions
2283
+ * tutorial](/docs/functions).
2284
+ *
2285
+ * Use the "command" param to set the entry point used to execute your code.
2137
2286
  *
2138
2287
  * @param {string} functionId
2139
- * @param {string} data
2288
+ * @param {string} entrypoint
2289
+ * @param {string} code
2290
+ * @param {boolean} activate
2140
2291
  * @throws {AppwriteException}
2141
2292
  * @returns {Promise}
2142
2293
  */
2143
- createExecution(functionId: string, data?: string): Promise<Models.Execution>;
2294
+ createDeployment(functionId: string, entrypoint: string, code: string, activate: boolean): Promise<Models.Deployment>;
2144
2295
  /**
2145
- * Get Execution
2296
+ * Get Deployment
2146
2297
  *
2147
- * Get a function execution log by its unique ID.
2298
+ * Get a code deployment by its unique ID.
2148
2299
  *
2149
2300
  * @param {string} functionId
2150
- * @param {string} executionId
2301
+ * @param {string} deploymentId
2151
2302
  * @throws {AppwriteException}
2152
2303
  * @returns {Promise}
2153
2304
  */
2154
- getExecution(functionId: string, executionId: string): Promise<Models.Execution>;
2305
+ getDeployment(functionId: string, deploymentId: string): Promise<Models.DeploymentList>;
2155
2306
  /**
2156
- * Update Function Tag
2307
+ * Update Function Deployment
2157
2308
  *
2158
- * Update the function code tag ID using the unique function ID. Use this
2159
- * endpoint to switch the code tag that should be executed by the execution
2160
- * endpoint.
2309
+ * Update the function code deployment ID using the unique function ID. Use
2310
+ * this endpoint to switch the code deployment that should be executed by the
2311
+ * execution endpoint.
2161
2312
  *
2162
2313
  * @param {string} functionId
2163
- * @param {string} tag
2314
+ * @param {string} deploymentId
2164
2315
  * @throws {AppwriteException}
2165
2316
  * @returns {Promise}
2166
2317
  */
2167
- updateTag(functionId: string, tag: string): Promise<Models.Function>;
2318
+ updateDeployment(functionId: string, deploymentId: string): Promise<Models.Function>;
2168
2319
  /**
2169
- * List Tags
2320
+ * Delete Deployment
2170
2321
  *
2171
- * Get a list of all the project's code tags. You can use the query params to
2172
- * filter your results.
2322
+ * Delete a code deployment by its unique ID.
2173
2323
  *
2174
2324
  * @param {string} functionId
2175
- * @param {string} search
2176
- * @param {number} limit
2177
- * @param {number} offset
2178
- * @param {string} cursor
2179
- * @param {string} cursorDirection
2180
- * @param {string} orderType
2325
+ * @param {string} deploymentId
2181
2326
  * @throws {AppwriteException}
2182
2327
  * @returns {Promise}
2183
2328
  */
2184
- listTags(functionId: string, search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.TagList>;
2329
+ deleteDeployment(functionId: string, deploymentId: string): Promise<Response>;
2185
2330
  /**
2186
- * Create Tag
2331
+ * Retry Build
2187
2332
  *
2188
- * Create a new function code tag. Use this endpoint to upload a new version
2189
- * of your code function. To execute your newly uploaded code, you'll need to
2190
- * update the function's tag to use your new tag UID.
2191
- *
2192
- * This endpoint accepts a tar.gz file compressed with your code. Make sure to
2193
- * include any dependencies your code has within the compressed file. You can
2194
- * learn more about code packaging in the [Appwrite Cloud Functions
2195
- * tutorial](/docs/functions).
2196
- *
2197
- * Use the "command" param to set the entry point used to execute your code.
2333
+ * @param {string} functionId
2334
+ * @param {string} deploymentId
2335
+ * @param {string} buildId
2336
+ * @throws {AppwriteException}
2337
+ * @returns {Promise}
2338
+ */
2339
+ retryBuild(functionId: string, deploymentId: string, buildId: string): Promise<Response>;
2340
+ /**
2341
+ * List Executions
2342
+ *
2343
+ * Get a list of all the current user function execution logs. You can use the
2344
+ * query params to filter your results. On admin mode, this endpoint will
2345
+ * return a list of all of the project's executions. [Learn more about
2346
+ * different API modes](/docs/admin).
2198
2347
  *
2199
2348
  * @param {string} functionId
2200
- * @param {string} command
2201
- * @param {File} code
2349
+ * @param {number} limit
2350
+ * @param {number} offset
2351
+ * @param {string} search
2352
+ * @param {string} cursor
2353
+ * @param {string} cursorDirection
2202
2354
  * @throws {AppwriteException}
2203
2355
  * @returns {Promise}
2204
2356
  */
2205
- createTag(functionId: string, command: string, code: File): Promise<Models.Tag>;
2357
+ listExecutions(functionId: string, limit?: number, offset?: number, search?: string, cursor?: string, cursorDirection?: string): Promise<Models.ExecutionList>;
2206
2358
  /**
2207
- * Get Tag
2359
+ * Create Execution
2208
2360
  *
2209
- * Get a code tag by its unique ID.
2361
+ * Trigger a function execution. The returned object will return you the
2362
+ * current execution status. You can ping the `Get Execution` endpoint to get
2363
+ * updates on the current execution status. Once this endpoint is called, your
2364
+ * function execution process will start asynchronously.
2210
2365
  *
2211
2366
  * @param {string} functionId
2212
- * @param {string} tagId
2367
+ * @param {string} data
2368
+ * @param {boolean} async
2213
2369
  * @throws {AppwriteException}
2214
2370
  * @returns {Promise}
2215
2371
  */
2216
- getTag(functionId: string, tagId: string): Promise<Models.Tag>;
2372
+ createExecution(functionId: string, data?: string, async?: boolean): Promise<Models.Execution>;
2217
2373
  /**
2218
- * Delete Tag
2374
+ * Get Execution
2219
2375
  *
2220
- * Delete a code tag by its unique ID.
2376
+ * Get a function execution log by its unique ID.
2221
2377
  *
2222
2378
  * @param {string} functionId
2223
- * @param {string} tagId
2379
+ * @param {string} executionId
2224
2380
  * @throws {AppwriteException}
2225
2381
  * @returns {Promise}
2226
2382
  */
2227
- deleteTag(functionId: string, tagId: string): Promise<Response>;
2383
+ getExecution(functionId: string, executionId: string): Promise<Models.Execution>;
2228
2384
  }
2229
2385
  export class Health extends Service {
2230
2386
  /**
@@ -2415,6 +2571,81 @@ declare module "node-appwrite" {
2415
2571
  getLanguages(): Promise<Models.LanguageList>;
2416
2572
  }
2417
2573
  export class Storage extends Service {
2574
+ /**
2575
+ * List buckets
2576
+ *
2577
+ * Get a list of all the storage buckets. You can use the query params to
2578
+ * filter your results.
2579
+ *
2580
+ * @param {string} search
2581
+ * @param {number} limit
2582
+ * @param {number} offset
2583
+ * @param {string} cursor
2584
+ * @param {string} cursorDirection
2585
+ * @param {string} orderType
2586
+ * @throws {AppwriteException}
2587
+ * @returns {Promise}
2588
+ */
2589
+ listBuckets(search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.BucketList>;
2590
+ /**
2591
+ * Create bucket
2592
+ *
2593
+ * Create a new storage bucket.
2594
+ *
2595
+ * @param {string} bucketId
2596
+ * @param {string} name
2597
+ * @param {string} permission
2598
+ * @param {string[]} read
2599
+ * @param {string[]} write
2600
+ * @param {boolean} enabled
2601
+ * @param {number} maximumFileSize
2602
+ * @param {string[]} allowedFileExtensions
2603
+ * @param {boolean} encryption
2604
+ * @param {boolean} antivirus
2605
+ * @throws {AppwriteException}
2606
+ * @returns {Promise}
2607
+ */
2608
+ createBucket(bucketId: string, name: string, permission: string, read?: string[], write?: string[], enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], encryption?: boolean, antivirus?: boolean): Promise<Models.Bucket>;
2609
+ /**
2610
+ * Get Bucket
2611
+ *
2612
+ * Get a storage bucket by its unique ID. This endpoint response returns a
2613
+ * JSON object with the storage bucket metadata.
2614
+ *
2615
+ * @param {string} bucketId
2616
+ * @throws {AppwriteException}
2617
+ * @returns {Promise}
2618
+ */
2619
+ getBucket(bucketId: string): Promise<Models.Bucket>;
2620
+ /**
2621
+ * Update Bucket
2622
+ *
2623
+ * Update a storage bucket by its unique ID.
2624
+ *
2625
+ * @param {string} bucketId
2626
+ * @param {string} name
2627
+ * @param {string} permission
2628
+ * @param {string[]} read
2629
+ * @param {string[]} write
2630
+ * @param {boolean} enabled
2631
+ * @param {number} maximumFileSize
2632
+ * @param {string[]} allowedFileExtensions
2633
+ * @param {boolean} encryption
2634
+ * @param {boolean} antivirus
2635
+ * @throws {AppwriteException}
2636
+ * @returns {Promise}
2637
+ */
2638
+ updateBucket(bucketId: string, name: string, permission: string, read?: string[], write?: string[], enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], encryption?: boolean, antivirus?: boolean): Promise<Models.Bucket>;
2639
+ /**
2640
+ * Delete Bucket
2641
+ *
2642
+ * Delete a storage bucket by its unique ID.
2643
+ *
2644
+ * @param {string} bucketId
2645
+ * @throws {AppwriteException}
2646
+ * @returns {Promise}
2647
+ */
2648
+ deleteBucket(bucketId: string): Promise<Response>;
2418
2649
  /**
2419
2650
  * List Files
2420
2651
  *
@@ -2422,6 +2653,7 @@ declare module "node-appwrite" {
2422
2653
  * your results. On admin mode, this endpoint will return a list of all of the
2423
2654
  * project's files. [Learn more about different API modes](/docs/admin).
2424
2655
  *
2656
+ * @param {string} bucketId
2425
2657
  * @param {string} search
2426
2658
  * @param {number} limit
2427
2659
  * @param {number} offset
@@ -2431,57 +2663,76 @@ declare module "node-appwrite" {
2431
2663
  * @throws {AppwriteException}
2432
2664
  * @returns {Promise}
2433
2665
  */
2434
- listFiles(search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.FileList>;
2666
+ listFiles(bucketId: string, search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.FileList>;
2435
2667
  /**
2436
2668
  * Create File
2437
2669
  *
2438
- * Create a new file. The user who creates the file will automatically be
2439
- * assigned to read and write access unless he has passed custom values for
2440
- * read and write arguments.
2670
+ * Create a new file. Before using this route, you should create a new bucket
2671
+ * resource using either a [server
2672
+ * integration](/docs/server/database#storageCreateBucket) API or directly
2673
+ * from your Appwrite console.
2674
+ *
2675
+ * Larger files should be uploaded using multiple requests with the
2676
+ * [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
2677
+ * header to send a partial request with a maximum supported chunk of `5MB`.
2678
+ * The `content-range` header values should always be in bytes.
2679
+ *
2680
+ * When the first request is sent, the server will return the **File** object,
2681
+ * and the subsequent part request must include the file's **id** in
2682
+ * `x-appwrite-id` header to allow the server to know that the partial upload
2683
+ * is for the existing file and not for a new one.
2684
+ *
2685
+ * If you're creating a new file using one of the Appwrite SDKs, all the
2686
+ * chunking logic will be managed by the SDK internally.
2687
+ *
2441
2688
  *
2689
+ * @param {string} bucketId
2442
2690
  * @param {string} fileId
2443
- * @param {File} file
2691
+ * @param {string} file
2444
2692
  * @param {string[]} read
2445
2693
  * @param {string[]} write
2446
2694
  * @throws {AppwriteException}
2447
2695
  * @returns {Promise}
2448
2696
  */
2449
- createFile(fileId: string, file: File, read?: string[], write?: string[]): Promise<Models.File>;
2697
+ createFile(bucketId: string, fileId: string, file: string, read?: string[], write?: string[]): Promise<Models.File>;
2450
2698
  /**
2451
2699
  * Get File
2452
2700
  *
2453
2701
  * Get a file by its unique ID. This endpoint response returns a JSON object
2454
2702
  * with the file metadata.
2455
2703
  *
2704
+ * @param {string} bucketId
2456
2705
  * @param {string} fileId
2457
2706
  * @throws {AppwriteException}
2458
2707
  * @returns {Promise}
2459
2708
  */
2460
- getFile(fileId: string): Promise<Models.File>;
2709
+ getFile(bucketId: string, fileId: string): Promise<Models.File>;
2461
2710
  /**
2462
2711
  * Update File
2463
2712
  *
2464
2713
  * Update a file by its unique ID. Only users with write permissions have
2465
2714
  * access to update this resource.
2466
2715
  *
2716
+ * @param {string} bucketId
2467
2717
  * @param {string} fileId
2468
2718
  * @param {string[]} read
2469
2719
  * @param {string[]} write
2470
2720
  * @throws {AppwriteException}
2471
2721
  * @returns {Promise}
2472
2722
  */
2473
- updateFile(fileId: string, read: string[], write: string[]): Promise<Models.File>;
2723
+ updateFile(bucketId: string, fileId: string, read?: string[], write?: string[]): Promise<Models.File>;
2474
2724
  /**
2475
2725
  * Delete File
2476
2726
  *
2477
2727
  * Delete a file by its unique ID. Only users with write permissions have
2478
2728
  * access to delete this resource.
2479
2729
  *
2730
+ * @param {string} bucketId
2480
2731
  * @param {string} fileId
2481
2732
  * @throws {AppwriteException}
2482
2733
  * @returns {Promise}
2483
2734
  */
2484
- deleteFile(fileId: string): Promise<Response>;
2735
+ deleteFile(bucketId: string, fileId: string): Promise<Response>;
2485
2736
  /**
2486
2737
  * Get File for Download
2487
2738
  *
@@ -2489,19 +2740,22 @@ declare module "node-appwrite" {
2489
2740
  * 'Content-Disposition: attachment' header that tells the browser to start
2490
2741
  * downloading the file to user downloads directory.
2491
2742
  *
2743
+ * @param {string} bucketId
2492
2744
  * @param {string} fileId
2493
2745
  * @throws {AppwriteException}
2494
2746
  * @returns {Promise}
2495
2747
  */
2496
- getFileDownload(fileId: string): Promise<Buffer>;
2748
+ getFileDownload(bucketId: string, fileId: string): Promise<Buffer>;
2497
2749
  /**
2498
2750
  * Get File Preview
2499
2751
  *
2500
2752
  * Get a file preview image. Currently, this method supports preview for image
2501
2753
  * files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
2502
2754
  * and spreadsheets, will return the file icon image. You can also pass query
2503
- * string arguments for cutting and resizing your preview image.
2755
+ * string arguments for cutting and resizing your preview image. Preview is
2756
+ * supported only for image files smaller than 10MB.
2504
2757
  *
2758
+ * @param {string} bucketId
2505
2759
  * @param {string} fileId
2506
2760
  * @param {number} width
2507
2761
  * @param {number} height
@@ -2517,7 +2771,7 @@ declare module "node-appwrite" {
2517
2771
  * @throws {AppwriteException}
2518
2772
  * @returns {Promise}
2519
2773
  */
2520
- 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>;
2774
+ 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>;
2521
2775
  /**
2522
2776
  * Get File for View
2523
2777
  *
@@ -2525,11 +2779,12 @@ declare module "node-appwrite" {
2525
2779
  * download method but returns with no 'Content-Disposition: attachment'
2526
2780
  * header.
2527
2781
  *
2782
+ * @param {string} bucketId
2528
2783
  * @param {string} fileId
2529
2784
  * @throws {AppwriteException}
2530
2785
  * @returns {Promise}
2531
2786
  */
2532
- getFileView(fileId: string): Promise<Buffer>;
2787
+ getFileView(bucketId: string, fileId: string): Promise<Buffer>;
2533
2788
  }
2534
2789
  export class Teams extends Service {
2535
2790
  /**
@@ -2688,6 +2943,10 @@ declare module "node-appwrite" {
2688
2943
  * Use this endpoint to allow a user to accept an invitation to join a team
2689
2944
  * after being redirected back to your app from the invitation email received
2690
2945
  * by the user.
2946
+ *
2947
+ * If the request is successful, a session for the user is automatically
2948
+ * created.
2949
+ *
2691
2950
  *
2692
2951
  * @param {string} teamId
2693
2952
  * @param {string} membershipId
@@ -2806,8 +3065,9 @@ declare module "node-appwrite" {
2806
3065
  /**
2807
3066
  * Update User Preferences
2808
3067
  *
2809
- * Update the user preferences by its unique ID. You can pass only the
2810
- * specific settings you wish to update.
3068
+ * Update the user preferences by its unique ID. The object you pass is stored
3069
+ * as is, and replaces any previous value. The maximum allowed prefs size is
3070
+ * 64kB and throws error if exceeded.
2811
3071
  *
2812
3072
  * @param {string} userId
2813
3073
  * @param {object} prefs