node-appwrite 4.0.2 → 5.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 (34) 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 +404 -146
  23. package/lib/client.js +7 -5
  24. package/lib/exception.js +2 -1
  25. package/lib/services/account.js +25 -1
  26. package/lib/services/avatars.js +3 -0
  27. package/lib/services/database.js +6 -3
  28. package/lib/services/functions.js +207 -116
  29. package/lib/services/health.js +3 -0
  30. package/lib/services/locale.js +3 -0
  31. package/lib/services/storage.js +379 -33
  32. package/lib/services/teams.js +7 -0
  33. package/lib/services/users.js +3 -0
  34. 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
@@ -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;
1088
1174
  /**
1089
- * The tag creation date in Unix timestamp.
1175
+ * Resource type.
1176
+ */
1177
+ resourceType: string;
1178
+ /**
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
@@ -1529,12 +1663,21 @@ declare module "node-appwrite" {
1529
1663
  * @returns {Promise}
1530
1664
  */
1531
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>;
1532
1674
  /**
1533
1675
  * Delete Account Session
1534
1676
  *
1535
1677
  * Use this endpoint to log out the currently logged in user from all their
1536
1678
  * account sessions across all of their different devices. When using the
1537
- * 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
+ *
1538
1681
  *
1539
1682
  * @param {string} sessionId
1540
1683
  * @throws {AppwriteException}
@@ -1823,14 +1966,14 @@ declare module "node-appwrite" {
1823
1966
  * @param {string} collectionId
1824
1967
  * @param {string} key
1825
1968
  * @param {boolean} required
1826
- * @param {string} min
1827
- * @param {string} max
1828
- * @param {string} default
1969
+ * @param {number} min
1970
+ * @param {number} max
1971
+ * @param {number} default
1829
1972
  * @param {boolean} array
1830
1973
  * @throws {AppwriteException}
1831
1974
  * @returns {Promise}
1832
1975
  */
1833
- 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>;
1834
1977
  /**
1835
1978
  * Create Integer Attribute
1836
1979
  *
@@ -2111,121 +2254,133 @@ declare module "node-appwrite" {
2111
2254
  */
2112
2255
  delete(functionId: string): Promise<Response>;
2113
2256
  /**
2114
- * List Executions
2257
+ * List Deployments
2115
2258
  *
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).
2259
+ * Get a list of all the project's code deployments. You can use the query
2260
+ * params to filter your results.
2120
2261
  *
2121
2262
  * @param {string} functionId
2263
+ * @param {string} search
2122
2264
  * @param {number} limit
2123
2265
  * @param {number} offset
2124
- * @param {string} search
2125
2266
  * @param {string} cursor
2126
2267
  * @param {string} cursorDirection
2268
+ * @param {string} orderType
2127
2269
  * @throws {AppwriteException}
2128
2270
  * @returns {Promise}
2129
2271
  */
2130
- 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>;
2131
2273
  /**
2132
- * Create Execution
2274
+ * Create Deployment
2133
2275
  *
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.
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.
2138
2286
  *
2139
2287
  * @param {string} functionId
2140
- * @param {string} data
2288
+ * @param {string} entrypoint
2289
+ * @param {string} code
2290
+ * @param {boolean} activate
2141
2291
  * @throws {AppwriteException}
2142
2292
  * @returns {Promise}
2143
2293
  */
2144
- createExecution(functionId: string, data?: string): Promise<Models.Execution>;
2294
+ createDeployment(functionId: string, entrypoint: string, code: string, activate: boolean): Promise<Models.Deployment>;
2145
2295
  /**
2146
- * Get Execution
2296
+ * Get Deployment
2147
2297
  *
2148
- * Get a function execution log by its unique ID.
2298
+ * Get a code deployment by its unique ID.
2149
2299
  *
2150
2300
  * @param {string} functionId
2151
- * @param {string} executionId
2301
+ * @param {string} deploymentId
2152
2302
  * @throws {AppwriteException}
2153
2303
  * @returns {Promise}
2154
2304
  */
2155
- getExecution(functionId: string, executionId: string): Promise<Models.Execution>;
2305
+ getDeployment(functionId: string, deploymentId: string): Promise<Models.DeploymentList>;
2156
2306
  /**
2157
- * Update Function Tag
2307
+ * Update Function Deployment
2158
2308
  *
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.
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.
2162
2312
  *
2163
2313
  * @param {string} functionId
2164
- * @param {string} tag
2314
+ * @param {string} deploymentId
2165
2315
  * @throws {AppwriteException}
2166
2316
  * @returns {Promise}
2167
2317
  */
2168
- updateTag(functionId: string, tag: string): Promise<Models.Function>;
2318
+ updateDeployment(functionId: string, deploymentId: string): Promise<Models.Function>;
2169
2319
  /**
2170
- * List Tags
2320
+ * Delete Deployment
2171
2321
  *
2172
- * Get a list of all the project's code tags. You can use the query params to
2173
- * filter your results.
2322
+ * Delete a code deployment by its unique ID.
2174
2323
  *
2175
2324
  * @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
2325
+ * @param {string} deploymentId
2182
2326
  * @throws {AppwriteException}
2183
2327
  * @returns {Promise}
2184
2328
  */
2185
- 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>;
2186
2330
  /**
2187
- * Create Tag
2331
+ * Retry Build
2188
2332
  *
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.
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).
2199
2347
  *
2200
2348
  * @param {string} functionId
2201
- * @param {string} command
2202
- * @param {File} code
2349
+ * @param {number} limit
2350
+ * @param {number} offset
2351
+ * @param {string} search
2352
+ * @param {string} cursor
2353
+ * @param {string} cursorDirection
2203
2354
  * @throws {AppwriteException}
2204
2355
  * @returns {Promise}
2205
2356
  */
2206
- 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>;
2207
2358
  /**
2208
- * Get Tag
2359
+ * Create Execution
2209
2360
  *
2210
- * 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.
2211
2365
  *
2212
2366
  * @param {string} functionId
2213
- * @param {string} tagId
2367
+ * @param {string} data
2368
+ * @param {boolean} async
2214
2369
  * @throws {AppwriteException}
2215
2370
  * @returns {Promise}
2216
2371
  */
2217
- getTag(functionId: string, tagId: string): Promise<Models.Tag>;
2372
+ createExecution(functionId: string, data?: string, async?: boolean): Promise<Models.Execution>;
2218
2373
  /**
2219
- * Delete Tag
2374
+ * Get Execution
2220
2375
  *
2221
- * Delete a code tag by its unique ID.
2376
+ * Get a function execution log by its unique ID.
2222
2377
  *
2223
2378
  * @param {string} functionId
2224
- * @param {string} tagId
2379
+ * @param {string} executionId
2225
2380
  * @throws {AppwriteException}
2226
2381
  * @returns {Promise}
2227
2382
  */
2228
- deleteTag(functionId: string, tagId: string): Promise<Response>;
2383
+ getExecution(functionId: string, executionId: string): Promise<Models.Execution>;
2229
2384
  }
2230
2385
  export class Health extends Service {
2231
2386
  /**
@@ -2416,6 +2571,81 @@ declare module "node-appwrite" {
2416
2571
  getLanguages(): Promise<Models.LanguageList>;
2417
2572
  }
2418
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>;
2419
2649
  /**
2420
2650
  * List Files
2421
2651
  *
@@ -2423,6 +2653,7 @@ declare module "node-appwrite" {
2423
2653
  * your results. On admin mode, this endpoint will return a list of all of the
2424
2654
  * project's files. [Learn more about different API modes](/docs/admin).
2425
2655
  *
2656
+ * @param {string} bucketId
2426
2657
  * @param {string} search
2427
2658
  * @param {number} limit
2428
2659
  * @param {number} offset
@@ -2432,57 +2663,76 @@ declare module "node-appwrite" {
2432
2663
  * @throws {AppwriteException}
2433
2664
  * @returns {Promise}
2434
2665
  */
2435
- 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>;
2436
2667
  /**
2437
2668
  * Create File
2438
2669
  *
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.
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
+ *
2442
2688
  *
2689
+ * @param {string} bucketId
2443
2690
  * @param {string} fileId
2444
- * @param {File} file
2691
+ * @param {string} file
2445
2692
  * @param {string[]} read
2446
2693
  * @param {string[]} write
2447
2694
  * @throws {AppwriteException}
2448
2695
  * @returns {Promise}
2449
2696
  */
2450
- 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>;
2451
2698
  /**
2452
2699
  * Get File
2453
2700
  *
2454
2701
  * Get a file by its unique ID. This endpoint response returns a JSON object
2455
2702
  * with the file metadata.
2456
2703
  *
2704
+ * @param {string} bucketId
2457
2705
  * @param {string} fileId
2458
2706
  * @throws {AppwriteException}
2459
2707
  * @returns {Promise}
2460
2708
  */
2461
- getFile(fileId: string): Promise<Models.File>;
2709
+ getFile(bucketId: string, fileId: string): Promise<Models.File>;
2462
2710
  /**
2463
2711
  * Update File
2464
2712
  *
2465
2713
  * Update a file by its unique ID. Only users with write permissions have
2466
2714
  * access to update this resource.
2467
2715
  *
2716
+ * @param {string} bucketId
2468
2717
  * @param {string} fileId
2469
2718
  * @param {string[]} read
2470
2719
  * @param {string[]} write
2471
2720
  * @throws {AppwriteException}
2472
2721
  * @returns {Promise}
2473
2722
  */
2474
- updateFile(fileId: string, read: string[], write: string[]): Promise<Models.File>;
2723
+ updateFile(bucketId: string, fileId: string, read?: string[], write?: string[]): Promise<Models.File>;
2475
2724
  /**
2476
2725
  * Delete File
2477
2726
  *
2478
2727
  * Delete a file by its unique ID. Only users with write permissions have
2479
2728
  * access to delete this resource.
2480
2729
  *
2730
+ * @param {string} bucketId
2481
2731
  * @param {string} fileId
2482
2732
  * @throws {AppwriteException}
2483
2733
  * @returns {Promise}
2484
2734
  */
2485
- deleteFile(fileId: string): Promise<Response>;
2735
+ deleteFile(bucketId: string, fileId: string): Promise<Response>;
2486
2736
  /**
2487
2737
  * Get File for Download
2488
2738
  *
@@ -2490,19 +2740,22 @@ declare module "node-appwrite" {
2490
2740
  * 'Content-Disposition: attachment' header that tells the browser to start
2491
2741
  * downloading the file to user downloads directory.
2492
2742
  *
2743
+ * @param {string} bucketId
2493
2744
  * @param {string} fileId
2494
2745
  * @throws {AppwriteException}
2495
2746
  * @returns {Promise}
2496
2747
  */
2497
- getFileDownload(fileId: string): Promise<Buffer>;
2748
+ getFileDownload(bucketId: string, fileId: string): Promise<Buffer>;
2498
2749
  /**
2499
2750
  * Get File Preview
2500
2751
  *
2501
2752
  * Get a file preview image. Currently, this method supports preview for image
2502
2753
  * files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
2503
2754
  * and spreadsheets, will return the file icon image. You can also pass query
2504
- * 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.
2505
2757
  *
2758
+ * @param {string} bucketId
2506
2759
  * @param {string} fileId
2507
2760
  * @param {number} width
2508
2761
  * @param {number} height
@@ -2518,7 +2771,7 @@ declare module "node-appwrite" {
2518
2771
  * @throws {AppwriteException}
2519
2772
  * @returns {Promise}
2520
2773
  */
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>;
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>;
2522
2775
  /**
2523
2776
  * Get File for View
2524
2777
  *
@@ -2526,11 +2779,12 @@ declare module "node-appwrite" {
2526
2779
  * download method but returns with no 'Content-Disposition: attachment'
2527
2780
  * header.
2528
2781
  *
2782
+ * @param {string} bucketId
2529
2783
  * @param {string} fileId
2530
2784
  * @throws {AppwriteException}
2531
2785
  * @returns {Promise}
2532
2786
  */
2533
- getFileView(fileId: string): Promise<Buffer>;
2787
+ getFileView(bucketId: string, fileId: string): Promise<Buffer>;
2534
2788
  }
2535
2789
  export class Teams extends Service {
2536
2790
  /**
@@ -2689,6 +2943,10 @@ declare module "node-appwrite" {
2689
2943
  * Use this endpoint to allow a user to accept an invitation to join a team
2690
2944
  * after being redirected back to your app from the invitation email received
2691
2945
  * by the user.
2946
+ *
2947
+ * If the request is successful, a session for the user is automatically
2948
+ * created.
2949
+ *
2692
2950
  *
2693
2951
  * @param {string} teamId
2694
2952
  * @param {string} membershipId