chirag-appwrite-cli 0.1.0 → 0.1.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 (96) hide show
  1. package/appwrite.config.json +420 -0
  2. package/docs/examples/databases/list-usage.md +2 -0
  3. package/docs/examples/projects/update-session-invalidation.md +3 -0
  4. package/docs/examples/tables/create-boolean-column.md +7 -0
  5. package/docs/examples/tables/create-datetime-column.md +7 -0
  6. package/docs/examples/tables/create-email-column.md +7 -0
  7. package/docs/examples/tables/create-enum-column.md +8 -0
  8. package/docs/examples/tables/create-float-column.md +9 -0
  9. package/docs/examples/tables/create-index.md +8 -0
  10. package/docs/examples/tables/create-integer-column.md +9 -0
  11. package/docs/examples/tables/create-ip-column.md +7 -0
  12. package/docs/examples/tables/create-relationship-column.md +9 -0
  13. package/docs/examples/tables/create-row.md +6 -0
  14. package/docs/examples/tables/create-rows.md +4 -0
  15. package/docs/examples/tables/create-string-column.md +9 -0
  16. package/docs/examples/tables/create-url-column.md +7 -0
  17. package/docs/examples/tables/create.md +7 -0
  18. package/docs/examples/tables/decrement-row-column.md +7 -0
  19. package/docs/examples/tables/delete-column.md +4 -0
  20. package/docs/examples/tables/delete-index.md +4 -0
  21. package/docs/examples/tables/delete-row.md +4 -0
  22. package/docs/examples/tables/delete-rows.md +4 -0
  23. package/docs/examples/tables/delete.md +3 -0
  24. package/docs/examples/tables/get-column.md +4 -0
  25. package/docs/examples/tables/get-index.md +4 -0
  26. package/docs/examples/tables/get-row.md +5 -0
  27. package/docs/examples/tables/get-usage.md +4 -0
  28. package/docs/examples/tables/get.md +3 -0
  29. package/docs/examples/tables/increment-row-column.md +7 -0
  30. package/docs/examples/tables/list-columns.md +4 -0
  31. package/docs/examples/tables/list-indexes.md +4 -0
  32. package/docs/examples/tables/list-logs.md +4 -0
  33. package/docs/examples/tables/list-row-logs.md +5 -0
  34. package/docs/examples/tables/list-rows.md +4 -0
  35. package/docs/examples/tables/list.md +4 -0
  36. package/docs/examples/tables/update-boolean-column.md +7 -0
  37. package/docs/examples/tables/update-datetime-column.md +7 -0
  38. package/docs/examples/tables/update-email-column.md +7 -0
  39. package/docs/examples/tables/update-enum-column.md +8 -0
  40. package/docs/examples/tables/update-float-column.md +9 -0
  41. package/docs/examples/tables/update-integer-column.md +9 -0
  42. package/docs/examples/tables/update-ip-column.md +7 -0
  43. package/docs/examples/tables/update-relationship-column.md +6 -0
  44. package/docs/examples/tables/update-row.md +6 -0
  45. package/docs/examples/tables/update-rows.md +5 -0
  46. package/docs/examples/tables/update-string-column.md +8 -0
  47. package/docs/examples/tables/update-url-column.md +7 -0
  48. package/docs/examples/tables/update.md +7 -0
  49. package/docs/examples/tables/upsert-row.md +4 -0
  50. package/docs/examples/tables/upsert-rows.md +3 -0
  51. package/generate/appwrite.d.ts +43 -6
  52. package/generate/appwrite.db.ts +75 -0
  53. package/lib/client-generation/languages/typescript.js +65 -0
  54. package/lib/commands/account.js +1 -1
  55. package/lib/commands/avatars.js +1 -1
  56. package/lib/commands/console.js +1 -1
  57. package/lib/commands/databases.js +2 -2
  58. package/lib/commands/functions.js +1 -1
  59. package/lib/commands/graphql.js +1 -1
  60. package/lib/commands/health.js +1 -1
  61. package/lib/commands/locale.js +1 -1
  62. package/lib/commands/messaging.js +1 -1
  63. package/lib/commands/migrations.js +1 -1
  64. package/lib/commands/project.js +1 -1
  65. package/lib/commands/projects.js +1 -1
  66. package/lib/commands/proxy.js +1 -1
  67. package/lib/commands/sites.js +1 -1
  68. package/lib/commands/storage.js +1 -1
  69. package/lib/commands/tables.js +2607 -0
  70. package/lib/commands/teams.js +1 -1
  71. package/lib/commands/tokens.js +1 -1
  72. package/lib/commands/types.js +45 -10
  73. package/lib/commands/users.js +1 -1
  74. package/lib/commands/vcs.js +2 -2
  75. package/lib/config.js +26 -14
  76. package/lib/type-generation/languages/dart.js +13 -13
  77. package/lib/type-generation/languages/java.js +13 -13
  78. package/lib/type-generation/languages/javascript.js +14 -14
  79. package/lib/type-generation/languages/kotlin.js +11 -10
  80. package/lib/type-generation/languages/php.js +15 -14
  81. package/lib/type-generation/languages/swift.js +13 -13
  82. package/lib/type-generation/languages/typescript.js +4 -1
  83. package/package.json +1 -1
  84. package/appwrite.json +0 -164
  85. /package/sites/{JavaScript starter → JavaScript starter2}/.env.example +0 -0
  86. /package/sites/{JavaScript starter → JavaScript starter2}/LICENSE +0 -0
  87. /package/sites/{JavaScript starter → JavaScript starter2}/images/appwrite.svg +0 -0
  88. /package/sites/{JavaScript starter → JavaScript starter2}/images/javascript.svg +0 -0
  89. /package/sites/{JavaScript starter → JavaScript starter2}/index.html +0 -0
  90. /package/sites/{JavaScript starter → JavaScript starter2}/lib/appwrite.js +0 -0
  91. /package/sites/{JavaScript starter → JavaScript starter2}/package-lock.json +0 -0
  92. /package/sites/{JavaScript starter → JavaScript starter2}/package.json +0 -0
  93. /package/sites/{JavaScript starter → JavaScript starter2}/readme.md +0 -0
  94. /package/sites/{JavaScript starter → JavaScript starter2}/src/javascript.svg +0 -0
  95. /package/sites/{JavaScript starter → JavaScript starter2}/style/app.css +0 -0
  96. /package/sites/{JavaScript starter → JavaScript starter2}/vite.config.js +0 -0
@@ -0,0 +1,2607 @@
1
+ const fs = require('fs');
2
+ const pathLib = require('path');
3
+ const tar = require("tar");
4
+ const ignore = require("ignore");
5
+ const { promisify } = require('util');
6
+ const libClient = require('../client.js');
7
+ const { getAllFiles, showConsoleLink } = require('../utils.js');
8
+ const { Command } = require('commander');
9
+ const { sdkForProject, sdkForConsole } = require('../sdks')
10
+ const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log, warn } = require('../parser')
11
+ const { localConfig, globalConfig } = require("../config");
12
+ const { File } = require('undici');
13
+ const { ReadableStream } = require('stream/web');
14
+
15
+ /**
16
+ * @param {fs.ReadStream} readStream
17
+ * @returns {ReadableStream}
18
+ */
19
+ function convertReadStreamToReadableStream(readStream) {
20
+ return new ReadableStream({
21
+ start(controller) {
22
+ readStream.on("data", (chunk) => {
23
+ controller.enqueue(chunk);
24
+ });
25
+ readStream.on("end", () => {
26
+ controller.close();
27
+ });
28
+ readStream.on("error", (err) => {
29
+ controller.error(err);
30
+ });
31
+ },
32
+ cancel() {
33
+ readStream.destroy();
34
+ },
35
+ });
36
+ }
37
+
38
+ const tables = new Command("tables").description(commandDescriptions['tables'] ?? '').configureHelp({
39
+ helpWidth: process.stdout.columns || 80
40
+ })
41
+
42
+ /**
43
+ * @typedef {Object} TablesListRequestParams
44
+ * @property {string} databaseId Database ID.
45
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, rowSecurity
46
+ * @property {string} search Search term to filter your list results. Max length: 256 chars.
47
+ * @property {boolean} overrideForCli
48
+ * @property {boolean} parseOutput
49
+ * @property {libClient | undefined} sdk
50
+ */
51
+
52
+ /**
53
+ * @param {TablesListRequestParams} params
54
+ */
55
+ const tablesList = async ({databaseId,queries,search,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
56
+ let client = !sdk ? await sdkForProject() :
57
+ sdk;
58
+ let apiPath = '/databases/{databaseId}/tables'.replace('{databaseId}', databaseId);
59
+ let payload = {};
60
+ if (typeof queries !== 'undefined') {
61
+ payload['queries'] = queries;
62
+ }
63
+ if (typeof search !== 'undefined') {
64
+ payload['search'] = search;
65
+ }
66
+
67
+ let response = undefined;
68
+
69
+ response = await client.call('get', apiPath, {
70
+ }, payload);
71
+
72
+ if (parseOutput) {
73
+ if(console) {
74
+ showConsoleLink('tables', 'list', databaseId);
75
+ } else {
76
+ parse(response)
77
+ }
78
+ }
79
+
80
+ return response;
81
+
82
+ }
83
+
84
+ /**
85
+ * @typedef {Object} TablesCreateRequestParams
86
+ * @property {string} databaseId Database ID.
87
+ * @property {string} tableId Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. 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.
88
+ * @property {string} name Table name. Max length: 128 chars.
89
+ * @property {string[]} permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
90
+ * @property {boolean} rowSecurity Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions).
91
+ * @property {boolean} enabled Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled.
92
+ * @property {boolean} overrideForCli
93
+ * @property {boolean} parseOutput
94
+ * @property {libClient | undefined} sdk
95
+ */
96
+
97
+ /**
98
+ * @param {TablesCreateRequestParams} params
99
+ */
100
+ const tablesCreate = async ({databaseId,tableId,name,permissions,rowSecurity,enabled,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
101
+ let client = !sdk ? await sdkForProject() :
102
+ sdk;
103
+ let apiPath = '/databases/{databaseId}/tables'.replace('{databaseId}', databaseId);
104
+ let payload = {};
105
+ if (typeof tableId !== 'undefined') {
106
+ payload['tableId'] = tableId;
107
+ }
108
+ if (typeof name !== 'undefined') {
109
+ payload['name'] = name;
110
+ }
111
+ permissions = permissions === true ? [] : permissions;
112
+ if (typeof permissions !== 'undefined') {
113
+ payload['permissions'] = permissions;
114
+ }
115
+ if (typeof rowSecurity !== 'undefined') {
116
+ payload['rowSecurity'] = rowSecurity;
117
+ }
118
+ if (typeof enabled !== 'undefined') {
119
+ payload['enabled'] = enabled;
120
+ }
121
+
122
+ let response = undefined;
123
+
124
+ response = await client.call('post', apiPath, {
125
+ 'content-type': 'application/json',
126
+ }, payload);
127
+
128
+ if (parseOutput) {
129
+ parse(response)
130
+ }
131
+
132
+ return response;
133
+
134
+ }
135
+
136
+ /**
137
+ * @typedef {Object} TablesGetRequestParams
138
+ * @property {string} databaseId Database ID.
139
+ * @property {string} tableId Table ID.
140
+ * @property {boolean} overrideForCli
141
+ * @property {boolean} parseOutput
142
+ * @property {libClient | undefined} sdk
143
+ */
144
+
145
+ /**
146
+ * @param {TablesGetRequestParams} params
147
+ */
148
+ const tablesGet = async ({databaseId,tableId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
149
+ let client = !sdk ? await sdkForProject() :
150
+ sdk;
151
+ let apiPath = '/databases/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
152
+ let payload = {};
153
+
154
+ let response = undefined;
155
+
156
+ response = await client.call('get', apiPath, {
157
+ }, payload);
158
+
159
+ if (parseOutput) {
160
+ if(console) {
161
+ showConsoleLink('tables', 'get', databaseId, tableId);
162
+ } else {
163
+ parse(response)
164
+ }
165
+ }
166
+
167
+ return response;
168
+
169
+ }
170
+
171
+ /**
172
+ * @typedef {Object} TablesUpdateRequestParams
173
+ * @property {string} databaseId Database ID.
174
+ * @property {string} tableId Table ID.
175
+ * @property {string} name Table name. Max length: 128 chars.
176
+ * @property {string[]} permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
177
+ * @property {boolean} rowSecurity Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
178
+ * @property {boolean} enabled Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled.
179
+ * @property {boolean} overrideForCli
180
+ * @property {boolean} parseOutput
181
+ * @property {libClient | undefined} sdk
182
+ */
183
+
184
+ /**
185
+ * @param {TablesUpdateRequestParams} params
186
+ */
187
+ const tablesUpdate = async ({databaseId,tableId,name,permissions,rowSecurity,enabled,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
188
+ let client = !sdk ? await sdkForProject() :
189
+ sdk;
190
+ let apiPath = '/databases/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
191
+ let payload = {};
192
+ if (typeof name !== 'undefined') {
193
+ payload['name'] = name;
194
+ }
195
+ permissions = permissions === true ? [] : permissions;
196
+ if (typeof permissions !== 'undefined') {
197
+ payload['permissions'] = permissions;
198
+ }
199
+ if (typeof rowSecurity !== 'undefined') {
200
+ payload['rowSecurity'] = rowSecurity;
201
+ }
202
+ if (typeof enabled !== 'undefined') {
203
+ payload['enabled'] = enabled;
204
+ }
205
+
206
+ let response = undefined;
207
+
208
+ response = await client.call('put', apiPath, {
209
+ 'content-type': 'application/json',
210
+ }, payload);
211
+
212
+ if (parseOutput) {
213
+ parse(response)
214
+ }
215
+
216
+ return response;
217
+
218
+ }
219
+
220
+ /**
221
+ * @typedef {Object} TablesDeleteRequestParams
222
+ * @property {string} databaseId Database ID.
223
+ * @property {string} tableId Table ID.
224
+ * @property {boolean} overrideForCli
225
+ * @property {boolean} parseOutput
226
+ * @property {libClient | undefined} sdk
227
+ */
228
+
229
+ /**
230
+ * @param {TablesDeleteRequestParams} params
231
+ */
232
+ const tablesDelete = async ({databaseId,tableId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
233
+ let client = !sdk ? await sdkForProject() :
234
+ sdk;
235
+ let apiPath = '/databases/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
236
+ let payload = {};
237
+
238
+ let response = undefined;
239
+
240
+ response = await client.call('delete', apiPath, {
241
+ 'content-type': 'application/json',
242
+ }, payload);
243
+
244
+ if (parseOutput) {
245
+ parse(response)
246
+ }
247
+
248
+ return response;
249
+
250
+ }
251
+
252
+ /**
253
+ * @typedef {Object} TablesListColumnsRequestParams
254
+ * @property {string} databaseId Database ID.
255
+ * @property {string} tableId Table ID.
256
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error
257
+ * @property {boolean} overrideForCli
258
+ * @property {boolean} parseOutput
259
+ * @property {libClient | undefined} sdk
260
+ */
261
+
262
+ /**
263
+ * @param {TablesListColumnsRequestParams} params
264
+ */
265
+ const tablesListColumns = async ({databaseId,tableId,queries,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
266
+ let client = !sdk ? await sdkForProject() :
267
+ sdk;
268
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
269
+ let payload = {};
270
+ if (typeof queries !== 'undefined') {
271
+ payload['queries'] = queries;
272
+ }
273
+
274
+ let response = undefined;
275
+
276
+ response = await client.call('get', apiPath, {
277
+ }, payload);
278
+
279
+ if (parseOutput) {
280
+ if(console) {
281
+ showConsoleLink('tables', 'listColumns', databaseId, tableId);
282
+ } else {
283
+ parse(response)
284
+ }
285
+ }
286
+
287
+ return response;
288
+
289
+ }
290
+
291
+ /**
292
+ * @typedef {Object} TablesCreateBooleanColumnRequestParams
293
+ * @property {string} databaseId Database ID.
294
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).
295
+ * @property {string} key Column Key.
296
+ * @property {boolean} required Is column required?
297
+ * @property {boolean} xdefault Default value for column when not provided. Cannot be set when column is required.
298
+ * @property {boolean} array Is column an array?
299
+ * @property {boolean} overrideForCli
300
+ * @property {boolean} parseOutput
301
+ * @property {libClient | undefined} sdk
302
+ */
303
+
304
+ /**
305
+ * @param {TablesCreateBooleanColumnRequestParams} params
306
+ */
307
+ const tablesCreateBooleanColumn = async ({databaseId,tableId,key,required,xdefault,array,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
308
+ let client = !sdk ? await sdkForProject() :
309
+ sdk;
310
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/boolean'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
311
+ let payload = {};
312
+ if (typeof key !== 'undefined') {
313
+ payload['key'] = key;
314
+ }
315
+ if (typeof required !== 'undefined') {
316
+ payload['required'] = required;
317
+ }
318
+ if (typeof xdefault !== 'undefined') {
319
+ payload['default'] = xdefault;
320
+ }
321
+ if (typeof array !== 'undefined') {
322
+ payload['array'] = array;
323
+ }
324
+
325
+ let response = undefined;
326
+
327
+ response = await client.call('post', apiPath, {
328
+ 'content-type': 'application/json',
329
+ }, payload);
330
+
331
+ if (parseOutput) {
332
+ parse(response)
333
+ }
334
+
335
+ return response;
336
+
337
+ }
338
+
339
+ /**
340
+ * @typedef {Object} TablesUpdateBooleanColumnRequestParams
341
+ * @property {string} databaseId Database ID.
342
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).
343
+ * @property {string} key Column Key.
344
+ * @property {boolean} required Is column required?
345
+ * @property {boolean} xdefault Default value for column when not provided. Cannot be set when column is required.
346
+ * @property {string} newKey New Column Key.
347
+ * @property {boolean} overrideForCli
348
+ * @property {boolean} parseOutput
349
+ * @property {libClient | undefined} sdk
350
+ */
351
+
352
+ /**
353
+ * @param {TablesUpdateBooleanColumnRequestParams} params
354
+ */
355
+ const tablesUpdateBooleanColumn = async ({databaseId,tableId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
356
+ let client = !sdk ? await sdkForProject() :
357
+ sdk;
358
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/boolean/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key);
359
+ let payload = {};
360
+ if (typeof required !== 'undefined') {
361
+ payload['required'] = required;
362
+ }
363
+ if (typeof xdefault !== 'undefined') {
364
+ payload['default'] = xdefault;
365
+ }
366
+ if (typeof newKey !== 'undefined') {
367
+ payload['newKey'] = newKey;
368
+ }
369
+
370
+ let response = undefined;
371
+
372
+ response = await client.call('patch', apiPath, {
373
+ 'content-type': 'application/json',
374
+ }, payload);
375
+
376
+ if (parseOutput) {
377
+ parse(response)
378
+ }
379
+
380
+ return response;
381
+
382
+ }
383
+
384
+ /**
385
+ * @typedef {Object} TablesCreateDatetimeColumnRequestParams
386
+ * @property {string} databaseId Database ID.
387
+ * @property {string} tableId Table ID.
388
+ * @property {string} key Column Key.
389
+ * @property {boolean} required Is column required?
390
+ * @property {string} xdefault Default value for the column in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when column is required.
391
+ * @property {boolean} array Is column an array?
392
+ * @property {boolean} overrideForCli
393
+ * @property {boolean} parseOutput
394
+ * @property {libClient | undefined} sdk
395
+ */
396
+
397
+ /**
398
+ * @param {TablesCreateDatetimeColumnRequestParams} params
399
+ */
400
+ const tablesCreateDatetimeColumn = async ({databaseId,tableId,key,required,xdefault,array,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
401
+ let client = !sdk ? await sdkForProject() :
402
+ sdk;
403
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/datetime'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
404
+ let payload = {};
405
+ if (typeof key !== 'undefined') {
406
+ payload['key'] = key;
407
+ }
408
+ if (typeof required !== 'undefined') {
409
+ payload['required'] = required;
410
+ }
411
+ if (typeof xdefault !== 'undefined') {
412
+ payload['default'] = xdefault;
413
+ }
414
+ if (typeof array !== 'undefined') {
415
+ payload['array'] = array;
416
+ }
417
+
418
+ let response = undefined;
419
+
420
+ response = await client.call('post', apiPath, {
421
+ 'content-type': 'application/json',
422
+ }, payload);
423
+
424
+ if (parseOutput) {
425
+ parse(response)
426
+ }
427
+
428
+ return response;
429
+
430
+ }
431
+
432
+ /**
433
+ * @typedef {Object} TablesUpdateDatetimeColumnRequestParams
434
+ * @property {string} databaseId Database ID.
435
+ * @property {string} tableId Table ID.
436
+ * @property {string} key Column Key.
437
+ * @property {boolean} required Is column required?
438
+ * @property {string} xdefault Default value for column when not provided. Cannot be set when column is required.
439
+ * @property {string} newKey New Column Key.
440
+ * @property {boolean} overrideForCli
441
+ * @property {boolean} parseOutput
442
+ * @property {libClient | undefined} sdk
443
+ */
444
+
445
+ /**
446
+ * @param {TablesUpdateDatetimeColumnRequestParams} params
447
+ */
448
+ const tablesUpdateDatetimeColumn = async ({databaseId,tableId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
449
+ let client = !sdk ? await sdkForProject() :
450
+ sdk;
451
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/datetime/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key);
452
+ let payload = {};
453
+ if (typeof required !== 'undefined') {
454
+ payload['required'] = required;
455
+ }
456
+ if (typeof xdefault !== 'undefined') {
457
+ payload['default'] = xdefault;
458
+ }
459
+ if (typeof newKey !== 'undefined') {
460
+ payload['newKey'] = newKey;
461
+ }
462
+
463
+ let response = undefined;
464
+
465
+ response = await client.call('patch', apiPath, {
466
+ 'content-type': 'application/json',
467
+ }, payload);
468
+
469
+ if (parseOutput) {
470
+ parse(response)
471
+ }
472
+
473
+ return response;
474
+
475
+ }
476
+
477
+ /**
478
+ * @typedef {Object} TablesCreateEmailColumnRequestParams
479
+ * @property {string} databaseId Database ID.
480
+ * @property {string} tableId Table ID.
481
+ * @property {string} key Column Key.
482
+ * @property {boolean} required Is column required?
483
+ * @property {string} xdefault Default value for column when not provided. Cannot be set when column is required.
484
+ * @property {boolean} array Is column an array?
485
+ * @property {boolean} overrideForCli
486
+ * @property {boolean} parseOutput
487
+ * @property {libClient | undefined} sdk
488
+ */
489
+
490
+ /**
491
+ * @param {TablesCreateEmailColumnRequestParams} params
492
+ */
493
+ const tablesCreateEmailColumn = async ({databaseId,tableId,key,required,xdefault,array,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
494
+ let client = !sdk ? await sdkForProject() :
495
+ sdk;
496
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/email'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
497
+ let payload = {};
498
+ if (typeof key !== 'undefined') {
499
+ payload['key'] = key;
500
+ }
501
+ if (typeof required !== 'undefined') {
502
+ payload['required'] = required;
503
+ }
504
+ if (typeof xdefault !== 'undefined') {
505
+ payload['default'] = xdefault;
506
+ }
507
+ if (typeof array !== 'undefined') {
508
+ payload['array'] = array;
509
+ }
510
+
511
+ let response = undefined;
512
+
513
+ response = await client.call('post', apiPath, {
514
+ 'content-type': 'application/json',
515
+ }, payload);
516
+
517
+ if (parseOutput) {
518
+ parse(response)
519
+ }
520
+
521
+ return response;
522
+
523
+ }
524
+
525
+ /**
526
+ * @typedef {Object} TablesUpdateEmailColumnRequestParams
527
+ * @property {string} databaseId Database ID.
528
+ * @property {string} tableId Table ID.
529
+ * @property {string} key Column Key.
530
+ * @property {boolean} required Is column required?
531
+ * @property {string} xdefault Default value for column when not provided. Cannot be set when column is required.
532
+ * @property {string} newKey New Column Key.
533
+ * @property {boolean} overrideForCli
534
+ * @property {boolean} parseOutput
535
+ * @property {libClient | undefined} sdk
536
+ */
537
+
538
+ /**
539
+ * @param {TablesUpdateEmailColumnRequestParams} params
540
+ */
541
+ const tablesUpdateEmailColumn = async ({databaseId,tableId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
542
+ let client = !sdk ? await sdkForProject() :
543
+ sdk;
544
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/email/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key);
545
+ let payload = {};
546
+ if (typeof required !== 'undefined') {
547
+ payload['required'] = required;
548
+ }
549
+ if (typeof xdefault !== 'undefined') {
550
+ payload['default'] = xdefault;
551
+ }
552
+ if (typeof newKey !== 'undefined') {
553
+ payload['newKey'] = newKey;
554
+ }
555
+
556
+ let response = undefined;
557
+
558
+ response = await client.call('patch', apiPath, {
559
+ 'content-type': 'application/json',
560
+ }, payload);
561
+
562
+ if (parseOutput) {
563
+ parse(response)
564
+ }
565
+
566
+ return response;
567
+
568
+ }
569
+
570
+ /**
571
+ * @typedef {Object} TablesCreateEnumColumnRequestParams
572
+ * @property {string} databaseId Database ID.
573
+ * @property {string} tableId Table ID.
574
+ * @property {string} key Column Key.
575
+ * @property {string[]} elements Array of enum values.
576
+ * @property {boolean} required Is column required?
577
+ * @property {string} xdefault Default value for column when not provided. Cannot be set when column is required.
578
+ * @property {boolean} array Is column an array?
579
+ * @property {boolean} overrideForCli
580
+ * @property {boolean} parseOutput
581
+ * @property {libClient | undefined} sdk
582
+ */
583
+
584
+ /**
585
+ * @param {TablesCreateEnumColumnRequestParams} params
586
+ */
587
+ const tablesCreateEnumColumn = async ({databaseId,tableId,key,elements,required,xdefault,array,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
588
+ let client = !sdk ? await sdkForProject() :
589
+ sdk;
590
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/enum'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
591
+ let payload = {};
592
+ if (typeof key !== 'undefined') {
593
+ payload['key'] = key;
594
+ }
595
+ elements = elements === true ? [] : elements;
596
+ if (typeof elements !== 'undefined') {
597
+ payload['elements'] = elements;
598
+ }
599
+ if (typeof required !== 'undefined') {
600
+ payload['required'] = required;
601
+ }
602
+ if (typeof xdefault !== 'undefined') {
603
+ payload['default'] = xdefault;
604
+ }
605
+ if (typeof array !== 'undefined') {
606
+ payload['array'] = array;
607
+ }
608
+
609
+ let response = undefined;
610
+
611
+ response = await client.call('post', apiPath, {
612
+ 'content-type': 'application/json',
613
+ }, payload);
614
+
615
+ if (parseOutput) {
616
+ parse(response)
617
+ }
618
+
619
+ return response;
620
+
621
+ }
622
+
623
+ /**
624
+ * @typedef {Object} TablesUpdateEnumColumnRequestParams
625
+ * @property {string} databaseId Database ID.
626
+ * @property {string} tableId Table ID.
627
+ * @property {string} key Column Key.
628
+ * @property {string[]} elements Updated list of enum values.
629
+ * @property {boolean} required Is column required?
630
+ * @property {string} xdefault Default value for column when not provided. Cannot be set when column is required.
631
+ * @property {string} newKey New Column Key.
632
+ * @property {boolean} overrideForCli
633
+ * @property {boolean} parseOutput
634
+ * @property {libClient | undefined} sdk
635
+ */
636
+
637
+ /**
638
+ * @param {TablesUpdateEnumColumnRequestParams} params
639
+ */
640
+ const tablesUpdateEnumColumn = async ({databaseId,tableId,key,elements,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
641
+ let client = !sdk ? await sdkForProject() :
642
+ sdk;
643
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/enum/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key);
644
+ let payload = {};
645
+ elements = elements === true ? [] : elements;
646
+ if (typeof elements !== 'undefined') {
647
+ payload['elements'] = elements;
648
+ }
649
+ if (typeof required !== 'undefined') {
650
+ payload['required'] = required;
651
+ }
652
+ if (typeof xdefault !== 'undefined') {
653
+ payload['default'] = xdefault;
654
+ }
655
+ if (typeof newKey !== 'undefined') {
656
+ payload['newKey'] = newKey;
657
+ }
658
+
659
+ let response = undefined;
660
+
661
+ response = await client.call('patch', apiPath, {
662
+ 'content-type': 'application/json',
663
+ }, payload);
664
+
665
+ if (parseOutput) {
666
+ parse(response)
667
+ }
668
+
669
+ return response;
670
+
671
+ }
672
+
673
+ /**
674
+ * @typedef {Object} TablesCreateFloatColumnRequestParams
675
+ * @property {string} databaseId Database ID.
676
+ * @property {string} tableId Table ID.
677
+ * @property {string} key Column Key.
678
+ * @property {boolean} required Is column required?
679
+ * @property {number} min Minimum value
680
+ * @property {number} max Maximum value
681
+ * @property {number} xdefault Default value. Cannot be set when required.
682
+ * @property {boolean} array Is column an array?
683
+ * @property {boolean} overrideForCli
684
+ * @property {boolean} parseOutput
685
+ * @property {libClient | undefined} sdk
686
+ */
687
+
688
+ /**
689
+ * @param {TablesCreateFloatColumnRequestParams} params
690
+ */
691
+ const tablesCreateFloatColumn = async ({databaseId,tableId,key,required,min,max,xdefault,array,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
692
+ let client = !sdk ? await sdkForProject() :
693
+ sdk;
694
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/float'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
695
+ let payload = {};
696
+ if (typeof key !== 'undefined') {
697
+ payload['key'] = key;
698
+ }
699
+ if (typeof required !== 'undefined') {
700
+ payload['required'] = required;
701
+ }
702
+ if (typeof min !== 'undefined') {
703
+ payload['min'] = min;
704
+ }
705
+ if (typeof max !== 'undefined') {
706
+ payload['max'] = max;
707
+ }
708
+ if (typeof xdefault !== 'undefined') {
709
+ payload['default'] = xdefault;
710
+ }
711
+ if (typeof array !== 'undefined') {
712
+ payload['array'] = array;
713
+ }
714
+
715
+ let response = undefined;
716
+
717
+ response = await client.call('post', apiPath, {
718
+ 'content-type': 'application/json',
719
+ }, payload);
720
+
721
+ if (parseOutput) {
722
+ parse(response)
723
+ }
724
+
725
+ return response;
726
+
727
+ }
728
+
729
+ /**
730
+ * @typedef {Object} TablesUpdateFloatColumnRequestParams
731
+ * @property {string} databaseId Database ID.
732
+ * @property {string} tableId Table ID.
733
+ * @property {string} key Column Key.
734
+ * @property {boolean} required Is column required?
735
+ * @property {number} xdefault Default value. Cannot be set when required.
736
+ * @property {number} min Minimum value
737
+ * @property {number} max Maximum value
738
+ * @property {string} newKey New Column Key.
739
+ * @property {boolean} overrideForCli
740
+ * @property {boolean} parseOutput
741
+ * @property {libClient | undefined} sdk
742
+ */
743
+
744
+ /**
745
+ * @param {TablesUpdateFloatColumnRequestParams} params
746
+ */
747
+ const tablesUpdateFloatColumn = async ({databaseId,tableId,key,required,xdefault,min,max,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
748
+ let client = !sdk ? await sdkForProject() :
749
+ sdk;
750
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/float/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key);
751
+ let payload = {};
752
+ if (typeof required !== 'undefined') {
753
+ payload['required'] = required;
754
+ }
755
+ if (typeof min !== 'undefined') {
756
+ payload['min'] = min;
757
+ }
758
+ if (typeof max !== 'undefined') {
759
+ payload['max'] = max;
760
+ }
761
+ if (typeof xdefault !== 'undefined') {
762
+ payload['default'] = xdefault;
763
+ }
764
+ if (typeof newKey !== 'undefined') {
765
+ payload['newKey'] = newKey;
766
+ }
767
+
768
+ let response = undefined;
769
+
770
+ response = await client.call('patch', apiPath, {
771
+ 'content-type': 'application/json',
772
+ }, payload);
773
+
774
+ if (parseOutput) {
775
+ parse(response)
776
+ }
777
+
778
+ return response;
779
+
780
+ }
781
+
782
+ /**
783
+ * @typedef {Object} TablesCreateIntegerColumnRequestParams
784
+ * @property {string} databaseId Database ID.
785
+ * @property {string} tableId Table ID.
786
+ * @property {string} key Column Key.
787
+ * @property {boolean} required Is column required?
788
+ * @property {number} min Minimum value
789
+ * @property {number} max Maximum value
790
+ * @property {number} xdefault Default value. Cannot be set when column is required.
791
+ * @property {boolean} array Is column an array?
792
+ * @property {boolean} overrideForCli
793
+ * @property {boolean} parseOutput
794
+ * @property {libClient | undefined} sdk
795
+ */
796
+
797
+ /**
798
+ * @param {TablesCreateIntegerColumnRequestParams} params
799
+ */
800
+ const tablesCreateIntegerColumn = async ({databaseId,tableId,key,required,min,max,xdefault,array,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
801
+ let client = !sdk ? await sdkForProject() :
802
+ sdk;
803
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/integer'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
804
+ let payload = {};
805
+ if (typeof key !== 'undefined') {
806
+ payload['key'] = key;
807
+ }
808
+ if (typeof required !== 'undefined') {
809
+ payload['required'] = required;
810
+ }
811
+ if (typeof min !== 'undefined') {
812
+ payload['min'] = min;
813
+ }
814
+ if (typeof max !== 'undefined') {
815
+ payload['max'] = max;
816
+ }
817
+ if (typeof xdefault !== 'undefined') {
818
+ payload['default'] = xdefault;
819
+ }
820
+ if (typeof array !== 'undefined') {
821
+ payload['array'] = array;
822
+ }
823
+
824
+ let response = undefined;
825
+
826
+ response = await client.call('post', apiPath, {
827
+ 'content-type': 'application/json',
828
+ }, payload);
829
+
830
+ if (parseOutput) {
831
+ parse(response)
832
+ }
833
+
834
+ return response;
835
+
836
+ }
837
+
838
+ /**
839
+ * @typedef {Object} TablesUpdateIntegerColumnRequestParams
840
+ * @property {string} databaseId Database ID.
841
+ * @property {string} tableId Table ID.
842
+ * @property {string} key Column Key.
843
+ * @property {boolean} required Is column required?
844
+ * @property {number} xdefault Default value. Cannot be set when column is required.
845
+ * @property {number} min Minimum value
846
+ * @property {number} max Maximum value
847
+ * @property {string} newKey New Column Key.
848
+ * @property {boolean} overrideForCli
849
+ * @property {boolean} parseOutput
850
+ * @property {libClient | undefined} sdk
851
+ */
852
+
853
+ /**
854
+ * @param {TablesUpdateIntegerColumnRequestParams} params
855
+ */
856
+ const tablesUpdateIntegerColumn = async ({databaseId,tableId,key,required,xdefault,min,max,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
857
+ let client = !sdk ? await sdkForProject() :
858
+ sdk;
859
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/integer/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key);
860
+ let payload = {};
861
+ if (typeof required !== 'undefined') {
862
+ payload['required'] = required;
863
+ }
864
+ if (typeof min !== 'undefined') {
865
+ payload['min'] = min;
866
+ }
867
+ if (typeof max !== 'undefined') {
868
+ payload['max'] = max;
869
+ }
870
+ if (typeof xdefault !== 'undefined') {
871
+ payload['default'] = xdefault;
872
+ }
873
+ if (typeof newKey !== 'undefined') {
874
+ payload['newKey'] = newKey;
875
+ }
876
+
877
+ let response = undefined;
878
+
879
+ response = await client.call('patch', apiPath, {
880
+ 'content-type': 'application/json',
881
+ }, payload);
882
+
883
+ if (parseOutput) {
884
+ parse(response)
885
+ }
886
+
887
+ return response;
888
+
889
+ }
890
+
891
+ /**
892
+ * @typedef {Object} TablesCreateIpColumnRequestParams
893
+ * @property {string} databaseId Database ID.
894
+ * @property {string} tableId Table ID.
895
+ * @property {string} key Column Key.
896
+ * @property {boolean} required Is column required?
897
+ * @property {string} xdefault Default value. Cannot be set when column is required.
898
+ * @property {boolean} array Is column an array?
899
+ * @property {boolean} overrideForCli
900
+ * @property {boolean} parseOutput
901
+ * @property {libClient | undefined} sdk
902
+ */
903
+
904
+ /**
905
+ * @param {TablesCreateIpColumnRequestParams} params
906
+ */
907
+ const tablesCreateIpColumn = async ({databaseId,tableId,key,required,xdefault,array,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
908
+ let client = !sdk ? await sdkForProject() :
909
+ sdk;
910
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/ip'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
911
+ let payload = {};
912
+ if (typeof key !== 'undefined') {
913
+ payload['key'] = key;
914
+ }
915
+ if (typeof required !== 'undefined') {
916
+ payload['required'] = required;
917
+ }
918
+ if (typeof xdefault !== 'undefined') {
919
+ payload['default'] = xdefault;
920
+ }
921
+ if (typeof array !== 'undefined') {
922
+ payload['array'] = array;
923
+ }
924
+
925
+ let response = undefined;
926
+
927
+ response = await client.call('post', apiPath, {
928
+ 'content-type': 'application/json',
929
+ }, payload);
930
+
931
+ if (parseOutput) {
932
+ parse(response)
933
+ }
934
+
935
+ return response;
936
+
937
+ }
938
+
939
+ /**
940
+ * @typedef {Object} TablesUpdateIpColumnRequestParams
941
+ * @property {string} databaseId Database ID.
942
+ * @property {string} tableId Table ID.
943
+ * @property {string} key Column Key.
944
+ * @property {boolean} required Is column required?
945
+ * @property {string} xdefault Default value. Cannot be set when column is required.
946
+ * @property {string} newKey New Column Key.
947
+ * @property {boolean} overrideForCli
948
+ * @property {boolean} parseOutput
949
+ * @property {libClient | undefined} sdk
950
+ */
951
+
952
+ /**
953
+ * @param {TablesUpdateIpColumnRequestParams} params
954
+ */
955
+ const tablesUpdateIpColumn = async ({databaseId,tableId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
956
+ let client = !sdk ? await sdkForProject() :
957
+ sdk;
958
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/ip/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key);
959
+ let payload = {};
960
+ if (typeof required !== 'undefined') {
961
+ payload['required'] = required;
962
+ }
963
+ if (typeof xdefault !== 'undefined') {
964
+ payload['default'] = xdefault;
965
+ }
966
+ if (typeof newKey !== 'undefined') {
967
+ payload['newKey'] = newKey;
968
+ }
969
+
970
+ let response = undefined;
971
+
972
+ response = await client.call('patch', apiPath, {
973
+ 'content-type': 'application/json',
974
+ }, payload);
975
+
976
+ if (parseOutput) {
977
+ parse(response)
978
+ }
979
+
980
+ return response;
981
+
982
+ }
983
+
984
+ /**
985
+ * @typedef {Object} TablesCreateRelationshipColumnRequestParams
986
+ * @property {string} databaseId Database ID.
987
+ * @property {string} tableId Table ID.
988
+ * @property {string} relatedTableId Related Table ID.
989
+ * @property {RelationshipType} type Relation type
990
+ * @property {boolean} twoWay Is Two Way?
991
+ * @property {string} key Column Key.
992
+ * @property {string} twoWayKey Two Way Column Key.
993
+ * @property {RelationMutate} onDelete Constraints option
994
+ * @property {boolean} overrideForCli
995
+ * @property {boolean} parseOutput
996
+ * @property {libClient | undefined} sdk
997
+ */
998
+
999
+ /**
1000
+ * @param {TablesCreateRelationshipColumnRequestParams} params
1001
+ */
1002
+ const tablesCreateRelationshipColumn = async ({databaseId,tableId,relatedTableId,type,twoWay,key,twoWayKey,onDelete,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1003
+ let client = !sdk ? await sdkForProject() :
1004
+ sdk;
1005
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/relationship'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
1006
+ let payload = {};
1007
+ if (typeof relatedTableId !== 'undefined') {
1008
+ payload['relatedTableId'] = relatedTableId;
1009
+ }
1010
+ if (typeof type !== 'undefined') {
1011
+ payload['type'] = type;
1012
+ }
1013
+ if (typeof twoWay !== 'undefined') {
1014
+ payload['twoWay'] = twoWay;
1015
+ }
1016
+ if (typeof key !== 'undefined') {
1017
+ payload['key'] = key;
1018
+ }
1019
+ if (typeof twoWayKey !== 'undefined') {
1020
+ payload['twoWayKey'] = twoWayKey;
1021
+ }
1022
+ if (typeof onDelete !== 'undefined') {
1023
+ payload['onDelete'] = onDelete;
1024
+ }
1025
+
1026
+ let response = undefined;
1027
+
1028
+ response = await client.call('post', apiPath, {
1029
+ 'content-type': 'application/json',
1030
+ }, payload);
1031
+
1032
+ if (parseOutput) {
1033
+ parse(response)
1034
+ }
1035
+
1036
+ return response;
1037
+
1038
+ }
1039
+
1040
+ /**
1041
+ * @typedef {Object} TablesCreateStringColumnRequestParams
1042
+ * @property {string} databaseId Database ID.
1043
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).
1044
+ * @property {string} key Column Key.
1045
+ * @property {number} size Attribute size for text attributes, in number of characters.
1046
+ * @property {boolean} required Is column required?
1047
+ * @property {string} xdefault Default value for column when not provided. Cannot be set when column is required.
1048
+ * @property {boolean} array Is column an array?
1049
+ * @property {boolean} encrypt Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried.
1050
+ * @property {boolean} overrideForCli
1051
+ * @property {boolean} parseOutput
1052
+ * @property {libClient | undefined} sdk
1053
+ */
1054
+
1055
+ /**
1056
+ * @param {TablesCreateStringColumnRequestParams} params
1057
+ */
1058
+ const tablesCreateStringColumn = async ({databaseId,tableId,key,size,required,xdefault,array,encrypt,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1059
+ let client = !sdk ? await sdkForProject() :
1060
+ sdk;
1061
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/string'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
1062
+ let payload = {};
1063
+ if (typeof key !== 'undefined') {
1064
+ payload['key'] = key;
1065
+ }
1066
+ if (typeof size !== 'undefined') {
1067
+ payload['size'] = size;
1068
+ }
1069
+ if (typeof required !== 'undefined') {
1070
+ payload['required'] = required;
1071
+ }
1072
+ if (typeof xdefault !== 'undefined') {
1073
+ payload['default'] = xdefault;
1074
+ }
1075
+ if (typeof array !== 'undefined') {
1076
+ payload['array'] = array;
1077
+ }
1078
+ if (typeof encrypt !== 'undefined') {
1079
+ payload['encrypt'] = encrypt;
1080
+ }
1081
+
1082
+ let response = undefined;
1083
+
1084
+ response = await client.call('post', apiPath, {
1085
+ 'content-type': 'application/json',
1086
+ }, payload);
1087
+
1088
+ if (parseOutput) {
1089
+ parse(response)
1090
+ }
1091
+
1092
+ return response;
1093
+
1094
+ }
1095
+
1096
+ /**
1097
+ * @typedef {Object} TablesUpdateStringColumnRequestParams
1098
+ * @property {string} databaseId Database ID.
1099
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).
1100
+ * @property {string} key Column Key.
1101
+ * @property {boolean} required Is column required?
1102
+ * @property {string} xdefault Default value for column when not provided. Cannot be set when column is required.
1103
+ * @property {number} size Maximum size of the string column.
1104
+ * @property {string} newKey New Column Key.
1105
+ * @property {boolean} overrideForCli
1106
+ * @property {boolean} parseOutput
1107
+ * @property {libClient | undefined} sdk
1108
+ */
1109
+
1110
+ /**
1111
+ * @param {TablesUpdateStringColumnRequestParams} params
1112
+ */
1113
+ const tablesUpdateStringColumn = async ({databaseId,tableId,key,required,xdefault,size,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1114
+ let client = !sdk ? await sdkForProject() :
1115
+ sdk;
1116
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/string/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key);
1117
+ let payload = {};
1118
+ if (typeof required !== 'undefined') {
1119
+ payload['required'] = required;
1120
+ }
1121
+ if (typeof xdefault !== 'undefined') {
1122
+ payload['default'] = xdefault;
1123
+ }
1124
+ if (typeof size !== 'undefined') {
1125
+ payload['size'] = size;
1126
+ }
1127
+ if (typeof newKey !== 'undefined') {
1128
+ payload['newKey'] = newKey;
1129
+ }
1130
+
1131
+ let response = undefined;
1132
+
1133
+ response = await client.call('patch', apiPath, {
1134
+ 'content-type': 'application/json',
1135
+ }, payload);
1136
+
1137
+ if (parseOutput) {
1138
+ parse(response)
1139
+ }
1140
+
1141
+ return response;
1142
+
1143
+ }
1144
+
1145
+ /**
1146
+ * @typedef {Object} TablesCreateUrlColumnRequestParams
1147
+ * @property {string} databaseId Database ID.
1148
+ * @property {string} tableId Table ID.
1149
+ * @property {string} key Column Key.
1150
+ * @property {boolean} required Is column required?
1151
+ * @property {string} xdefault Default value for column when not provided. Cannot be set when column is required.
1152
+ * @property {boolean} array Is column an array?
1153
+ * @property {boolean} overrideForCli
1154
+ * @property {boolean} parseOutput
1155
+ * @property {libClient | undefined} sdk
1156
+ */
1157
+
1158
+ /**
1159
+ * @param {TablesCreateUrlColumnRequestParams} params
1160
+ */
1161
+ const tablesCreateUrlColumn = async ({databaseId,tableId,key,required,xdefault,array,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1162
+ let client = !sdk ? await sdkForProject() :
1163
+ sdk;
1164
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/url'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
1165
+ let payload = {};
1166
+ if (typeof key !== 'undefined') {
1167
+ payload['key'] = key;
1168
+ }
1169
+ if (typeof required !== 'undefined') {
1170
+ payload['required'] = required;
1171
+ }
1172
+ if (typeof xdefault !== 'undefined') {
1173
+ payload['default'] = xdefault;
1174
+ }
1175
+ if (typeof array !== 'undefined') {
1176
+ payload['array'] = array;
1177
+ }
1178
+
1179
+ let response = undefined;
1180
+
1181
+ response = await client.call('post', apiPath, {
1182
+ 'content-type': 'application/json',
1183
+ }, payload);
1184
+
1185
+ if (parseOutput) {
1186
+ parse(response)
1187
+ }
1188
+
1189
+ return response;
1190
+
1191
+ }
1192
+
1193
+ /**
1194
+ * @typedef {Object} TablesUpdateUrlColumnRequestParams
1195
+ * @property {string} databaseId Database ID.
1196
+ * @property {string} tableId Table ID.
1197
+ * @property {string} key Column Key.
1198
+ * @property {boolean} required Is column required?
1199
+ * @property {string} xdefault Default value for column when not provided. Cannot be set when column is required.
1200
+ * @property {string} newKey New Column Key.
1201
+ * @property {boolean} overrideForCli
1202
+ * @property {boolean} parseOutput
1203
+ * @property {libClient | undefined} sdk
1204
+ */
1205
+
1206
+ /**
1207
+ * @param {TablesUpdateUrlColumnRequestParams} params
1208
+ */
1209
+ const tablesUpdateUrlColumn = async ({databaseId,tableId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1210
+ let client = !sdk ? await sdkForProject() :
1211
+ sdk;
1212
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/url/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key);
1213
+ let payload = {};
1214
+ if (typeof required !== 'undefined') {
1215
+ payload['required'] = required;
1216
+ }
1217
+ if (typeof xdefault !== 'undefined') {
1218
+ payload['default'] = xdefault;
1219
+ }
1220
+ if (typeof newKey !== 'undefined') {
1221
+ payload['newKey'] = newKey;
1222
+ }
1223
+
1224
+ let response = undefined;
1225
+
1226
+ response = await client.call('patch', apiPath, {
1227
+ 'content-type': 'application/json',
1228
+ }, payload);
1229
+
1230
+ if (parseOutput) {
1231
+ parse(response)
1232
+ }
1233
+
1234
+ return response;
1235
+
1236
+ }
1237
+
1238
+ /**
1239
+ * @typedef {Object} TablesGetColumnRequestParams
1240
+ * @property {string} databaseId Database ID.
1241
+ * @property {string} tableId Table ID.
1242
+ * @property {string} key Column Key.
1243
+ * @property {boolean} overrideForCli
1244
+ * @property {boolean} parseOutput
1245
+ * @property {libClient | undefined} sdk
1246
+ */
1247
+
1248
+ /**
1249
+ * @param {TablesGetColumnRequestParams} params
1250
+ */
1251
+ const tablesGetColumn = async ({databaseId,tableId,key,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
1252
+ let client = !sdk ? await sdkForProject() :
1253
+ sdk;
1254
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key);
1255
+ let payload = {};
1256
+
1257
+ let response = undefined;
1258
+
1259
+ response = await client.call('get', apiPath, {
1260
+ }, payload);
1261
+
1262
+ if (parseOutput) {
1263
+ if(console) {
1264
+ showConsoleLink('tables', 'getColumn', databaseId, tableId);
1265
+ } else {
1266
+ parse(response)
1267
+ }
1268
+ }
1269
+
1270
+ return response;
1271
+
1272
+ }
1273
+
1274
+ /**
1275
+ * @typedef {Object} TablesDeleteColumnRequestParams
1276
+ * @property {string} databaseId Database ID.
1277
+ * @property {string} tableId Table ID.
1278
+ * @property {string} key Column Key.
1279
+ * @property {boolean} overrideForCli
1280
+ * @property {boolean} parseOutput
1281
+ * @property {libClient | undefined} sdk
1282
+ */
1283
+
1284
+ /**
1285
+ * @param {TablesDeleteColumnRequestParams} params
1286
+ */
1287
+ const tablesDeleteColumn = async ({databaseId,tableId,key,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1288
+ let client = !sdk ? await sdkForProject() :
1289
+ sdk;
1290
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key);
1291
+ let payload = {};
1292
+
1293
+ let response = undefined;
1294
+
1295
+ response = await client.call('delete', apiPath, {
1296
+ 'content-type': 'application/json',
1297
+ }, payload);
1298
+
1299
+ if (parseOutput) {
1300
+ parse(response)
1301
+ }
1302
+
1303
+ return response;
1304
+
1305
+ }
1306
+
1307
+ /**
1308
+ * @typedef {Object} TablesUpdateRelationshipColumnRequestParams
1309
+ * @property {string} databaseId Database ID.
1310
+ * @property {string} tableId Table ID.
1311
+ * @property {string} key Column Key.
1312
+ * @property {RelationMutate} onDelete Constraints option
1313
+ * @property {string} newKey New Column Key.
1314
+ * @property {boolean} overrideForCli
1315
+ * @property {boolean} parseOutput
1316
+ * @property {libClient | undefined} sdk
1317
+ */
1318
+
1319
+ /**
1320
+ * @param {TablesUpdateRelationshipColumnRequestParams} params
1321
+ */
1322
+ const tablesUpdateRelationshipColumn = async ({databaseId,tableId,key,onDelete,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1323
+ let client = !sdk ? await sdkForProject() :
1324
+ sdk;
1325
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/columns/{key}/relationship'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key);
1326
+ let payload = {};
1327
+ if (typeof onDelete !== 'undefined') {
1328
+ payload['onDelete'] = onDelete;
1329
+ }
1330
+ if (typeof newKey !== 'undefined') {
1331
+ payload['newKey'] = newKey;
1332
+ }
1333
+
1334
+ let response = undefined;
1335
+
1336
+ response = await client.call('patch', apiPath, {
1337
+ 'content-type': 'application/json',
1338
+ }, payload);
1339
+
1340
+ if (parseOutput) {
1341
+ parse(response)
1342
+ }
1343
+
1344
+ return response;
1345
+
1346
+ }
1347
+
1348
+ /**
1349
+ * @typedef {Object} TablesListIndexesRequestParams
1350
+ * @property {string} databaseId Database ID.
1351
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).
1352
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error
1353
+ * @property {boolean} overrideForCli
1354
+ * @property {boolean} parseOutput
1355
+ * @property {libClient | undefined} sdk
1356
+ */
1357
+
1358
+ /**
1359
+ * @param {TablesListIndexesRequestParams} params
1360
+ */
1361
+ const tablesListIndexes = async ({databaseId,tableId,queries,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
1362
+ let client = !sdk ? await sdkForProject() :
1363
+ sdk;
1364
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
1365
+ let payload = {};
1366
+ if (typeof queries !== 'undefined') {
1367
+ payload['queries'] = queries;
1368
+ }
1369
+
1370
+ let response = undefined;
1371
+
1372
+ response = await client.call('get', apiPath, {
1373
+ }, payload);
1374
+
1375
+ if (parseOutput) {
1376
+ if(console) {
1377
+ showConsoleLink('tables', 'listIndexes', databaseId, tableId);
1378
+ } else {
1379
+ parse(response)
1380
+ }
1381
+ }
1382
+
1383
+ return response;
1384
+
1385
+ }
1386
+
1387
+ /**
1388
+ * @typedef {Object} TablesCreateIndexRequestParams
1389
+ * @property {string} databaseId Database ID.
1390
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).
1391
+ * @property {string} key Index Key.
1392
+ * @property {IndexType} type Index type.
1393
+ * @property {string[]} columns Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long.
1394
+ * @property {string[]} orders Array of index orders. Maximum of 100 orders are allowed.
1395
+ * @property {number[]} lengths Length of index. Maximum of 100
1396
+ * @property {boolean} overrideForCli
1397
+ * @property {boolean} parseOutput
1398
+ * @property {libClient | undefined} sdk
1399
+ */
1400
+
1401
+ /**
1402
+ * @param {TablesCreateIndexRequestParams} params
1403
+ */
1404
+ const tablesCreateIndex = async ({databaseId,tableId,key,type,columns,orders,lengths,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1405
+ let client = !sdk ? await sdkForProject() :
1406
+ sdk;
1407
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
1408
+ let payload = {};
1409
+ if (typeof key !== 'undefined') {
1410
+ payload['key'] = key;
1411
+ }
1412
+ if (typeof type !== 'undefined') {
1413
+ payload['type'] = type;
1414
+ }
1415
+ columns = columns === true ? [] : columns;
1416
+ if (typeof columns !== 'undefined') {
1417
+ payload['columns'] = columns;
1418
+ }
1419
+ orders = orders === true ? [] : orders;
1420
+ if (typeof orders !== 'undefined') {
1421
+ payload['orders'] = orders;
1422
+ }
1423
+ lengths = lengths === true ? [] : lengths;
1424
+ if (typeof lengths !== 'undefined') {
1425
+ payload['lengths'] = lengths;
1426
+ }
1427
+
1428
+ let response = undefined;
1429
+
1430
+ response = await client.call('post', apiPath, {
1431
+ 'content-type': 'application/json',
1432
+ }, payload);
1433
+
1434
+ if (parseOutput) {
1435
+ parse(response)
1436
+ }
1437
+
1438
+ return response;
1439
+
1440
+ }
1441
+
1442
+ /**
1443
+ * @typedef {Object} TablesGetIndexRequestParams
1444
+ * @property {string} databaseId Database ID.
1445
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).
1446
+ * @property {string} key Index Key.
1447
+ * @property {boolean} overrideForCli
1448
+ * @property {boolean} parseOutput
1449
+ * @property {libClient | undefined} sdk
1450
+ */
1451
+
1452
+ /**
1453
+ * @param {TablesGetIndexRequestParams} params
1454
+ */
1455
+ const tablesGetIndex = async ({databaseId,tableId,key,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1456
+ let client = !sdk ? await sdkForProject() :
1457
+ sdk;
1458
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key);
1459
+ let payload = {};
1460
+
1461
+ let response = undefined;
1462
+
1463
+ response = await client.call('get', apiPath, {
1464
+ }, payload);
1465
+
1466
+ if (parseOutput) {
1467
+ parse(response)
1468
+ }
1469
+
1470
+ return response;
1471
+
1472
+ }
1473
+
1474
+ /**
1475
+ * @typedef {Object} TablesDeleteIndexRequestParams
1476
+ * @property {string} databaseId Database ID.
1477
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).
1478
+ * @property {string} key Index Key.
1479
+ * @property {boolean} overrideForCli
1480
+ * @property {boolean} parseOutput
1481
+ * @property {libClient | undefined} sdk
1482
+ */
1483
+
1484
+ /**
1485
+ * @param {TablesDeleteIndexRequestParams} params
1486
+ */
1487
+ const tablesDeleteIndex = async ({databaseId,tableId,key,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1488
+ let client = !sdk ? await sdkForProject() :
1489
+ sdk;
1490
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key);
1491
+ let payload = {};
1492
+
1493
+ let response = undefined;
1494
+
1495
+ response = await client.call('delete', apiPath, {
1496
+ 'content-type': 'application/json',
1497
+ }, payload);
1498
+
1499
+ if (parseOutput) {
1500
+ parse(response)
1501
+ }
1502
+
1503
+ return response;
1504
+
1505
+ }
1506
+
1507
+ /**
1508
+ * @typedef {Object} TablesListLogsRequestParams
1509
+ * @property {string} databaseId Database ID.
1510
+ * @property {string} tableId Table ID.
1511
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
1512
+ * @property {boolean} overrideForCli
1513
+ * @property {boolean} parseOutput
1514
+ * @property {libClient | undefined} sdk
1515
+ */
1516
+
1517
+ /**
1518
+ * @param {TablesListLogsRequestParams} params
1519
+ */
1520
+ const tablesListLogs = async ({databaseId,tableId,queries,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1521
+ let client = !sdk ? await sdkForProject() :
1522
+ sdk;
1523
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/logs'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
1524
+ let payload = {};
1525
+ if (typeof queries !== 'undefined') {
1526
+ payload['queries'] = queries;
1527
+ }
1528
+
1529
+ let response = undefined;
1530
+
1531
+ response = await client.call('get', apiPath, {
1532
+ }, payload);
1533
+
1534
+ if (parseOutput) {
1535
+ parse(response)
1536
+ }
1537
+
1538
+ return response;
1539
+
1540
+ }
1541
+
1542
+ /**
1543
+ * @typedef {Object} TablesListRowsRequestParams
1544
+ * @property {string} databaseId Database ID.
1545
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).
1546
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
1547
+ * @property {boolean} overrideForCli
1548
+ * @property {boolean} parseOutput
1549
+ * @property {libClient | undefined} sdk
1550
+ */
1551
+
1552
+ /**
1553
+ * @param {TablesListRowsRequestParams} params
1554
+ */
1555
+ const tablesListRows = async ({databaseId,tableId,queries,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
1556
+ let client = !sdk ? await sdkForProject() :
1557
+ sdk;
1558
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
1559
+ let payload = {};
1560
+ if (typeof queries !== 'undefined') {
1561
+ payload['queries'] = queries;
1562
+ }
1563
+
1564
+ let response = undefined;
1565
+
1566
+ response = await client.call('get', apiPath, {
1567
+ }, payload);
1568
+
1569
+ if (parseOutput) {
1570
+ if(console) {
1571
+ showConsoleLink('tables', 'listRows', databaseId, tableId);
1572
+ } else {
1573
+ parse(response)
1574
+ }
1575
+ }
1576
+
1577
+ return response;
1578
+
1579
+ }
1580
+
1581
+ /**
1582
+ * @typedef {Object} TablesCreateRowRequestParams
1583
+ * @property {string} databaseId Database ID.
1584
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows.
1585
+ * @property {string} rowId Row ID. Choose a custom ID or generate a random ID with 'ID.unique()'. 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.
1586
+ * @property {object} data Row data as JSON object.
1587
+ * @property {string[]} permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
1588
+ * @property {boolean} overrideForCli
1589
+ * @property {boolean} parseOutput
1590
+ * @property {libClient | undefined} sdk
1591
+ */
1592
+
1593
+ /**
1594
+ * @param {TablesCreateRowRequestParams} params
1595
+ */
1596
+ const tablesCreateRow = async ({databaseId,tableId,rowId,data,permissions,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1597
+ let client = !sdk ? await sdkForProject() :
1598
+ sdk;
1599
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
1600
+ let payload = {};
1601
+ if (typeof rowId !== 'undefined') {
1602
+ payload['rowId'] = rowId;
1603
+ }
1604
+ if (typeof data !== 'undefined') {
1605
+ payload['data'] = JSON.parse(data);
1606
+ }
1607
+ permissions = permissions === true ? [] : permissions;
1608
+ if (typeof permissions !== 'undefined') {
1609
+ payload['permissions'] = permissions;
1610
+ }
1611
+
1612
+ let response = undefined;
1613
+
1614
+ response = await client.call('post', apiPath, {
1615
+ 'content-type': 'application/json',
1616
+ }, payload);
1617
+
1618
+ if (parseOutput) {
1619
+ parse(response)
1620
+ }
1621
+
1622
+ return response;
1623
+
1624
+ }
1625
+
1626
+ /**
1627
+ * @typedef {Object} TablesCreateRowsRequestParams
1628
+ * @property {string} databaseId Database ID.
1629
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows.
1630
+ * @property {object[]} rows Array of documents data as JSON objects.
1631
+ * @property {boolean} overrideForCli
1632
+ * @property {boolean} parseOutput
1633
+ * @property {libClient | undefined} sdk
1634
+ */
1635
+
1636
+ /**
1637
+ * @param {TablesCreateRowsRequestParams} params
1638
+ */
1639
+ const tablesCreateRows = async ({databaseId,tableId,rows,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1640
+ let client = !sdk ? await sdkForProject() :
1641
+ sdk;
1642
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
1643
+ let payload = {};
1644
+ rows = rows === true ? [] : rows;
1645
+ if (typeof rows !== 'undefined') {
1646
+ payload['rows'] = rows;
1647
+ }
1648
+
1649
+ let response = undefined;
1650
+
1651
+ response = await client.call('post', apiPath, {
1652
+ 'content-type': 'application/json',
1653
+ }, payload);
1654
+
1655
+ if (parseOutput) {
1656
+ parse(response)
1657
+ }
1658
+
1659
+ return response;
1660
+
1661
+ }
1662
+
1663
+ /**
1664
+ * @typedef {Object} TablesUpsertRowsRequestParams
1665
+ * @property {string} databaseId Database ID.
1666
+ * @property {string} tableId Table ID.
1667
+ * @property {boolean} overrideForCli
1668
+ * @property {boolean} parseOutput
1669
+ * @property {libClient | undefined} sdk
1670
+ */
1671
+
1672
+ /**
1673
+ * @param {TablesUpsertRowsRequestParams} params
1674
+ */
1675
+ const tablesUpsertRows = async ({databaseId,tableId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1676
+ let client = !sdk ? await sdkForProject() :
1677
+ sdk;
1678
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
1679
+ let payload = {};
1680
+
1681
+ let response = undefined;
1682
+
1683
+ response = await client.call('put', apiPath, {
1684
+ 'content-type': 'application/json',
1685
+ }, payload);
1686
+
1687
+ if (parseOutput) {
1688
+ parse(response)
1689
+ }
1690
+
1691
+ return response;
1692
+
1693
+ }
1694
+
1695
+ /**
1696
+ * @typedef {Object} TablesUpdateRowsRequestParams
1697
+ * @property {string} databaseId Database ID.
1698
+ * @property {string} tableId Table ID.
1699
+ * @property {object} data Row data as JSON object. Include only column and value pairs to be updated.
1700
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
1701
+ * @property {boolean} overrideForCli
1702
+ * @property {boolean} parseOutput
1703
+ * @property {libClient | undefined} sdk
1704
+ */
1705
+
1706
+ /**
1707
+ * @param {TablesUpdateRowsRequestParams} params
1708
+ */
1709
+ const tablesUpdateRows = async ({databaseId,tableId,data,queries,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1710
+ let client = !sdk ? await sdkForProject() :
1711
+ sdk;
1712
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
1713
+ let payload = {};
1714
+ if (typeof data !== 'undefined') {
1715
+ payload['data'] = JSON.parse(data);
1716
+ }
1717
+ queries = queries === true ? [] : queries;
1718
+ if (typeof queries !== 'undefined') {
1719
+ payload['queries'] = queries;
1720
+ }
1721
+
1722
+ let response = undefined;
1723
+
1724
+ response = await client.call('patch', apiPath, {
1725
+ 'content-type': 'application/json',
1726
+ }, payload);
1727
+
1728
+ if (parseOutput) {
1729
+ parse(response)
1730
+ }
1731
+
1732
+ return response;
1733
+
1734
+ }
1735
+
1736
+ /**
1737
+ * @typedef {Object} TablesDeleteRowsRequestParams
1738
+ * @property {string} databaseId Database ID.
1739
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).
1740
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
1741
+ * @property {boolean} overrideForCli
1742
+ * @property {boolean} parseOutput
1743
+ * @property {libClient | undefined} sdk
1744
+ */
1745
+
1746
+ /**
1747
+ * @param {TablesDeleteRowsRequestParams} params
1748
+ */
1749
+ const tablesDeleteRows = async ({databaseId,tableId,queries,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1750
+ let client = !sdk ? await sdkForProject() :
1751
+ sdk;
1752
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
1753
+ let payload = {};
1754
+ queries = queries === true ? [] : queries;
1755
+ if (typeof queries !== 'undefined') {
1756
+ payload['queries'] = queries;
1757
+ }
1758
+
1759
+ let response = undefined;
1760
+
1761
+ response = await client.call('delete', apiPath, {
1762
+ 'content-type': 'application/json',
1763
+ }, payload);
1764
+
1765
+ if (parseOutput) {
1766
+ parse(response)
1767
+ }
1768
+
1769
+ return response;
1770
+
1771
+ }
1772
+
1773
+ /**
1774
+ * @typedef {Object} TablesGetRowRequestParams
1775
+ * @property {string} databaseId Database ID.
1776
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).
1777
+ * @property {string} rowId Row ID.
1778
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
1779
+ * @property {boolean} overrideForCli
1780
+ * @property {boolean} parseOutput
1781
+ * @property {libClient | undefined} sdk
1782
+ */
1783
+
1784
+ /**
1785
+ * @param {TablesGetRowRequestParams} params
1786
+ */
1787
+ const tablesGetRow = async ({databaseId,tableId,rowId,queries,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
1788
+ let client = !sdk ? await sdkForProject() :
1789
+ sdk;
1790
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
1791
+ let payload = {};
1792
+ if (typeof queries !== 'undefined') {
1793
+ payload['queries'] = queries;
1794
+ }
1795
+
1796
+ let response = undefined;
1797
+
1798
+ response = await client.call('get', apiPath, {
1799
+ }, payload);
1800
+
1801
+ if (parseOutput) {
1802
+ if(console) {
1803
+ showConsoleLink('tables', 'getRow', databaseId, tableId, rowId);
1804
+ } else {
1805
+ parse(response)
1806
+ }
1807
+ }
1808
+
1809
+ return response;
1810
+
1811
+ }
1812
+
1813
+ /**
1814
+ * @typedef {Object} TablesUpsertRowRequestParams
1815
+ * @property {string} databaseId Database ID.
1816
+ * @property {string} tableId Table ID.
1817
+ * @property {string} rowId Row ID.
1818
+ * @property {boolean} overrideForCli
1819
+ * @property {boolean} parseOutput
1820
+ * @property {libClient | undefined} sdk
1821
+ */
1822
+
1823
+ /**
1824
+ * @param {TablesUpsertRowRequestParams} params
1825
+ */
1826
+ const tablesUpsertRow = async ({databaseId,tableId,rowId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1827
+ let client = !sdk ? await sdkForProject() :
1828
+ sdk;
1829
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
1830
+ let payload = {};
1831
+
1832
+ let response = undefined;
1833
+
1834
+ response = await client.call('put', apiPath, {
1835
+ 'content-type': 'application/json',
1836
+ }, payload);
1837
+
1838
+ if (parseOutput) {
1839
+ parse(response)
1840
+ }
1841
+
1842
+ return response;
1843
+
1844
+ }
1845
+
1846
+ /**
1847
+ * @typedef {Object} TablesUpdateRowRequestParams
1848
+ * @property {string} databaseId Database ID.
1849
+ * @property {string} tableId Table ID.
1850
+ * @property {string} rowId Row ID.
1851
+ * @property {object} data Row data as JSON object. Include only columns and value pairs to be updated.
1852
+ * @property {string[]} permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
1853
+ * @property {boolean} overrideForCli
1854
+ * @property {boolean} parseOutput
1855
+ * @property {libClient | undefined} sdk
1856
+ */
1857
+
1858
+ /**
1859
+ * @param {TablesUpdateRowRequestParams} params
1860
+ */
1861
+ const tablesUpdateRow = async ({databaseId,tableId,rowId,data,permissions,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1862
+ let client = !sdk ? await sdkForProject() :
1863
+ sdk;
1864
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
1865
+ let payload = {};
1866
+ if (typeof data !== 'undefined') {
1867
+ payload['data'] = JSON.parse(data);
1868
+ }
1869
+ permissions = permissions === true ? [] : permissions;
1870
+ if (typeof permissions !== 'undefined') {
1871
+ payload['permissions'] = permissions;
1872
+ }
1873
+
1874
+ let response = undefined;
1875
+
1876
+ response = await client.call('patch', apiPath, {
1877
+ 'content-type': 'application/json',
1878
+ }, payload);
1879
+
1880
+ if (parseOutput) {
1881
+ parse(response)
1882
+ }
1883
+
1884
+ return response;
1885
+
1886
+ }
1887
+
1888
+ /**
1889
+ * @typedef {Object} TablesDeleteRowRequestParams
1890
+ * @property {string} databaseId Database ID.
1891
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).
1892
+ * @property {string} rowId Row ID.
1893
+ * @property {boolean} overrideForCli
1894
+ * @property {boolean} parseOutput
1895
+ * @property {libClient | undefined} sdk
1896
+ */
1897
+
1898
+ /**
1899
+ * @param {TablesDeleteRowRequestParams} params
1900
+ */
1901
+ const tablesDeleteRow = async ({databaseId,tableId,rowId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1902
+ let client = !sdk ? await sdkForProject() :
1903
+ sdk;
1904
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
1905
+ let payload = {};
1906
+
1907
+ let response = undefined;
1908
+
1909
+ response = await client.call('delete', apiPath, {
1910
+ 'content-type': 'application/json',
1911
+ }, payload);
1912
+
1913
+ if (parseOutput) {
1914
+ parse(response)
1915
+ }
1916
+
1917
+ return response;
1918
+
1919
+ }
1920
+
1921
+ /**
1922
+ * @typedef {Object} TablesListRowLogsRequestParams
1923
+ * @property {string} databaseId Database ID.
1924
+ * @property {string} tableId Table ID.
1925
+ * @property {string} rowId Row ID.
1926
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
1927
+ * @property {boolean} overrideForCli
1928
+ * @property {boolean} parseOutput
1929
+ * @property {libClient | undefined} sdk
1930
+ */
1931
+
1932
+ /**
1933
+ * @param {TablesListRowLogsRequestParams} params
1934
+ */
1935
+ const tablesListRowLogs = async ({databaseId,tableId,rowId,queries,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
1936
+ let client = !sdk ? await sdkForProject() :
1937
+ sdk;
1938
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}/logs'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
1939
+ let payload = {};
1940
+ if (typeof queries !== 'undefined') {
1941
+ payload['queries'] = queries;
1942
+ }
1943
+
1944
+ let response = undefined;
1945
+
1946
+ response = await client.call('get', apiPath, {
1947
+ }, payload);
1948
+
1949
+ if (parseOutput) {
1950
+ if(console) {
1951
+ showConsoleLink('tables', 'listRowLogs', databaseId, tableId, rowId);
1952
+ } else {
1953
+ parse(response)
1954
+ }
1955
+ }
1956
+
1957
+ return response;
1958
+
1959
+ }
1960
+
1961
+ /**
1962
+ * @typedef {Object} TablesDecrementRowColumnRequestParams
1963
+ * @property {string} databaseId Database ID.
1964
+ * @property {string} tableId Table ID.
1965
+ * @property {string} rowId Row ID.
1966
+ * @property {string} column Column key.
1967
+ * @property {number} value Value to increment the column by. The value must be a number.
1968
+ * @property {number} min Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.
1969
+ * @property {boolean} overrideForCli
1970
+ * @property {boolean} parseOutput
1971
+ * @property {libClient | undefined} sdk
1972
+ */
1973
+
1974
+ /**
1975
+ * @param {TablesDecrementRowColumnRequestParams} params
1976
+ */
1977
+ const tablesDecrementRowColumn = async ({databaseId,tableId,rowId,column,value,min,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1978
+ let client = !sdk ? await sdkForProject() :
1979
+ sdk;
1980
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column);
1981
+ let payload = {};
1982
+ if (typeof value !== 'undefined') {
1983
+ payload['value'] = value;
1984
+ }
1985
+ if (typeof min !== 'undefined') {
1986
+ payload['min'] = min;
1987
+ }
1988
+
1989
+ let response = undefined;
1990
+
1991
+ response = await client.call('patch', apiPath, {
1992
+ 'content-type': 'application/json',
1993
+ }, payload);
1994
+
1995
+ if (parseOutput) {
1996
+ parse(response)
1997
+ }
1998
+
1999
+ return response;
2000
+
2001
+ }
2002
+
2003
+ /**
2004
+ * @typedef {Object} TablesIncrementRowColumnRequestParams
2005
+ * @property {string} databaseId Database ID.
2006
+ * @property {string} tableId Table ID.
2007
+ * @property {string} rowId Row ID.
2008
+ * @property {string} column Column key.
2009
+ * @property {number} value Value to increment the column by. The value must be a number.
2010
+ * @property {number} max Maximum value for the column. If the current value is greater than this value, an error will be thrown.
2011
+ * @property {boolean} overrideForCli
2012
+ * @property {boolean} parseOutput
2013
+ * @property {libClient | undefined} sdk
2014
+ */
2015
+
2016
+ /**
2017
+ * @param {TablesIncrementRowColumnRequestParams} params
2018
+ */
2019
+ const tablesIncrementRowColumn = async ({databaseId,tableId,rowId,column,value,max,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2020
+ let client = !sdk ? await sdkForProject() :
2021
+ sdk;
2022
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column);
2023
+ let payload = {};
2024
+ if (typeof value !== 'undefined') {
2025
+ payload['value'] = value;
2026
+ }
2027
+ if (typeof max !== 'undefined') {
2028
+ payload['max'] = max;
2029
+ }
2030
+
2031
+ let response = undefined;
2032
+
2033
+ response = await client.call('patch', apiPath, {
2034
+ 'content-type': 'application/json',
2035
+ }, payload);
2036
+
2037
+ if (parseOutput) {
2038
+ parse(response)
2039
+ }
2040
+
2041
+ return response;
2042
+
2043
+ }
2044
+
2045
+ /**
2046
+ * @typedef {Object} TablesGetUsageRequestParams
2047
+ * @property {string} databaseId Database ID.
2048
+ * @property {string} tableId Table ID.
2049
+ * @property {DatabaseUsageRange} range Date range.
2050
+ * @property {boolean} overrideForCli
2051
+ * @property {boolean} parseOutput
2052
+ * @property {libClient | undefined} sdk
2053
+ */
2054
+
2055
+ /**
2056
+ * @param {TablesGetUsageRequestParams} params
2057
+ */
2058
+ const tablesGetUsage = async ({databaseId,tableId,range,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2059
+ let client = !sdk ? await sdkForProject() :
2060
+ sdk;
2061
+ let apiPath = '/databases/{databaseId}/tables/{tableId}/usage'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
2062
+ let payload = {};
2063
+ if (typeof range !== 'undefined') {
2064
+ payload['range'] = range;
2065
+ }
2066
+
2067
+ let response = undefined;
2068
+
2069
+ response = await client.call('get', apiPath, {
2070
+ }, payload);
2071
+
2072
+ if (parseOutput) {
2073
+ parse(response)
2074
+ }
2075
+
2076
+ return response;
2077
+
2078
+ }
2079
+
2080
+ tables
2081
+ .command(`list`)
2082
+ .description(`Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results.`)
2083
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2084
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, rowSecurity`)
2085
+ .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
2086
+ .option(`--console`, `Get the resource console url`)
2087
+ .action(actionRunner(tablesList))
2088
+
2089
+ tables
2090
+ .command(`create`)
2091
+ .description(`Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console.`)
2092
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2093
+ .requiredOption(`--table-id <table-id>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. 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.`)
2094
+ .requiredOption(`--name <name>`, `Table name. Max length: 128 chars.`)
2095
+ .option(`--permissions [permissions...]`, `An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
2096
+ .option(`--row-security [value]`, `Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions).`, (value) => value === undefined ? true : parseBool(value))
2097
+ .option(`--enabled [value]`, `Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled.`, (value) => value === undefined ? true : parseBool(value))
2098
+ .action(actionRunner(tablesCreate))
2099
+
2100
+ tables
2101
+ .command(`get`)
2102
+ .description(`Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata.`)
2103
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2104
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2105
+ .option(`--console`, `Get the resource console url`)
2106
+ .action(actionRunner(tablesGet))
2107
+
2108
+ tables
2109
+ .command(`update`)
2110
+ .description(`Update a table by its unique ID.`)
2111
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2112
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2113
+ .requiredOption(`--name <name>`, `Table name. Max length: 128 chars.`)
2114
+ .option(`--permissions [permissions...]`, `An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
2115
+ .option(`--row-security [value]`, `Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).`, (value) => value === undefined ? true : parseBool(value))
2116
+ .option(`--enabled [value]`, `Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled.`, (value) => value === undefined ? true : parseBool(value))
2117
+ .action(actionRunner(tablesUpdate))
2118
+
2119
+ tables
2120
+ .command(`delete`)
2121
+ .description(`Delete a table by its unique ID. Only users with write permissions have access to delete this resource.`)
2122
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2123
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2124
+ .action(actionRunner(tablesDelete))
2125
+
2126
+ tables
2127
+ .command(`list-columns`)
2128
+ .description(`List attributes in the collection.`)
2129
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2130
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2131
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error`)
2132
+ .option(`--console`, `Get the resource console url`)
2133
+ .action(actionRunner(tablesListColumns))
2134
+
2135
+ tables
2136
+ .command(`create-boolean-column`)
2137
+ .description(`Create a boolean column. `)
2138
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2139
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).`)
2140
+ .requiredOption(`--key <key>`, `Column Key.`)
2141
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2142
+ .option(`--xdefault [value]`, `Default value for column when not provided. Cannot be set when column is required.`, (value) => value === undefined ? true : parseBool(value))
2143
+ .option(`--array [value]`, `Is column an array?`, (value) => value === undefined ? true : parseBool(value))
2144
+ .action(actionRunner(tablesCreateBooleanColumn))
2145
+
2146
+ tables
2147
+ .command(`update-boolean-column`)
2148
+ .description(`Update a boolean column. Changing the 'default' value will not update already existing rows.`)
2149
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2150
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).`)
2151
+ .requiredOption(`--key <key>`, `Column Key.`)
2152
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2153
+ .option(`--xdefault [value]`, `Default value for column when not provided. Cannot be set when column is required.`, (value) => value === undefined ? true : parseBool(value))
2154
+ .option(`--new-key <new-key>`, `New Column Key.`)
2155
+ .action(actionRunner(tablesUpdateBooleanColumn))
2156
+
2157
+ tables
2158
+ .command(`create-datetime-column`)
2159
+ .description(`Create a date time column according to the ISO 8601 standard.`)
2160
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2161
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2162
+ .requiredOption(`--key <key>`, `Column Key.`)
2163
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2164
+ .option(`--xdefault <xdefault>`, `Default value for the column in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when column is required.`)
2165
+ .option(`--array [value]`, `Is column an array?`, (value) => value === undefined ? true : parseBool(value))
2166
+ .action(actionRunner(tablesCreateDatetimeColumn))
2167
+
2168
+ tables
2169
+ .command(`update-datetime-column`)
2170
+ .description(`Update a date time column. Changing the 'default' value will not update already existing rows.`)
2171
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2172
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2173
+ .requiredOption(`--key <key>`, `Column Key.`)
2174
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2175
+ .option(`--xdefault <xdefault>`, `Default value for column when not provided. Cannot be set when column is required.`)
2176
+ .option(`--new-key <new-key>`, `New Column Key.`)
2177
+ .action(actionRunner(tablesUpdateDatetimeColumn))
2178
+
2179
+ tables
2180
+ .command(`create-email-column`)
2181
+ .description(`Create an email column. `)
2182
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2183
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2184
+ .requiredOption(`--key <key>`, `Column Key.`)
2185
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2186
+ .option(`--xdefault <xdefault>`, `Default value for column when not provided. Cannot be set when column is required.`)
2187
+ .option(`--array [value]`, `Is column an array?`, (value) => value === undefined ? true : parseBool(value))
2188
+ .action(actionRunner(tablesCreateEmailColumn))
2189
+
2190
+ tables
2191
+ .command(`update-email-column`)
2192
+ .description(`Update an email column. Changing the 'default' value will not update already existing rows. `)
2193
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2194
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2195
+ .requiredOption(`--key <key>`, `Column Key.`)
2196
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2197
+ .option(`--xdefault <xdefault>`, `Default value for column when not provided. Cannot be set when column is required.`)
2198
+ .option(`--new-key <new-key>`, `New Column Key.`)
2199
+ .action(actionRunner(tablesUpdateEmailColumn))
2200
+
2201
+ tables
2202
+ .command(`create-enum-column`)
2203
+ .description(`Create an enumeration column. The 'elements' param acts as a white-list of accepted values for this column.`)
2204
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2205
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2206
+ .requiredOption(`--key <key>`, `Column Key.`)
2207
+ .requiredOption(`--elements [elements...]`, `Array of enum values.`)
2208
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2209
+ .option(`--xdefault <xdefault>`, `Default value for column when not provided. Cannot be set when column is required.`)
2210
+ .option(`--array [value]`, `Is column an array?`, (value) => value === undefined ? true : parseBool(value))
2211
+ .action(actionRunner(tablesCreateEnumColumn))
2212
+
2213
+ tables
2214
+ .command(`update-enum-column`)
2215
+ .description(`Update an enum column. Changing the 'default' value will not update already existing rows. `)
2216
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2217
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2218
+ .requiredOption(`--key <key>`, `Column Key.`)
2219
+ .requiredOption(`--elements [elements...]`, `Updated list of enum values.`)
2220
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2221
+ .option(`--xdefault <xdefault>`, `Default value for column when not provided. Cannot be set when column is required.`)
2222
+ .option(`--new-key <new-key>`, `New Column Key.`)
2223
+ .action(actionRunner(tablesUpdateEnumColumn))
2224
+
2225
+ tables
2226
+ .command(`create-float-column`)
2227
+ .description(`Create a float column. Optionally, minimum and maximum values can be provided. `)
2228
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2229
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2230
+ .requiredOption(`--key <key>`, `Column Key.`)
2231
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2232
+ .option(`--min <min>`, `Minimum value`, parseInteger)
2233
+ .option(`--max <max>`, `Maximum value`, parseInteger)
2234
+ .option(`--xdefault <xdefault>`, `Default value. Cannot be set when required.`, parseInteger)
2235
+ .option(`--array [value]`, `Is column an array?`, (value) => value === undefined ? true : parseBool(value))
2236
+ .action(actionRunner(tablesCreateFloatColumn))
2237
+
2238
+ tables
2239
+ .command(`update-float-column`)
2240
+ .description(`Update a float column. Changing the 'default' value will not update already existing rows. `)
2241
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2242
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2243
+ .requiredOption(`--key <key>`, `Column Key.`)
2244
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2245
+ .option(`--xdefault <xdefault>`, `Default value. Cannot be set when required.`, parseInteger)
2246
+ .option(`--min <min>`, `Minimum value`, parseInteger)
2247
+ .option(`--max <max>`, `Maximum value`, parseInteger)
2248
+ .option(`--new-key <new-key>`, `New Column Key.`)
2249
+ .action(actionRunner(tablesUpdateFloatColumn))
2250
+
2251
+ tables
2252
+ .command(`create-integer-column`)
2253
+ .description(`Create an integer column. Optionally, minimum and maximum values can be provided. `)
2254
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2255
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2256
+ .requiredOption(`--key <key>`, `Column Key.`)
2257
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2258
+ .option(`--min <min>`, `Minimum value`, parseInteger)
2259
+ .option(`--max <max>`, `Maximum value`, parseInteger)
2260
+ .option(`--xdefault <xdefault>`, `Default value. Cannot be set when column is required.`, parseInteger)
2261
+ .option(`--array [value]`, `Is column an array?`, (value) => value === undefined ? true : parseBool(value))
2262
+ .action(actionRunner(tablesCreateIntegerColumn))
2263
+
2264
+ tables
2265
+ .command(`update-integer-column`)
2266
+ .description(`Update an integer column. Changing the 'default' value will not update already existing rows. `)
2267
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2268
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2269
+ .requiredOption(`--key <key>`, `Column Key.`)
2270
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2271
+ .option(`--xdefault <xdefault>`, `Default value. Cannot be set when column is required.`, parseInteger)
2272
+ .option(`--min <min>`, `Minimum value`, parseInteger)
2273
+ .option(`--max <max>`, `Maximum value`, parseInteger)
2274
+ .option(`--new-key <new-key>`, `New Column Key.`)
2275
+ .action(actionRunner(tablesUpdateIntegerColumn))
2276
+
2277
+ tables
2278
+ .command(`create-ip-column`)
2279
+ .description(`Create IP address column. `)
2280
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2281
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2282
+ .requiredOption(`--key <key>`, `Column Key.`)
2283
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2284
+ .option(`--xdefault <xdefault>`, `Default value. Cannot be set when column is required.`)
2285
+ .option(`--array [value]`, `Is column an array?`, (value) => value === undefined ? true : parseBool(value))
2286
+ .action(actionRunner(tablesCreateIpColumn))
2287
+
2288
+ tables
2289
+ .command(`update-ip-column`)
2290
+ .description(`Update an ip column. Changing the 'default' value will not update already existing rows. `)
2291
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2292
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2293
+ .requiredOption(`--key <key>`, `Column Key.`)
2294
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2295
+ .option(`--xdefault <xdefault>`, `Default value. Cannot be set when column is required.`)
2296
+ .option(`--new-key <new-key>`, `New Column Key.`)
2297
+ .action(actionRunner(tablesUpdateIpColumn))
2298
+
2299
+ tables
2300
+ .command(`create-relationship-column`)
2301
+ .description(`Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). `)
2302
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2303
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2304
+ .requiredOption(`--related-table-id <related-table-id>`, `Related Table ID.`)
2305
+ .requiredOption(`--type <type>`, `Relation type`)
2306
+ .option(`--two-way [value]`, `Is Two Way?`, (value) => value === undefined ? true : parseBool(value))
2307
+ .option(`--key <key>`, `Column Key.`)
2308
+ .option(`--two-way-key <two-way-key>`, `Two Way Column Key.`)
2309
+ .option(`--on-delete <on-delete>`, `Constraints option`)
2310
+ .action(actionRunner(tablesCreateRelationshipColumn))
2311
+
2312
+ tables
2313
+ .command(`create-string-column`)
2314
+ .description(`Create a string column. `)
2315
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2316
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).`)
2317
+ .requiredOption(`--key <key>`, `Column Key.`)
2318
+ .requiredOption(`--size <size>`, `Attribute size for text attributes, in number of characters.`, parseInteger)
2319
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2320
+ .option(`--xdefault <xdefault>`, `Default value for column when not provided. Cannot be set when column is required.`)
2321
+ .option(`--array [value]`, `Is column an array?`, (value) => value === undefined ? true : parseBool(value))
2322
+ .option(`--encrypt [value]`, `Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried.`, (value) => value === undefined ? true : parseBool(value))
2323
+ .action(actionRunner(tablesCreateStringColumn))
2324
+
2325
+ tables
2326
+ .command(`update-string-column`)
2327
+ .description(`Update a string column. Changing the 'default' value will not update already existing rows. `)
2328
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2329
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).`)
2330
+ .requiredOption(`--key <key>`, `Column Key.`)
2331
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2332
+ .option(`--xdefault <xdefault>`, `Default value for column when not provided. Cannot be set when column is required.`)
2333
+ .option(`--size <size>`, `Maximum size of the string column.`, parseInteger)
2334
+ .option(`--new-key <new-key>`, `New Column Key.`)
2335
+ .action(actionRunner(tablesUpdateStringColumn))
2336
+
2337
+ tables
2338
+ .command(`create-url-column`)
2339
+ .description(`Create a URL column. `)
2340
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2341
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2342
+ .requiredOption(`--key <key>`, `Column Key.`)
2343
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2344
+ .option(`--xdefault <xdefault>`, `Default value for column when not provided. Cannot be set when column is required.`)
2345
+ .option(`--array [value]`, `Is column an array?`, (value) => value === undefined ? true : parseBool(value))
2346
+ .action(actionRunner(tablesCreateUrlColumn))
2347
+
2348
+ tables
2349
+ .command(`update-url-column`)
2350
+ .description(`Update an url column. Changing the 'default' value will not update already existing rows. `)
2351
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2352
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2353
+ .requiredOption(`--key <key>`, `Column Key.`)
2354
+ .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2355
+ .option(`--xdefault <xdefault>`, `Default value for column when not provided. Cannot be set when column is required.`)
2356
+ .option(`--new-key <new-key>`, `New Column Key.`)
2357
+ .action(actionRunner(tablesUpdateUrlColumn))
2358
+
2359
+ tables
2360
+ .command(`get-column`)
2361
+ .description(`Get column by ID.`)
2362
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2363
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2364
+ .requiredOption(`--key <key>`, `Column Key.`)
2365
+ .option(`--console`, `Get the resource console url`)
2366
+ .action(actionRunner(tablesGetColumn))
2367
+
2368
+ tables
2369
+ .command(`delete-column`)
2370
+ .description(`Deletes a column.`)
2371
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2372
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2373
+ .requiredOption(`--key <key>`, `Column Key.`)
2374
+ .action(actionRunner(tablesDeleteColumn))
2375
+
2376
+ tables
2377
+ .command(`update-relationship-column`)
2378
+ .description(`Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). `)
2379
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2380
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2381
+ .requiredOption(`--key <key>`, `Column Key.`)
2382
+ .option(`--on-delete <on-delete>`, `Constraints option`)
2383
+ .option(`--new-key <new-key>`, `New Column Key.`)
2384
+ .action(actionRunner(tablesUpdateRelationshipColumn))
2385
+
2386
+ tables
2387
+ .command(`list-indexes`)
2388
+ .description(`List indexes in the collection.`)
2389
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2390
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).`)
2391
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error`)
2392
+ .option(`--console`, `Get the resource console url`)
2393
+ .action(actionRunner(tablesListIndexes))
2394
+
2395
+ tables
2396
+ .command(`create-index`)
2397
+ .description(`Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. Attributes can be 'key', 'fulltext', and 'unique'.`)
2398
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2399
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).`)
2400
+ .requiredOption(`--key <key>`, `Index Key.`)
2401
+ .requiredOption(`--type <type>`, `Index type.`)
2402
+ .requiredOption(`--columns [columns...]`, `Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long.`)
2403
+ .option(`--orders [orders...]`, `Array of index orders. Maximum of 100 orders are allowed.`)
2404
+ .option(`--lengths [lengths...]`, `Length of index. Maximum of 100`)
2405
+ .action(actionRunner(tablesCreateIndex))
2406
+
2407
+ tables
2408
+ .command(`get-index`)
2409
+ .description(`Get index by ID.`)
2410
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2411
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).`)
2412
+ .requiredOption(`--key <key>`, `Index Key.`)
2413
+ .action(actionRunner(tablesGetIndex))
2414
+
2415
+ tables
2416
+ .command(`delete-index`)
2417
+ .description(`Delete an index.`)
2418
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2419
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).`)
2420
+ .requiredOption(`--key <key>`, `Index Key.`)
2421
+ .action(actionRunner(tablesDeleteIndex))
2422
+
2423
+ tables
2424
+ .command(`list-logs`)
2425
+ .description(`Get the table activity logs list by its unique ID.`)
2426
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2427
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2428
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset`)
2429
+ .action(actionRunner(tablesListLogs))
2430
+
2431
+ tables
2432
+ .command(`list-rows`)
2433
+ .description(`Get a list of all the user's rows in a given table. You can use the query params to filter your results.`)
2434
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2435
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).`)
2436
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.`)
2437
+ .option(`--console`, `Get the resource console url`)
2438
+ .action(actionRunner(tablesListRows))
2439
+
2440
+ tables
2441
+ .command(`create-row`)
2442
+ .description(`Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console.`)
2443
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2444
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows.`)
2445
+ .requiredOption(`--row-id <row-id>`, `Row ID. Choose a custom ID or generate a random ID with 'ID.unique()'. 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.`)
2446
+ .requiredOption(`--data <data>`, `Row data as JSON object.`)
2447
+ .option(`--permissions [permissions...]`, `An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
2448
+ .action(actionRunner(tablesCreateRow))
2449
+
2450
+ tables
2451
+ .command(`create-rows`)
2452
+ .description(`Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console.`)
2453
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2454
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows.`)
2455
+ .requiredOption(`--rows [rows...]`, `Array of documents data as JSON objects.`)
2456
+ .action(actionRunner(tablesCreateRows))
2457
+
2458
+ tables
2459
+ .command(`upsert-rows`)
2460
+ .description(`Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. `)
2461
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2462
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2463
+ .action(actionRunner(tablesUpsertRows))
2464
+
2465
+ tables
2466
+ .command(`update-rows`)
2467
+ .description(`Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated.`)
2468
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2469
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2470
+ .option(`--data <data>`, `Row data as JSON object. Include only column and value pairs to be updated.`)
2471
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.`)
2472
+ .action(actionRunner(tablesUpdateRows))
2473
+
2474
+ tables
2475
+ .command(`delete-rows`)
2476
+ .description(`Bulk delete rows using queries, if no queries are passed then all rows are deleted.`)
2477
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2478
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).`)
2479
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.`)
2480
+ .action(actionRunner(tablesDeleteRows))
2481
+
2482
+ tables
2483
+ .command(`get-row`)
2484
+ .description(`Get a row by its unique ID. This endpoint response returns a JSON object with the row data.`)
2485
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2486
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).`)
2487
+ .requiredOption(`--row-id <row-id>`, `Row ID.`)
2488
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.`)
2489
+ .option(`--console`, `Get the resource console url`)
2490
+ .action(actionRunner(tablesGetRow))
2491
+
2492
+ tables
2493
+ .command(`upsert-row`)
2494
+ .description(`Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console.`)
2495
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2496
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2497
+ .requiredOption(`--row-id <row-id>`, `Row ID.`)
2498
+ .action(actionRunner(tablesUpsertRow))
2499
+
2500
+ tables
2501
+ .command(`update-row`)
2502
+ .description(`Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated.`)
2503
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2504
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2505
+ .requiredOption(`--row-id <row-id>`, `Row ID.`)
2506
+ .option(`--data <data>`, `Row data as JSON object. Include only columns and value pairs to be updated.`)
2507
+ .option(`--permissions [permissions...]`, `An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
2508
+ .action(actionRunner(tablesUpdateRow))
2509
+
2510
+ tables
2511
+ .command(`delete-row`)
2512
+ .description(`Delete a row by its unique ID.`)
2513
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2514
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate).`)
2515
+ .requiredOption(`--row-id <row-id>`, `Row ID.`)
2516
+ .action(actionRunner(tablesDeleteRow))
2517
+
2518
+ tables
2519
+ .command(`list-row-logs`)
2520
+ .description(`Get the row activity logs list by its unique ID.`)
2521
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2522
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2523
+ .requiredOption(`--row-id <row-id>`, `Row ID.`)
2524
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset`)
2525
+ .option(`--console`, `Get the resource console url`)
2526
+ .action(actionRunner(tablesListRowLogs))
2527
+
2528
+ tables
2529
+ .command(`decrement-row-column`)
2530
+ .description(`Decrement a specific column of a row by a given value.`)
2531
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2532
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2533
+ .requiredOption(`--row-id <row-id>`, `Row ID.`)
2534
+ .requiredOption(`--column <column>`, `Column key.`)
2535
+ .option(`--value <value>`, `Value to increment the column by. The value must be a number.`, parseInteger)
2536
+ .option(`--min <min>`, `Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.`, parseInteger)
2537
+ .action(actionRunner(tablesDecrementRowColumn))
2538
+
2539
+ tables
2540
+ .command(`increment-row-column`)
2541
+ .description(`Increment a specific column of a row by a given value.`)
2542
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2543
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2544
+ .requiredOption(`--row-id <row-id>`, `Row ID.`)
2545
+ .requiredOption(`--column <column>`, `Column key.`)
2546
+ .option(`--value <value>`, `Value to increment the column by. The value must be a number.`, parseInteger)
2547
+ .option(`--max <max>`, `Maximum value for the column. If the current value is greater than this value, an error will be thrown.`, parseInteger)
2548
+ .action(actionRunner(tablesIncrementRowColumn))
2549
+
2550
+ tables
2551
+ .command(`get-usage`)
2552
+ .description(`Get usage metrics and statistics for a table. Returning the total number of rows. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.`)
2553
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2554
+ .requiredOption(`--table-id <table-id>`, `Table ID.`)
2555
+ .option(`--range <range>`, `Date range.`)
2556
+ .action(actionRunner(tablesGetUsage))
2557
+
2558
+ module.exports = {
2559
+ tables,
2560
+ tablesList,
2561
+ tablesCreate,
2562
+ tablesGet,
2563
+ tablesUpdate,
2564
+ tablesDelete,
2565
+ tablesListColumns,
2566
+ tablesCreateBooleanColumn,
2567
+ tablesUpdateBooleanColumn,
2568
+ tablesCreateDatetimeColumn,
2569
+ tablesUpdateDatetimeColumn,
2570
+ tablesCreateEmailColumn,
2571
+ tablesUpdateEmailColumn,
2572
+ tablesCreateEnumColumn,
2573
+ tablesUpdateEnumColumn,
2574
+ tablesCreateFloatColumn,
2575
+ tablesUpdateFloatColumn,
2576
+ tablesCreateIntegerColumn,
2577
+ tablesUpdateIntegerColumn,
2578
+ tablesCreateIpColumn,
2579
+ tablesUpdateIpColumn,
2580
+ tablesCreateRelationshipColumn,
2581
+ tablesCreateStringColumn,
2582
+ tablesUpdateStringColumn,
2583
+ tablesCreateUrlColumn,
2584
+ tablesUpdateUrlColumn,
2585
+ tablesGetColumn,
2586
+ tablesDeleteColumn,
2587
+ tablesUpdateRelationshipColumn,
2588
+ tablesListIndexes,
2589
+ tablesCreateIndex,
2590
+ tablesGetIndex,
2591
+ tablesDeleteIndex,
2592
+ tablesListLogs,
2593
+ tablesListRows,
2594
+ tablesCreateRow,
2595
+ tablesCreateRows,
2596
+ tablesUpsertRows,
2597
+ tablesUpdateRows,
2598
+ tablesDeleteRows,
2599
+ tablesGetRow,
2600
+ tablesUpsertRow,
2601
+ tablesUpdateRow,
2602
+ tablesDeleteRow,
2603
+ tablesListRowLogs,
2604
+ tablesDecrementRowColumn,
2605
+ tablesIncrementRowColumn,
2606
+ tablesGetUsage
2607
+ };