appwrite-cli 0.16.0 → 0.18.1

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 (90) hide show
  1. package/README.md +4 -16
  2. package/docs/examples/account/{create-session.md → create-email-session.md} +1 -1
  3. package/docs/examples/account/create-phone-session.md +3 -0
  4. package/docs/examples/account/create-phone-verification.md +1 -0
  5. package/docs/examples/account/update-phone-session.md +3 -0
  6. package/docs/examples/account/update-phone-verification.md +3 -0
  7. package/docs/examples/account/update-phone.md +3 -0
  8. package/docs/examples/account/update-status.md +1 -0
  9. package/docs/examples/{database → databases}/create-boolean-attribute.md +2 -1
  10. package/docs/examples/{database → databases}/create-collection.md +2 -1
  11. package/docs/examples/{database → databases}/create-document.md +2 -1
  12. package/docs/examples/{database → databases}/create-email-attribute.md +2 -1
  13. package/docs/examples/{database → databases}/create-enum-attribute.md +2 -1
  14. package/docs/examples/{database → databases}/create-float-attribute.md +2 -1
  15. package/docs/examples/{database → databases}/create-index.md +2 -1
  16. package/docs/examples/{database → databases}/create-integer-attribute.md +2 -1
  17. package/docs/examples/{database → databases}/create-ip-attribute.md +2 -1
  18. package/docs/examples/{database → databases}/create-string-attribute.md +2 -1
  19. package/docs/examples/{database → databases}/create-url-attribute.md +2 -1
  20. package/docs/examples/databases/create.md +3 -0
  21. package/docs/examples/databases/delete-attribute.md +4 -0
  22. package/docs/examples/databases/delete-collection.md +3 -0
  23. package/docs/examples/{database → databases}/delete-document.md +2 -1
  24. package/docs/examples/databases/delete-index.md +4 -0
  25. package/docs/examples/databases/delete.md +2 -0
  26. package/docs/examples/databases/get-attribute.md +4 -0
  27. package/docs/examples/databases/get-collection-usage.md +4 -0
  28. package/docs/examples/databases/get-collection.md +3 -0
  29. package/docs/examples/databases/get-database-usage.md +3 -0
  30. package/docs/examples/{database → databases}/get-document.md +2 -1
  31. package/docs/examples/databases/get-index.md +4 -0
  32. package/docs/examples/databases/get-usage.md +2 -0
  33. package/docs/examples/databases/get.md +2 -0
  34. package/docs/examples/databases/list-attributes.md +3 -0
  35. package/docs/examples/databases/list-collection-logs.md +5 -0
  36. package/docs/examples/databases/list-collections.md +8 -0
  37. package/docs/examples/{database → databases}/list-document-logs.md +2 -1
  38. package/docs/examples/databases/list-documents.md +10 -0
  39. package/docs/examples/databases/list-indexes.md +3 -0
  40. package/docs/examples/databases/list-logs.md +4 -0
  41. package/docs/examples/databases/list.md +7 -0
  42. package/docs/examples/{database → databases}/update-collection.md +2 -1
  43. package/docs/examples/{database → databases}/update-document.md +3 -2
  44. package/docs/examples/databases/update.md +3 -0
  45. package/docs/examples/projects/create-key.md +2 -1
  46. package/docs/examples/projects/update-key.md +2 -1
  47. package/docs/examples/projects/update-webhook-signature.md +3 -0
  48. package/docs/examples/teams/list-logs.md +4 -0
  49. package/docs/examples/users/get-memberships.md +2 -0
  50. package/docs/examples/users/{update-verification.md → update-email-verification.md} +1 -1
  51. package/docs/examples/users/update-phone-verification.md +3 -0
  52. package/docs/examples/users/update-phone.md +3 -0
  53. package/index.js +2 -2
  54. package/install.ps1 +9 -5
  55. package/install.sh +1 -1
  56. package/lib/client.js +6 -7
  57. package/lib/commands/account.js +230 -56
  58. package/lib/commands/avatars.js +12 -9
  59. package/lib/commands/{database.js → databases.js} +484 -181
  60. package/lib/commands/deploy.js +156 -73
  61. package/lib/commands/functions.js +26 -9
  62. package/lib/commands/generic.js +13 -6
  63. package/lib/commands/health.js +3 -23
  64. package/lib/commands/init.js +43 -24
  65. package/lib/commands/locale.js +3 -0
  66. package/lib/commands/projects.js +50 -8
  67. package/lib/commands/storage.js +8 -5
  68. package/lib/commands/teams.js +45 -5
  69. package/lib/commands/users.js +101 -7
  70. package/lib/config.js +6 -4
  71. package/lib/parser.js +1 -1
  72. package/lib/questions.js +87 -4
  73. package/lib/sdks.js +17 -1
  74. package/lib/utils.js +19 -0
  75. package/package.json +8 -6
  76. package/docs/examples/account/delete.md +0 -1
  77. package/docs/examples/database/delete-attribute.md +0 -3
  78. package/docs/examples/database/delete-collection.md +0 -2
  79. package/docs/examples/database/delete-index.md +0 -3
  80. package/docs/examples/database/get-attribute.md +0 -3
  81. package/docs/examples/database/get-collection-usage.md +0 -3
  82. package/docs/examples/database/get-collection.md +0 -2
  83. package/docs/examples/database/get-index.md +0 -3
  84. package/docs/examples/database/get-usage.md +0 -2
  85. package/docs/examples/database/list-attributes.md +0 -2
  86. package/docs/examples/database/list-collection-logs.md +0 -4
  87. package/docs/examples/database/list-collections.md +0 -7
  88. package/docs/examples/database/list-documents.md +0 -9
  89. package/docs/examples/database/list-indexes.md +0 -2
  90. package/docs/examples/health/get-queue-usage.md +0 -1
@@ -1,15 +1,18 @@
1
1
  const fs = require('fs');
2
+ const pathLib = require('path');
2
3
  const tar = require("tar");
4
+ const ignore = require("ignore");
3
5
  const { promisify } = require('util');
4
6
  const libClient = require('../client.js');
7
+ const { getAllFiles } = require('../utils.js');
5
8
  const { Command } = require('commander');
6
9
  const { sdkForProject, sdkForConsole } = require('../sdks')
7
10
  const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
8
11
  const { localConfig, globalConfig } = require("../config");
9
12
 
10
- const database = new Command("database").description(commandDescriptions['database'])
13
+ const databases = new Command("databases").description(commandDescriptions['databases'])
11
14
 
12
- const databaseListCollections = async ({ search, limit, offset, cursor, cursorDirection, orderType, parseOutput = true, sdk = undefined}) => {
15
+ const databasesList = async ({ search, limit, offset, cursor, cursorDirection, orderType, parseOutput = true, sdk = undefined}) => {
13
16
  /* @param {string} search */
14
17
  /* @param {number} limit */
15
18
  /* @param {number} offset */
@@ -18,7 +21,7 @@ const databaseListCollections = async ({ search, limit, offset, cursor, cursorDi
18
21
  /* @param {string} orderType */
19
22
 
20
23
  let client = !sdk ? await sdkForProject() : sdk;
21
- let path = '/database/collections';
24
+ let path = '/databases';
22
25
  let payload = {};
23
26
 
24
27
  /** Query Params */
@@ -52,7 +55,165 @@ const databaseListCollections = async ({ search, limit, offset, cursor, cursorDi
52
55
  return response;
53
56
  }
54
57
 
55
- const databaseCreateCollection = async ({ collectionId, name, permission, read, write, parseOutput = true, sdk = undefined}) => {
58
+ const databasesCreate = async ({ databaseId, name, parseOutput = true, sdk = undefined}) => {
59
+ /* @param {string} databaseId */
60
+ /* @param {string} name */
61
+
62
+ let client = !sdk ? await sdkForProject() : sdk;
63
+ let path = '/databases';
64
+ let payload = {};
65
+
66
+ /** Body Params */
67
+ if (typeof databaseId !== 'undefined') {
68
+ payload['databaseId'] = databaseId;
69
+ }
70
+
71
+ if (typeof name !== 'undefined') {
72
+ payload['name'] = name;
73
+ }
74
+
75
+ let response = undefined;
76
+ response = await client.call('post', path, {
77
+ 'content-type': 'application/json',
78
+ }, payload);
79
+
80
+ if (parseOutput) {
81
+ parse(response)
82
+ success()
83
+ }
84
+ return response;
85
+ }
86
+
87
+ const databasesGetUsage = async ({ range, parseOutput = true, sdk = undefined}) => {
88
+ /* @param {string} range */
89
+
90
+ let client = !sdk ? await sdkForProject() : sdk;
91
+ let path = '/databases/usage';
92
+ let payload = {};
93
+
94
+ /** Query Params */
95
+ if (typeof range !== 'undefined') {
96
+ payload['range'] = range;
97
+ }
98
+ let response = undefined;
99
+ response = await client.call('get', path, {
100
+ 'content-type': 'application/json',
101
+ }, payload);
102
+
103
+ if (parseOutput) {
104
+ parse(response)
105
+ success()
106
+ }
107
+ return response;
108
+ }
109
+
110
+ const databasesGet = async ({ databaseId, parseOutput = true, sdk = undefined}) => {
111
+ /* @param {string} databaseId */
112
+
113
+ let client = !sdk ? await sdkForProject() : sdk;
114
+ let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
115
+ let payload = {};
116
+ let response = undefined;
117
+ response = await client.call('get', path, {
118
+ 'content-type': 'application/json',
119
+ }, payload);
120
+
121
+ if (parseOutput) {
122
+ parse(response)
123
+ success()
124
+ }
125
+ return response;
126
+ }
127
+
128
+ const databasesUpdate = async ({ databaseId, name, parseOutput = true, sdk = undefined}) => {
129
+ /* @param {string} databaseId */
130
+ /* @param {string} name */
131
+
132
+ let client = !sdk ? await sdkForProject() : sdk;
133
+ let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
134
+ let payload = {};
135
+
136
+ /** Body Params */
137
+ if (typeof name !== 'undefined') {
138
+ payload['name'] = name;
139
+ }
140
+
141
+ let response = undefined;
142
+ response = await client.call('put', path, {
143
+ 'content-type': 'application/json',
144
+ }, payload);
145
+
146
+ if (parseOutput) {
147
+ parse(response)
148
+ success()
149
+ }
150
+ return response;
151
+ }
152
+
153
+ const databasesDelete = async ({ databaseId, parseOutput = true, sdk = undefined}) => {
154
+ /* @param {string} databaseId */
155
+
156
+ let client = !sdk ? await sdkForProject() : sdk;
157
+ let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
158
+ let payload = {};
159
+ let response = undefined;
160
+ response = await client.call('delete', path, {
161
+ 'content-type': 'application/json',
162
+ }, payload);
163
+
164
+ if (parseOutput) {
165
+ parse(response)
166
+ success()
167
+ }
168
+ return response;
169
+ }
170
+
171
+ const databasesListCollections = async ({ databaseId, search, limit, offset, cursor, cursorDirection, orderType, parseOutput = true, sdk = undefined}) => {
172
+ /* @param {string} databaseId */
173
+ /* @param {string} search */
174
+ /* @param {number} limit */
175
+ /* @param {number} offset */
176
+ /* @param {string} cursor */
177
+ /* @param {string} cursorDirection */
178
+ /* @param {string} orderType */
179
+
180
+ let client = !sdk ? await sdkForProject() : sdk;
181
+ let path = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
182
+ let payload = {};
183
+
184
+ /** Query Params */
185
+ if (typeof search !== 'undefined') {
186
+ payload['search'] = search;
187
+ }
188
+ if (typeof limit !== 'undefined') {
189
+ payload['limit'] = limit;
190
+ }
191
+ if (typeof offset !== 'undefined') {
192
+ payload['offset'] = offset;
193
+ }
194
+ if (typeof cursor !== 'undefined') {
195
+ payload['cursor'] = cursor;
196
+ }
197
+ if (typeof cursorDirection !== 'undefined') {
198
+ payload['cursorDirection'] = cursorDirection;
199
+ }
200
+ if (typeof orderType !== 'undefined') {
201
+ payload['orderType'] = orderType;
202
+ }
203
+ let response = undefined;
204
+ response = await client.call('get', path, {
205
+ 'content-type': 'application/json',
206
+ }, payload);
207
+
208
+ if (parseOutput) {
209
+ parse(response)
210
+ success()
211
+ }
212
+ return response;
213
+ }
214
+
215
+ const databasesCreateCollection = async ({ databaseId, collectionId, name, permission, read, write, parseOutput = true, sdk = undefined}) => {
216
+ /* @param {string} databaseId */
56
217
  /* @param {string} collectionId */
57
218
  /* @param {string} name */
58
219
  /* @param {string} permission */
@@ -60,7 +221,7 @@ const databaseCreateCollection = async ({ collectionId, name, permission, read,
60
221
  /* @param {string[]} write */
61
222
 
62
223
  let client = !sdk ? await sdkForProject() : sdk;
63
- let path = '/database/collections';
224
+ let path = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
64
225
  let payload = {};
65
226
 
66
227
  /** Body Params */
@@ -96,11 +257,12 @@ const databaseCreateCollection = async ({ collectionId, name, permission, read,
96
257
  return response;
97
258
  }
98
259
 
99
- const databaseGetCollection = async ({ collectionId, parseOutput = true, sdk = undefined}) => {
260
+ const databasesGetCollection = async ({ databaseId, collectionId, parseOutput = true, sdk = undefined}) => {
261
+ /* @param {string} databaseId */
100
262
  /* @param {string} collectionId */
101
263
 
102
264
  let client = !sdk ? await sdkForProject() : sdk;
103
- let path = '/database/collections/{collectionId}'.replace('{collectionId}', collectionId);
265
+ let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
104
266
  let payload = {};
105
267
  let response = undefined;
106
268
  response = await client.call('get', path, {
@@ -114,7 +276,8 @@ const databaseGetCollection = async ({ collectionId, parseOutput = true, sdk = u
114
276
  return response;
115
277
  }
116
278
 
117
- const databaseUpdateCollection = async ({ collectionId, name, permission, read, write, enabled, parseOutput = true, sdk = undefined}) => {
279
+ const databasesUpdateCollection = async ({ databaseId, collectionId, name, permission, read, write, enabled, parseOutput = true, sdk = undefined}) => {
280
+ /* @param {string} databaseId */
118
281
  /* @param {string} collectionId */
119
282
  /* @param {string} name */
120
283
  /* @param {string} permission */
@@ -123,7 +286,7 @@ const databaseUpdateCollection = async ({ collectionId, name, permission, read,
123
286
  /* @param {boolean} enabled */
124
287
 
125
288
  let client = !sdk ? await sdkForProject() : sdk;
126
- let path = '/database/collections/{collectionId}'.replace('{collectionId}', collectionId);
289
+ let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
127
290
  let payload = {};
128
291
 
129
292
  /** Body Params */
@@ -159,11 +322,12 @@ const databaseUpdateCollection = async ({ collectionId, name, permission, read,
159
322
  return response;
160
323
  }
161
324
 
162
- const databaseDeleteCollection = async ({ collectionId, parseOutput = true, sdk = undefined}) => {
325
+ const databasesDeleteCollection = async ({ databaseId, collectionId, parseOutput = true, sdk = undefined}) => {
326
+ /* @param {string} databaseId */
163
327
  /* @param {string} collectionId */
164
328
 
165
329
  let client = !sdk ? await sdkForProject() : sdk;
166
- let path = '/database/collections/{collectionId}'.replace('{collectionId}', collectionId);
330
+ let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
167
331
  let payload = {};
168
332
  let response = undefined;
169
333
  response = await client.call('delete', path, {
@@ -177,11 +341,12 @@ const databaseDeleteCollection = async ({ collectionId, parseOutput = true, sdk
177
341
  return response;
178
342
  }
179
343
 
180
- const databaseListAttributes = async ({ collectionId, parseOutput = true, sdk = undefined}) => {
344
+ const databasesListAttributes = async ({ databaseId, collectionId, parseOutput = true, sdk = undefined}) => {
345
+ /* @param {string} databaseId */
181
346
  /* @param {string} collectionId */
182
347
 
183
348
  let client = !sdk ? await sdkForProject() : sdk;
184
- let path = '/database/collections/{collectionId}/attributes'.replace('{collectionId}', collectionId);
349
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
185
350
  let payload = {};
186
351
  let response = undefined;
187
352
  response = await client.call('get', path, {
@@ -195,7 +360,8 @@ const databaseListAttributes = async ({ collectionId, parseOutput = true, sdk =
195
360
  return response;
196
361
  }
197
362
 
198
- const databaseCreateBooleanAttribute = async ({ collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
363
+ const databasesCreateBooleanAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
364
+ /* @param {string} databaseId */
199
365
  /* @param {string} collectionId */
200
366
  /* @param {string} key */
201
367
  /* @param {boolean} required */
@@ -203,7 +369,7 @@ const databaseCreateBooleanAttribute = async ({ collectionId, key, required, xde
203
369
  /* @param {boolean} array */
204
370
 
205
371
  let client = !sdk ? await sdkForProject() : sdk;
206
- let path = '/database/collections/{collectionId}/attributes/boolean'.replace('{collectionId}', collectionId);
372
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
207
373
  let payload = {};
208
374
 
209
375
  /** Body Params */
@@ -235,7 +401,8 @@ const databaseCreateBooleanAttribute = async ({ collectionId, key, required, xde
235
401
  return response;
236
402
  }
237
403
 
238
- const databaseCreateEmailAttribute = async ({ collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
404
+ const databasesCreateEmailAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
405
+ /* @param {string} databaseId */
239
406
  /* @param {string} collectionId */
240
407
  /* @param {string} key */
241
408
  /* @param {boolean} required */
@@ -243,7 +410,7 @@ const databaseCreateEmailAttribute = async ({ collectionId, key, required, xdefa
243
410
  /* @param {boolean} array */
244
411
 
245
412
  let client = !sdk ? await sdkForProject() : sdk;
246
- let path = '/database/collections/{collectionId}/attributes/email'.replace('{collectionId}', collectionId);
413
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
247
414
  let payload = {};
248
415
 
249
416
  /** Body Params */
@@ -275,7 +442,8 @@ const databaseCreateEmailAttribute = async ({ collectionId, key, required, xdefa
275
442
  return response;
276
443
  }
277
444
 
278
- const databaseCreateEnumAttribute = async ({ collectionId, key, elements, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
445
+ const databasesCreateEnumAttribute = async ({ databaseId, collectionId, key, elements, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
446
+ /* @param {string} databaseId */
279
447
  /* @param {string} collectionId */
280
448
  /* @param {string} key */
281
449
  /* @param {string[]} elements */
@@ -284,7 +452,7 @@ const databaseCreateEnumAttribute = async ({ collectionId, key, elements, requir
284
452
  /* @param {boolean} array */
285
453
 
286
454
  let client = !sdk ? await sdkForProject() : sdk;
287
- let path = '/database/collections/{collectionId}/attributes/enum'.replace('{collectionId}', collectionId);
455
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
288
456
  let payload = {};
289
457
 
290
458
  /** Body Params */
@@ -320,7 +488,8 @@ const databaseCreateEnumAttribute = async ({ collectionId, key, elements, requir
320
488
  return response;
321
489
  }
322
490
 
323
- const databaseCreateFloatAttribute = async ({ collectionId, key, required, min, max, xdefault, array, parseOutput = true, sdk = undefined}) => {
491
+ const databasesCreateFloatAttribute = async ({ databaseId, collectionId, key, required, min, max, xdefault, array, parseOutput = true, sdk = undefined}) => {
492
+ /* @param {string} databaseId */
324
493
  /* @param {string} collectionId */
325
494
  /* @param {string} key */
326
495
  /* @param {boolean} required */
@@ -330,7 +499,7 @@ const databaseCreateFloatAttribute = async ({ collectionId, key, required, min,
330
499
  /* @param {boolean} array */
331
500
 
332
501
  let client = !sdk ? await sdkForProject() : sdk;
333
- let path = '/database/collections/{collectionId}/attributes/float'.replace('{collectionId}', collectionId);
502
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
334
503
  let payload = {};
335
504
 
336
505
  /** Body Params */
@@ -370,7 +539,8 @@ const databaseCreateFloatAttribute = async ({ collectionId, key, required, min,
370
539
  return response;
371
540
  }
372
541
 
373
- const databaseCreateIntegerAttribute = async ({ collectionId, key, required, min, max, xdefault, array, parseOutput = true, sdk = undefined}) => {
542
+ const databasesCreateIntegerAttribute = async ({ databaseId, collectionId, key, required, min, max, xdefault, array, parseOutput = true, sdk = undefined}) => {
543
+ /* @param {string} databaseId */
374
544
  /* @param {string} collectionId */
375
545
  /* @param {string} key */
376
546
  /* @param {boolean} required */
@@ -380,7 +550,7 @@ const databaseCreateIntegerAttribute = async ({ collectionId, key, required, min
380
550
  /* @param {boolean} array */
381
551
 
382
552
  let client = !sdk ? await sdkForProject() : sdk;
383
- let path = '/database/collections/{collectionId}/attributes/integer'.replace('{collectionId}', collectionId);
553
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
384
554
  let payload = {};
385
555
 
386
556
  /** Body Params */
@@ -420,7 +590,8 @@ const databaseCreateIntegerAttribute = async ({ collectionId, key, required, min
420
590
  return response;
421
591
  }
422
592
 
423
- const databaseCreateIpAttribute = async ({ collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
593
+ const databasesCreateIpAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
594
+ /* @param {string} databaseId */
424
595
  /* @param {string} collectionId */
425
596
  /* @param {string} key */
426
597
  /* @param {boolean} required */
@@ -428,7 +599,7 @@ const databaseCreateIpAttribute = async ({ collectionId, key, required, xdefault
428
599
  /* @param {boolean} array */
429
600
 
430
601
  let client = !sdk ? await sdkForProject() : sdk;
431
- let path = '/database/collections/{collectionId}/attributes/ip'.replace('{collectionId}', collectionId);
602
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
432
603
  let payload = {};
433
604
 
434
605
  /** Body Params */
@@ -460,7 +631,8 @@ const databaseCreateIpAttribute = async ({ collectionId, key, required, xdefault
460
631
  return response;
461
632
  }
462
633
 
463
- const databaseCreateStringAttribute = async ({ collectionId, key, size, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
634
+ const databasesCreateStringAttribute = async ({ databaseId, collectionId, key, size, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
635
+ /* @param {string} databaseId */
464
636
  /* @param {string} collectionId */
465
637
  /* @param {string} key */
466
638
  /* @param {number} size */
@@ -469,7 +641,7 @@ const databaseCreateStringAttribute = async ({ collectionId, key, size, required
469
641
  /* @param {boolean} array */
470
642
 
471
643
  let client = !sdk ? await sdkForProject() : sdk;
472
- let path = '/database/collections/{collectionId}/attributes/string'.replace('{collectionId}', collectionId);
644
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
473
645
  let payload = {};
474
646
 
475
647
  /** Body Params */
@@ -505,7 +677,8 @@ const databaseCreateStringAttribute = async ({ collectionId, key, size, required
505
677
  return response;
506
678
  }
507
679
 
508
- const databaseCreateUrlAttribute = async ({ collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
680
+ const databasesCreateUrlAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
681
+ /* @param {string} databaseId */
509
682
  /* @param {string} collectionId */
510
683
  /* @param {string} key */
511
684
  /* @param {boolean} required */
@@ -513,7 +686,7 @@ const databaseCreateUrlAttribute = async ({ collectionId, key, required, xdefaul
513
686
  /* @param {boolean} array */
514
687
 
515
688
  let client = !sdk ? await sdkForProject() : sdk;
516
- let path = '/database/collections/{collectionId}/attributes/url'.replace('{collectionId}', collectionId);
689
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
517
690
  let payload = {};
518
691
 
519
692
  /** Body Params */
@@ -545,12 +718,13 @@ const databaseCreateUrlAttribute = async ({ collectionId, key, required, xdefaul
545
718
  return response;
546
719
  }
547
720
 
548
- const databaseGetAttribute = async ({ collectionId, key, parseOutput = true, sdk = undefined}) => {
721
+ const databasesGetAttribute = async ({ databaseId, collectionId, key, parseOutput = true, sdk = undefined}) => {
722
+ /* @param {string} databaseId */
549
723
  /* @param {string} collectionId */
550
724
  /* @param {string} key */
551
725
 
552
726
  let client = !sdk ? await sdkForProject() : sdk;
553
- let path = '/database/collections/{collectionId}/attributes/{key}'.replace('{collectionId}', collectionId).replace('{key}', key);
727
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
554
728
  let payload = {};
555
729
  let response = undefined;
556
730
  response = await client.call('get', path, {
@@ -564,12 +738,13 @@ const databaseGetAttribute = async ({ collectionId, key, parseOutput = true, sdk
564
738
  return response;
565
739
  }
566
740
 
567
- const databaseDeleteAttribute = async ({ collectionId, key, parseOutput = true, sdk = undefined}) => {
741
+ const databasesDeleteAttribute = async ({ databaseId, collectionId, key, parseOutput = true, sdk = undefined}) => {
742
+ /* @param {string} databaseId */
568
743
  /* @param {string} collectionId */
569
744
  /* @param {string} key */
570
745
 
571
746
  let client = !sdk ? await sdkForProject() : sdk;
572
- let path = '/database/collections/{collectionId}/attributes/{key}'.replace('{collectionId}', collectionId).replace('{key}', key);
747
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
573
748
  let payload = {};
574
749
  let response = undefined;
575
750
  response = await client.call('delete', path, {
@@ -583,7 +758,8 @@ const databaseDeleteAttribute = async ({ collectionId, key, parseOutput = true,
583
758
  return response;
584
759
  }
585
760
 
586
- const databaseListDocuments = async ({ collectionId, queries, limit, offset, cursor, cursorDirection, orderAttributes, orderTypes, parseOutput = true, sdk = undefined}) => {
761
+ const databasesListDocuments = async ({ databaseId, collectionId, queries, limit, offset, cursor, cursorDirection, orderAttributes, orderTypes, parseOutput = true, sdk = undefined}) => {
762
+ /* @param {string} databaseId */
587
763
  /* @param {string} collectionId */
588
764
  /* @param {string[]} queries */
589
765
  /* @param {number} limit */
@@ -594,7 +770,7 @@ const databaseListDocuments = async ({ collectionId, queries, limit, offset, cur
594
770
  /* @param {string[]} orderTypes */
595
771
 
596
772
  let client = !sdk ? await sdkForProject() : sdk;
597
- let path = '/database/collections/{collectionId}/documents'.replace('{collectionId}', collectionId);
773
+ let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
598
774
  let payload = {};
599
775
 
600
776
  /** Query Params */
@@ -631,7 +807,8 @@ const databaseListDocuments = async ({ collectionId, queries, limit, offset, cur
631
807
  return response;
632
808
  }
633
809
 
634
- const databaseCreateDocument = async ({ collectionId, documentId, data, read, write, parseOutput = true, sdk = undefined}) => {
810
+ const databasesCreateDocument = async ({ databaseId, collectionId, documentId, data, read, write, parseOutput = true, sdk = undefined}) => {
811
+ /* @param {string} databaseId */
635
812
  /* @param {string} collectionId */
636
813
  /* @param {string} documentId */
637
814
  /* @param {object} data */
@@ -639,7 +816,7 @@ const databaseCreateDocument = async ({ collectionId, documentId, data, read, wr
639
816
  /* @param {string[]} write */
640
817
 
641
818
  let client = !sdk ? await sdkForProject() : sdk;
642
- let path = '/database/collections/{collectionId}/documents'.replace('{collectionId}', collectionId);
819
+ let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
643
820
  let payload = {};
644
821
 
645
822
  /** Body Params */
@@ -671,12 +848,13 @@ const databaseCreateDocument = async ({ collectionId, documentId, data, read, wr
671
848
  return response;
672
849
  }
673
850
 
674
- const databaseGetDocument = async ({ collectionId, documentId, parseOutput = true, sdk = undefined}) => {
851
+ const databasesGetDocument = async ({ databaseId, collectionId, documentId, parseOutput = true, sdk = undefined}) => {
852
+ /* @param {string} databaseId */
675
853
  /* @param {string} collectionId */
676
854
  /* @param {string} documentId */
677
855
 
678
856
  let client = !sdk ? await sdkForProject() : sdk;
679
- let path = '/database/collections/{collectionId}/documents/{documentId}'.replace('{collectionId}', collectionId).replace('{documentId}', documentId);
857
+ let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
680
858
  let payload = {};
681
859
  let response = undefined;
682
860
  response = await client.call('get', path, {
@@ -690,7 +868,8 @@ const databaseGetDocument = async ({ collectionId, documentId, parseOutput = tru
690
868
  return response;
691
869
  }
692
870
 
693
- const databaseUpdateDocument = async ({ collectionId, documentId, data, read, write, parseOutput = true, sdk = undefined}) => {
871
+ const databasesUpdateDocument = async ({ databaseId, collectionId, documentId, data, read, write, parseOutput = true, sdk = undefined}) => {
872
+ /* @param {string} databaseId */
694
873
  /* @param {string} collectionId */
695
874
  /* @param {string} documentId */
696
875
  /* @param {object} data */
@@ -698,7 +877,7 @@ const databaseUpdateDocument = async ({ collectionId, documentId, data, read, wr
698
877
  /* @param {string[]} write */
699
878
 
700
879
  let client = !sdk ? await sdkForProject() : sdk;
701
- let path = '/database/collections/{collectionId}/documents/{documentId}'.replace('{collectionId}', collectionId).replace('{documentId}', documentId);
880
+ let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
702
881
  let payload = {};
703
882
 
704
883
  /** Body Params */
@@ -726,12 +905,13 @@ const databaseUpdateDocument = async ({ collectionId, documentId, data, read, wr
726
905
  return response;
727
906
  }
728
907
 
729
- const databaseDeleteDocument = async ({ collectionId, documentId, parseOutput = true, sdk = undefined}) => {
908
+ const databasesDeleteDocument = async ({ databaseId, collectionId, documentId, parseOutput = true, sdk = undefined}) => {
909
+ /* @param {string} databaseId */
730
910
  /* @param {string} collectionId */
731
911
  /* @param {string} documentId */
732
912
 
733
913
  let client = !sdk ? await sdkForProject() : sdk;
734
- let path = '/database/collections/{collectionId}/documents/{documentId}'.replace('{collectionId}', collectionId).replace('{documentId}', documentId);
914
+ let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
735
915
  let payload = {};
736
916
  let response = undefined;
737
917
  response = await client.call('delete', path, {
@@ -745,14 +925,15 @@ const databaseDeleteDocument = async ({ collectionId, documentId, parseOutput =
745
925
  return response;
746
926
  }
747
927
 
748
- const databaseListDocumentLogs = async ({ collectionId, documentId, limit, offset, parseOutput = true, sdk = undefined}) => {
928
+ const databasesListDocumentLogs = async ({ databaseId, collectionId, documentId, limit, offset, parseOutput = true, sdk = undefined}) => {
929
+ /* @param {string} databaseId */
749
930
  /* @param {string} collectionId */
750
931
  /* @param {string} documentId */
751
932
  /* @param {number} limit */
752
933
  /* @param {number} offset */
753
934
 
754
935
  let client = !sdk ? await sdkForProject() : sdk;
755
- let path = '/database/collections/{collectionId}/documents/{documentId}/logs'.replace('{collectionId}', collectionId).replace('{documentId}', documentId);
936
+ let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
756
937
  let payload = {};
757
938
 
758
939
  /** Query Params */
@@ -774,11 +955,12 @@ const databaseListDocumentLogs = async ({ collectionId, documentId, limit, offse
774
955
  return response;
775
956
  }
776
957
 
777
- const databaseListIndexes = async ({ collectionId, parseOutput = true, sdk = undefined}) => {
958
+ const databasesListIndexes = async ({ databaseId, collectionId, parseOutput = true, sdk = undefined}) => {
959
+ /* @param {string} databaseId */
778
960
  /* @param {string} collectionId */
779
961
 
780
962
  let client = !sdk ? await sdkForProject() : sdk;
781
- let path = '/database/collections/{collectionId}/indexes'.replace('{collectionId}', collectionId);
963
+ let path = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
782
964
  let payload = {};
783
965
  let response = undefined;
784
966
  response = await client.call('get', path, {
@@ -792,7 +974,8 @@ const databaseListIndexes = async ({ collectionId, parseOutput = true, sdk = und
792
974
  return response;
793
975
  }
794
976
 
795
- const databaseCreateIndex = async ({ collectionId, key, type, attributes, orders, parseOutput = true, sdk = undefined}) => {
977
+ const databasesCreateIndex = async ({ databaseId, collectionId, key, type, attributes, orders, parseOutput = true, sdk = undefined}) => {
978
+ /* @param {string} databaseId */
796
979
  /* @param {string} collectionId */
797
980
  /* @param {string} key */
798
981
  /* @param {string} type */
@@ -800,7 +983,7 @@ const databaseCreateIndex = async ({ collectionId, key, type, attributes, orders
800
983
  /* @param {string[]} orders */
801
984
 
802
985
  let client = !sdk ? await sdkForProject() : sdk;
803
- let path = '/database/collections/{collectionId}/indexes'.replace('{collectionId}', collectionId);
986
+ let path = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
804
987
  let payload = {};
805
988
 
806
989
  /** Body Params */
@@ -832,12 +1015,13 @@ const databaseCreateIndex = async ({ collectionId, key, type, attributes, orders
832
1015
  return response;
833
1016
  }
834
1017
 
835
- const databaseGetIndex = async ({ collectionId, key, parseOutput = true, sdk = undefined}) => {
1018
+ const databasesGetIndex = async ({ databaseId, collectionId, key, parseOutput = true, sdk = undefined}) => {
1019
+ /* @param {string} databaseId */
836
1020
  /* @param {string} collectionId */
837
1021
  /* @param {string} key */
838
1022
 
839
1023
  let client = !sdk ? await sdkForProject() : sdk;
840
- let path = '/database/collections/{collectionId}/indexes/{key}'.replace('{collectionId}', collectionId).replace('{key}', key);
1024
+ let path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
841
1025
  let payload = {};
842
1026
  let response = undefined;
843
1027
  response = await client.call('get', path, {
@@ -851,12 +1035,13 @@ const databaseGetIndex = async ({ collectionId, key, parseOutput = true, sdk = u
851
1035
  return response;
852
1036
  }
853
1037
 
854
- const databaseDeleteIndex = async ({ collectionId, key, parseOutput = true, sdk = undefined}) => {
1038
+ const databasesDeleteIndex = async ({ databaseId, collectionId, key, parseOutput = true, sdk = undefined}) => {
1039
+ /* @param {string} databaseId */
855
1040
  /* @param {string} collectionId */
856
1041
  /* @param {string} key */
857
1042
 
858
1043
  let client = !sdk ? await sdkForProject() : sdk;
859
- let path = '/database/collections/{collectionId}/indexes/{key}'.replace('{collectionId}', collectionId).replace('{key}', key);
1044
+ let path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
860
1045
  let payload = {};
861
1046
  let response = undefined;
862
1047
  response = await client.call('delete', path, {
@@ -870,13 +1055,14 @@ const databaseDeleteIndex = async ({ collectionId, key, parseOutput = true, sdk
870
1055
  return response;
871
1056
  }
872
1057
 
873
- const databaseListCollectionLogs = async ({ collectionId, limit, offset, parseOutput = true, sdk = undefined}) => {
1058
+ const databasesListCollectionLogs = async ({ databaseId, collectionId, limit, offset, parseOutput = true, sdk = undefined}) => {
1059
+ /* @param {string} databaseId */
874
1060
  /* @param {string} collectionId */
875
1061
  /* @param {number} limit */
876
1062
  /* @param {number} offset */
877
1063
 
878
1064
  let client = !sdk ? await sdkForProject() : sdk;
879
- let path = '/database/collections/{collectionId}/logs'.replace('{collectionId}', collectionId);
1065
+ let path = '/databases/{databaseId}/collections/{collectionId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
880
1066
  let payload = {};
881
1067
 
882
1068
  /** Query Params */
@@ -898,11 +1084,13 @@ const databaseListCollectionLogs = async ({ collectionId, limit, offset, parseOu
898
1084
  return response;
899
1085
  }
900
1086
 
901
- const databaseGetUsage = async ({ range, parseOutput = true, sdk = undefined}) => {
1087
+ const databasesGetCollectionUsage = async ({ databaseId, collectionId, range, parseOutput = true, sdk = undefined}) => {
1088
+ /* @param {string} databaseId */
1089
+ /* @param {string} collectionId */
902
1090
  /* @param {string} range */
903
1091
 
904
1092
  let client = !sdk ? await sdkForProject() : sdk;
905
- let path = '/database/usage';
1093
+ let path = '/databases/{databaseId}/collections/{collectionId}/usage'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
906
1094
  let payload = {};
907
1095
 
908
1096
  /** Query Params */
@@ -921,12 +1109,40 @@ const databaseGetUsage = async ({ range, parseOutput = true, sdk = undefined}) =
921
1109
  return response;
922
1110
  }
923
1111
 
924
- const databaseGetCollectionUsage = async ({ collectionId, range, parseOutput = true, sdk = undefined}) => {
925
- /* @param {string} collectionId */
1112
+ const databasesListLogs = async ({ databaseId, limit, offset, parseOutput = true, sdk = undefined}) => {
1113
+ /* @param {string} databaseId */
1114
+ /* @param {number} limit */
1115
+ /* @param {number} offset */
1116
+
1117
+ let client = !sdk ? await sdkForProject() : sdk;
1118
+ let path = '/databases/{databaseId}/logs'.replace('{databaseId}', databaseId);
1119
+ let payload = {};
1120
+
1121
+ /** Query Params */
1122
+ if (typeof limit !== 'undefined') {
1123
+ payload['limit'] = limit;
1124
+ }
1125
+ if (typeof offset !== 'undefined') {
1126
+ payload['offset'] = offset;
1127
+ }
1128
+ let response = undefined;
1129
+ response = await client.call('get', path, {
1130
+ 'content-type': 'application/json',
1131
+ }, payload);
1132
+
1133
+ if (parseOutput) {
1134
+ parse(response)
1135
+ success()
1136
+ }
1137
+ return response;
1138
+ }
1139
+
1140
+ const databasesGetDatabaseUsage = async ({ databaseId, range, parseOutput = true, sdk = undefined}) => {
1141
+ /* @param {string} databaseId */
926
1142
  /* @param {string} range */
927
1143
 
928
1144
  let client = !sdk ? await sdkForProject() : sdk;
929
- let path = '/database/{collectionId}/usage'.replace('{collectionId}', collectionId);
1145
+ let path = '/databases/{databaseId}/usage'.replace('{databaseId}', databaseId);
930
1146
  let payload = {};
931
1147
 
932
1148
  /** Query Params */
@@ -946,90 +1162,143 @@ const databaseGetCollectionUsage = async ({ collectionId, range, parseOutput = t
946
1162
  }
947
1163
 
948
1164
 
949
- database
1165
+ databases
1166
+ .command(`list`)
1167
+ .description(``)
1168
+ .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
1169
+ .option(`--limit <limit>`, `Maximum number of collection to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
1170
+ .option(`--offset <offset>`, `Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)`, parseInteger)
1171
+ .option(`--cursor <cursor>`, `ID of the collection used as the starting point for the query, excluding the collection itself. Should be used for efficient pagination when working with large sets of data.`)
1172
+ .option(`--cursorDirection <cursorDirection>`, `Direction of the cursor, can be either 'before' or 'after'.`)
1173
+ .option(`--orderType <orderType>`, `Order result by ASC or DESC order.`)
1174
+ .action(actionRunner(databasesList))
1175
+
1176
+ databases
1177
+ .command(`create`)
1178
+ .description(``)
1179
+ .requiredOption(`--databaseId <databaseId>`, `Unique Id. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
1180
+ .requiredOption(`--name <name>`, `Collection name. Max length: 128 chars.`)
1181
+ .action(actionRunner(databasesCreate))
1182
+
1183
+ databases
1184
+ .command(`getUsage`)
1185
+ .description(``)
1186
+ .option(`--range <range>`, `'Date range.`)
1187
+ .action(actionRunner(databasesGetUsage))
1188
+
1189
+ databases
1190
+ .command(`get`)
1191
+ .description(``)
1192
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1193
+ .action(actionRunner(databasesGet))
1194
+
1195
+ databases
1196
+ .command(`update`)
1197
+ .description(``)
1198
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1199
+ .requiredOption(`--name <name>`, `Collection name. Max length: 128 chars.`)
1200
+ .action(actionRunner(databasesUpdate))
1201
+
1202
+ databases
1203
+ .command(`delete`)
1204
+ .description(``)
1205
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1206
+ .action(actionRunner(databasesDelete))
1207
+
1208
+ databases
950
1209
  .command(`listCollections`)
951
- .description(`Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's collections. [Learn more about different API modes](/docs/admin).`)
1210
+ .description(``)
1211
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
952
1212
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
953
1213
  .option(`--limit <limit>`, `Maximum number of collection to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
954
1214
  .option(`--offset <offset>`, `Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)`, parseInteger)
955
1215
  .option(`--cursor <cursor>`, `ID of the collection used as the starting point for the query, excluding the collection itself. Should be used for efficient pagination when working with large sets of data.`)
956
- .option(`--cursorDirection <cursorDirection>`, `Direction of the cursor.`)
1216
+ .option(`--cursorDirection <cursorDirection>`, `Direction of the cursor, can be either 'before' or 'after'.`)
957
1217
  .option(`--orderType <orderType>`, `Order result by ASC or DESC order.`)
958
- .action(actionRunner(databaseListCollections))
1218
+ .action(actionRunner(databasesListCollections))
959
1219
 
960
- database
1220
+ databases
961
1221
  .command(`createCollection`)
962
- .description(`Create a new Collection.`)
1222
+ .description(``)
1223
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
963
1224
  .requiredOption(`--collectionId <collectionId>`, `Unique Id. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
964
1225
  .requiredOption(`--name <name>`, `Collection name. Max length: 128 chars.`)
965
- .requiredOption(`--permission <permission>`, `Permissions type model to use for reading documents in this collection. You can use collection-level permission set once on the collection using the 'read' and 'write' params, or you can set document-level permission where each document read and write params will decide who has access to read and write to each document individually. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
1226
+ .requiredOption(`--permission <permission>`, `Specifies the permissions model used in this collection, which accepts either 'collection' or 'document'. For 'collection' level permission, the permissions specified in read and write params are applied to all documents in the collection. For 'document' level permissions, read and write permissions are specified in each document. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
966
1227
  .requiredOption(`--read <read...>`, `An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
967
1228
  .requiredOption(`--write <write...>`, `An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
968
- .action(actionRunner(databaseCreateCollection))
1229
+ .action(actionRunner(databasesCreateCollection))
969
1230
 
970
- database
1231
+ databases
971
1232
  .command(`getCollection`)
972
- .description(`Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.`)
1233
+ .description(``)
1234
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
973
1235
  .requiredOption(`--collectionId <collectionId>`, `Collection ID.`)
974
- .action(actionRunner(databaseGetCollection))
1236
+ .action(actionRunner(databasesGetCollection))
975
1237
 
976
- database
1238
+ databases
977
1239
  .command(`updateCollection`)
978
- .description(`Update a collection by its unique ID.`)
1240
+ .description(``)
1241
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
979
1242
  .requiredOption(`--collectionId <collectionId>`, `Collection ID.`)
980
1243
  .requiredOption(`--name <name>`, `Collection name. Max length: 128 chars.`)
981
1244
  .requiredOption(`--permission <permission>`, `Permissions type model to use for reading documents in this collection. You can use collection-level permission set once on the collection using the 'read' and 'write' params, or you can set document-level permission where each document read and write params will decide who has access to read and write to each document individually. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
982
1245
  .option(`--read <read...>`, `An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
983
1246
  .option(`--write <write...>`, `An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
984
1247
  .option(`--enabled <enabled>`, `Is collection enabled?`, parseBool)
985
- .action(actionRunner(databaseUpdateCollection))
1248
+ .action(actionRunner(databasesUpdateCollection))
986
1249
 
987
- database
1250
+ databases
988
1251
  .command(`deleteCollection`)
989
- .description(`Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.`)
1252
+ .description(``)
1253
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
990
1254
  .requiredOption(`--collectionId <collectionId>`, `Collection ID.`)
991
- .action(actionRunner(databaseDeleteCollection))
1255
+ .action(actionRunner(databasesDeleteCollection))
992
1256
 
993
- database
1257
+ databases
994
1258
  .command(`listAttributes`)
995
1259
  .description(``)
1260
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
996
1261
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
997
- .action(actionRunner(databaseListAttributes))
1262
+ .action(actionRunner(databasesListAttributes))
998
1263
 
999
- database
1264
+ databases
1000
1265
  .command(`createBooleanAttribute`)
1001
- .description(`Create a boolean attribute. `)
1266
+ .description(``)
1267
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1002
1268
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1003
1269
  .requiredOption(`--key <key>`, `Attribute Key.`)
1004
1270
  .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1005
1271
  .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`, parseBool)
1006
1272
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1007
- .action(actionRunner(databaseCreateBooleanAttribute))
1273
+ .action(actionRunner(databasesCreateBooleanAttribute))
1008
1274
 
1009
- database
1275
+ databases
1010
1276
  .command(`createEmailAttribute`)
1011
- .description(`Create an email attribute. `)
1277
+ .description(``)
1278
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1012
1279
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1013
1280
  .requiredOption(`--key <key>`, `Attribute Key.`)
1014
1281
  .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1015
1282
  .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
1016
1283
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1017
- .action(actionRunner(databaseCreateEmailAttribute))
1284
+ .action(actionRunner(databasesCreateEmailAttribute))
1018
1285
 
1019
- database
1286
+ databases
1020
1287
  .command(`createEnumAttribute`)
1021
1288
  .description(``)
1289
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1022
1290
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1023
1291
  .requiredOption(`--key <key>`, `Attribute Key.`)
1024
- .requiredOption(`--elements <elements...>`, `Array of elements in enumerated type. Uses length of longest element to determine size.`)
1292
+ .requiredOption(`--elements <elements...>`, `Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 4096 characters long.`)
1025
1293
  .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1026
1294
  .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
1027
1295
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1028
- .action(actionRunner(databaseCreateEnumAttribute))
1296
+ .action(actionRunner(databasesCreateEnumAttribute))
1029
1297
 
1030
- database
1298
+ databases
1031
1299
  .command(`createFloatAttribute`)
1032
- .description(`Create a float attribute. Optionally, minimum and maximum values can be provided. `)
1300
+ .description(``)
1301
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1033
1302
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1034
1303
  .requiredOption(`--key <key>`, `Attribute Key.`)
1035
1304
  .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
@@ -1037,11 +1306,12 @@ database
1037
1306
  .option(`--max <max>`, `Maximum value to enforce on new documents`, parseInteger)
1038
1307
  .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`, parseInteger)
1039
1308
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1040
- .action(actionRunner(databaseCreateFloatAttribute))
1309
+ .action(actionRunner(databasesCreateFloatAttribute))
1041
1310
 
1042
- database
1311
+ databases
1043
1312
  .command(`createIntegerAttribute`)
1044
- .description(`Create an integer attribute. Optionally, minimum and maximum values can be provided. `)
1313
+ .description(``)
1314
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1045
1315
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1046
1316
  .requiredOption(`--key <key>`, `Attribute Key.`)
1047
1317
  .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
@@ -1049,190 +1319,223 @@ database
1049
1319
  .option(`--max <max>`, `Maximum value to enforce on new documents`, parseInteger)
1050
1320
  .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`, parseInteger)
1051
1321
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1052
- .action(actionRunner(databaseCreateIntegerAttribute))
1322
+ .action(actionRunner(databasesCreateIntegerAttribute))
1053
1323
 
1054
- database
1324
+ databases
1055
1325
  .command(`createIpAttribute`)
1056
- .description(`Create IP address attribute. `)
1326
+ .description(``)
1327
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1057
1328
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1058
1329
  .requiredOption(`--key <key>`, `Attribute Key.`)
1059
1330
  .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1060
1331
  .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
1061
1332
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1062
- .action(actionRunner(databaseCreateIpAttribute))
1333
+ .action(actionRunner(databasesCreateIpAttribute))
1063
1334
 
1064
- database
1335
+ databases
1065
1336
  .command(`createStringAttribute`)
1066
- .description(`Create a string attribute. `)
1337
+ .description(``)
1338
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1067
1339
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1068
1340
  .requiredOption(`--key <key>`, `Attribute Key.`)
1069
1341
  .requiredOption(`--size <size>`, `Attribute size for text attributes, in number of characters.`, parseInteger)
1070
1342
  .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1071
1343
  .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
1072
1344
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1073
- .action(actionRunner(databaseCreateStringAttribute))
1345
+ .action(actionRunner(databasesCreateStringAttribute))
1074
1346
 
1075
- database
1347
+ databases
1076
1348
  .command(`createUrlAttribute`)
1077
- .description(`Create a URL attribute. `)
1349
+ .description(``)
1350
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1078
1351
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1079
1352
  .requiredOption(`--key <key>`, `Attribute Key.`)
1080
1353
  .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1081
1354
  .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
1082
1355
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1083
- .action(actionRunner(databaseCreateUrlAttribute))
1356
+ .action(actionRunner(databasesCreateUrlAttribute))
1084
1357
 
1085
- database
1358
+ databases
1086
1359
  .command(`getAttribute`)
1087
1360
  .description(``)
1361
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1088
1362
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1089
1363
  .requiredOption(`--key <key>`, `Attribute Key.`)
1090
- .action(actionRunner(databaseGetAttribute))
1364
+ .action(actionRunner(databasesGetAttribute))
1091
1365
 
1092
- database
1366
+ databases
1093
1367
  .command(`deleteAttribute`)
1094
1368
  .description(``)
1369
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1095
1370
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1096
1371
  .requiredOption(`--key <key>`, `Attribute Key.`)
1097
- .action(actionRunner(databaseDeleteAttribute))
1372
+ .action(actionRunner(databasesDeleteAttribute))
1098
1373
 
1099
- database
1374
+ databases
1100
1375
  .command(`listDocuments`)
1101
- .description(`Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's documents. [Learn more about different API modes](/docs/admin).`)
1376
+ .description(``)
1377
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1102
1378
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1103
- .option(`--queries <queries...>`, `Array of query strings.`)
1379
+ .option(`--queries <queries...>`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/database#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long.`)
1104
1380
  .option(`--limit <limit>`, `Maximum number of documents to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
1105
1381
  .option(`--offset <offset>`, `Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)`, parseInteger)
1106
1382
  .option(`--cursor <cursor>`, `ID of the document used as the starting point for the query, excluding the document itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)`)
1107
- .option(`--cursorDirection <cursorDirection>`, `Direction of the cursor.`)
1108
- .option(`--orderAttributes <orderAttributes...>`, `Array of attributes used to sort results.`)
1109
- .option(`--orderTypes <orderTypes...>`, `Array of order directions for sorting attribtues. Possible values are DESC for descending order, or ASC for ascending order.`)
1110
- .action(actionRunner(databaseListDocuments))
1383
+ .option(`--cursorDirection <cursorDirection>`, `Direction of the cursor, can be either 'before' or 'after'.`)
1384
+ .option(`--orderAttributes <orderAttributes...>`, `Array of attributes used to sort results. Maximum of 100 order attributes are allowed, each 4096 characters long.`)
1385
+ .option(`--orderTypes <orderTypes...>`, `Array of order directions for sorting attribtues. Possible values are DESC for descending order, or ASC for ascending order. Maximum of 100 order types are allowed.`)
1386
+ .action(actionRunner(databasesListDocuments))
1111
1387
 
1112
- database
1388
+ databases
1113
1389
  .command(`createDocument`)
1114
- .description(`Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](/docs/server/database#databaseCreateCollection) API or directly from your database console.`)
1390
+ .description(``)
1391
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1115
1392
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection). Make sure to define attributes before creating documents.`)
1116
1393
  .requiredOption(`--documentId <documentId>`, `Document ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
1117
1394
  .requiredOption(`--data <data>`, `Document data as JSON object.`)
1118
1395
  .option(`--read <read...>`, `An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
1119
1396
  .option(`--write <write...>`, `An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
1120
- .action(actionRunner(databaseCreateDocument))
1397
+ .action(actionRunner(databasesCreateDocument))
1121
1398
 
1122
- database
1399
+ databases
1123
1400
  .command(`getDocument`)
1124
- .description(`Get a document by its unique ID. This endpoint response returns a JSON object with the document data.`)
1401
+ .description(``)
1402
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1125
1403
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1126
1404
  .requiredOption(`--documentId <documentId>`, `Document ID.`)
1127
- .action(actionRunner(databaseGetDocument))
1405
+ .action(actionRunner(databasesGetDocument))
1128
1406
 
1129
- database
1407
+ databases
1130
1408
  .command(`updateDocument`)
1131
- .description(`Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.`)
1409
+ .description(``)
1410
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1132
1411
  .requiredOption(`--collectionId <collectionId>`, `Collection ID.`)
1133
1412
  .requiredOption(`--documentId <documentId>`, `Document ID.`)
1134
- .requiredOption(`--data <data>`, `Document data as JSON object.`)
1413
+ .option(`--data <data>`, `Document data as JSON object. Include only attribute and value pairs to be updated.`)
1135
1414
  .option(`--read <read...>`, `An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
1136
1415
  .option(`--write <write...>`, `An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
1137
- .action(actionRunner(databaseUpdateDocument))
1416
+ .action(actionRunner(databasesUpdateDocument))
1138
1417
 
1139
- database
1418
+ databases
1140
1419
  .command(`deleteDocument`)
1141
- .description(`Delete a document by its unique ID. This endpoint deletes only the parent documents, its attributes and relations to other documents. Child documents **will not** be deleted.`)
1420
+ .description(``)
1421
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1142
1422
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1143
1423
  .requiredOption(`--documentId <documentId>`, `Document ID.`)
1144
- .action(actionRunner(databaseDeleteDocument))
1424
+ .action(actionRunner(databasesDeleteDocument))
1145
1425
 
1146
- database
1426
+ databases
1147
1427
  .command(`listDocumentLogs`)
1148
- .description(`Get the document activity logs list by its unique ID.`)
1428
+ .description(``)
1429
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1149
1430
  .requiredOption(`--collectionId <collectionId>`, `Collection ID.`)
1150
1431
  .requiredOption(`--documentId <documentId>`, `Document ID.`)
1151
1432
  .option(`--limit <limit>`, `Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
1152
1433
  .option(`--offset <offset>`, `Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)`, parseInteger)
1153
- .action(actionRunner(databaseListDocumentLogs))
1434
+ .action(actionRunner(databasesListDocumentLogs))
1154
1435
 
1155
- database
1436
+ databases
1156
1437
  .command(`listIndexes`)
1157
1438
  .description(``)
1439
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1158
1440
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1159
- .action(actionRunner(databaseListIndexes))
1441
+ .action(actionRunner(databasesListIndexes))
1160
1442
 
1161
- database
1443
+ databases
1162
1444
  .command(`createIndex`)
1163
1445
  .description(``)
1446
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1164
1447
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1165
1448
  .requiredOption(`--key <key>`, `Index Key.`)
1166
1449
  .requiredOption(`--type <type>`, `Index type.`)
1167
- .requiredOption(`--attributes <attributes...>`, `Array of attributes to index.`)
1168
- .option(`--orders <orders...>`, `Array of index orders.`)
1169
- .action(actionRunner(databaseCreateIndex))
1450
+ .requiredOption(`--attributes <attributes...>`, `Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.`)
1451
+ .option(`--orders <orders...>`, `Array of index orders. Maximum of 100 orders are allowed.`)
1452
+ .action(actionRunner(databasesCreateIndex))
1170
1453
 
1171
- database
1454
+ databases
1172
1455
  .command(`getIndex`)
1173
1456
  .description(``)
1457
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1174
1458
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1175
1459
  .requiredOption(`--key <key>`, `Index Key.`)
1176
- .action(actionRunner(databaseGetIndex))
1460
+ .action(actionRunner(databasesGetIndex))
1177
1461
 
1178
- database
1462
+ databases
1179
1463
  .command(`deleteIndex`)
1180
1464
  .description(``)
1465
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1181
1466
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1182
1467
  .requiredOption(`--key <key>`, `Index Key.`)
1183
- .action(actionRunner(databaseDeleteIndex))
1468
+ .action(actionRunner(databasesDeleteIndex))
1184
1469
 
1185
- database
1470
+ databases
1186
1471
  .command(`listCollectionLogs`)
1187
- .description(`Get the collection activity logs list by its unique ID.`)
1472
+ .description(``)
1473
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1188
1474
  .requiredOption(`--collectionId <collectionId>`, `Collection ID.`)
1189
1475
  .option(`--limit <limit>`, `Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
1190
1476
  .option(`--offset <offset>`, `Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)`, parseInteger)
1191
- .action(actionRunner(databaseListCollectionLogs))
1192
-
1193
- database
1194
- .command(`getUsage`)
1195
- .description(``)
1196
- .option(`--range <range>`, `Date range.`)
1197
- .action(actionRunner(databaseGetUsage))
1477
+ .action(actionRunner(databasesListCollectionLogs))
1198
1478
 
1199
- database
1479
+ databases
1200
1480
  .command(`getCollectionUsage`)
1201
1481
  .description(``)
1482
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1202
1483
  .requiredOption(`--collectionId <collectionId>`, `Collection ID.`)
1203
1484
  .option(`--range <range>`, `Date range.`)
1204
- .action(actionRunner(databaseGetCollectionUsage))
1485
+ .action(actionRunner(databasesGetCollectionUsage))
1486
+
1487
+ databases
1488
+ .command(`listLogs`)
1489
+ .description(``)
1490
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1491
+ .option(`--limit <limit>`, `Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
1492
+ .option(`--offset <offset>`, `Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)`, parseInteger)
1493
+ .action(actionRunner(databasesListLogs))
1494
+
1495
+ databases
1496
+ .command(`getDatabaseUsage`)
1497
+ .description(``)
1498
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1499
+ .option(`--range <range>`, `'Date range.`)
1500
+ .action(actionRunner(databasesGetDatabaseUsage))
1205
1501
 
1206
1502
 
1207
1503
  module.exports = {
1208
- database,
1209
- databaseListCollections,
1210
- databaseCreateCollection,
1211
- databaseGetCollection,
1212
- databaseUpdateCollection,
1213
- databaseDeleteCollection,
1214
- databaseListAttributes,
1215
- databaseCreateBooleanAttribute,
1216
- databaseCreateEmailAttribute,
1217
- databaseCreateEnumAttribute,
1218
- databaseCreateFloatAttribute,
1219
- databaseCreateIntegerAttribute,
1220
- databaseCreateIpAttribute,
1221
- databaseCreateStringAttribute,
1222
- databaseCreateUrlAttribute,
1223
- databaseGetAttribute,
1224
- databaseDeleteAttribute,
1225
- databaseListDocuments,
1226
- databaseCreateDocument,
1227
- databaseGetDocument,
1228
- databaseUpdateDocument,
1229
- databaseDeleteDocument,
1230
- databaseListDocumentLogs,
1231
- databaseListIndexes,
1232
- databaseCreateIndex,
1233
- databaseGetIndex,
1234
- databaseDeleteIndex,
1235
- databaseListCollectionLogs,
1236
- databaseGetUsage,
1237
- databaseGetCollectionUsage
1504
+ databases,
1505
+ databasesList,
1506
+ databasesCreate,
1507
+ databasesGetUsage,
1508
+ databasesGet,
1509
+ databasesUpdate,
1510
+ databasesDelete,
1511
+ databasesListCollections,
1512
+ databasesCreateCollection,
1513
+ databasesGetCollection,
1514
+ databasesUpdateCollection,
1515
+ databasesDeleteCollection,
1516
+ databasesListAttributes,
1517
+ databasesCreateBooleanAttribute,
1518
+ databasesCreateEmailAttribute,
1519
+ databasesCreateEnumAttribute,
1520
+ databasesCreateFloatAttribute,
1521
+ databasesCreateIntegerAttribute,
1522
+ databasesCreateIpAttribute,
1523
+ databasesCreateStringAttribute,
1524
+ databasesCreateUrlAttribute,
1525
+ databasesGetAttribute,
1526
+ databasesDeleteAttribute,
1527
+ databasesListDocuments,
1528
+ databasesCreateDocument,
1529
+ databasesGetDocument,
1530
+ databasesUpdateDocument,
1531
+ databasesDeleteDocument,
1532
+ databasesListDocumentLogs,
1533
+ databasesListIndexes,
1534
+ databasesCreateIndex,
1535
+ databasesGetIndex,
1536
+ databasesDeleteIndex,
1537
+ databasesListCollectionLogs,
1538
+ databasesGetCollectionUsage,
1539
+ databasesListLogs,
1540
+ databasesGetDatabaseUsage
1238
1541
  };