appwrite-cli 4.2.0 → 4.2.2

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.
@@ -9,1645 +9,1929 @@ const { Command } = require('commander');
9
9
  const { sdkForProject, sdkForConsole } = require('../sdks')
10
10
  const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
11
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
+ }
12
37
 
13
38
  const databases = new Command("databases").description(commandDescriptions['databases']).configureHelp({
14
39
  helpWidth: process.stdout.columns || 80
15
- })
16
-
40
+ })
41
+
42
+ /**
43
+ * @typedef {Object} DatabasesListRequestParams
44
+ * @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
45
+ * @property {string} search Search term to filter your list results. Max length: 256 chars.
46
+ * @property {boolean} parseOutput
47
+ * @property {libClient | undefined} sdk
48
+ */
49
+
50
+ /**
51
+ * @param {DatabasesListRequestParams} params
52
+ */
17
53
  const databasesList = async ({ queries, search, parseOutput = true, sdk = undefined}) => {
18
- /* @param {string[]} queries */
19
- /* @param {string} search */
20
-
21
54
  let client = !sdk ? await sdkForProject() : sdk;
22
55
  let apiPath = '/databases';
23
56
  let payload = {};
24
-
25
- /** Query Params */
26
57
  if (typeof queries !== 'undefined') {
27
58
  payload['queries'] = queries;
28
59
  }
29
60
  if (typeof search !== 'undefined') {
30
61
  payload['search'] = search;
31
62
  }
63
+
32
64
  let response = undefined;
65
+
33
66
  response = await client.call('get', apiPath, {
34
67
  'content-type': 'application/json',
35
68
  }, payload);
36
-
69
+
37
70
  if (parseOutput) {
38
71
  parse(response)
39
72
  success()
40
73
  }
74
+
41
75
  return response;
42
76
  }
43
77
 
78
+ /**
79
+ * @typedef {Object} DatabasesCreateRequestParams
80
+ * @property {string} databaseId 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.
81
+ * @property {string} name Database name. Max length: 128 chars.
82
+ * @property {boolean} enabled Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
83
+ * @property {boolean} parseOutput
84
+ * @property {libClient | undefined} sdk
85
+ */
86
+
87
+ /**
88
+ * @param {DatabasesCreateRequestParams} params
89
+ */
44
90
  const databasesCreate = async ({ databaseId, name, enabled, parseOutput = true, sdk = undefined}) => {
45
- /* @param {string} databaseId */
46
- /* @param {string} name */
47
- /* @param {boolean} enabled */
48
-
49
91
  let client = !sdk ? await sdkForProject() : sdk;
50
92
  let apiPath = '/databases';
51
93
  let payload = {};
52
-
53
- /** Body Params */
54
-
55
94
  if (typeof databaseId !== 'undefined') {
56
95
  payload['databaseId'] = databaseId;
57
96
  }
58
-
59
-
60
97
  if (typeof name !== 'undefined') {
61
98
  payload['name'] = name;
62
99
  }
63
-
64
-
65
100
  if (typeof enabled !== 'undefined') {
66
101
  payload['enabled'] = enabled;
67
102
  }
68
103
 
69
104
  let response = undefined;
105
+
70
106
  response = await client.call('post', apiPath, {
71
107
  'content-type': 'application/json',
72
108
  }, payload);
73
-
109
+
74
110
  if (parseOutput) {
75
111
  parse(response)
76
112
  success()
77
113
  }
114
+
78
115
  return response;
79
116
  }
80
117
 
81
- const databasesGetUsage = async ({ range, parseOutput = true, sdk = undefined}) => {
82
- /* @param {string} range */
118
+ /**
119
+ * @typedef {Object} DatabasesGetUsageRequestParams
120
+ * @property {string} range 'Date range.
121
+ * @property {boolean} parseOutput
122
+ * @property {libClient | undefined} sdk
123
+ */
83
124
 
125
+ /**
126
+ * @param {DatabasesGetUsageRequestParams} params
127
+ */
128
+ const databasesGetUsage = async ({ range, parseOutput = true, sdk = undefined}) => {
84
129
  let client = !sdk ? await sdkForProject() : sdk;
85
130
  let apiPath = '/databases/usage';
86
131
  let payload = {};
87
-
88
- /** Query Params */
89
132
  if (typeof range !== 'undefined') {
90
133
  payload['range'] = range;
91
134
  }
135
+
92
136
  let response = undefined;
137
+
93
138
  response = await client.call('get', apiPath, {
94
139
  'content-type': 'application/json',
95
140
  }, payload);
96
-
141
+
97
142
  if (parseOutput) {
98
143
  parse(response)
99
144
  success()
100
145
  }
146
+
101
147
  return response;
102
148
  }
103
149
 
104
- const databasesGet = async ({ databaseId, parseOutput = true, sdk = undefined}) => {
105
- /* @param {string} databaseId */
150
+ /**
151
+ * @typedef {Object} DatabasesGetRequestParams
152
+ * @property {string} databaseId Database ID.
153
+ * @property {boolean} parseOutput
154
+ * @property {libClient | undefined} sdk
155
+ */
106
156
 
157
+ /**
158
+ * @param {DatabasesGetRequestParams} params
159
+ */
160
+ const databasesGet = async ({ databaseId, parseOutput = true, sdk = undefined}) => {
107
161
  let client = !sdk ? await sdkForProject() : sdk;
108
162
  let apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
109
163
  let payload = {};
164
+
110
165
  let response = undefined;
166
+
111
167
  response = await client.call('get', apiPath, {
112
168
  'content-type': 'application/json',
113
169
  }, payload);
114
-
170
+
115
171
  if (parseOutput) {
116
172
  parse(response)
117
173
  success()
118
174
  }
175
+
119
176
  return response;
120
177
  }
121
178
 
179
+ /**
180
+ * @typedef {Object} DatabasesUpdateRequestParams
181
+ * @property {string} databaseId Database ID.
182
+ * @property {string} name Database name. Max length: 128 chars.
183
+ * @property {boolean} enabled Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
184
+ * @property {boolean} parseOutput
185
+ * @property {libClient | undefined} sdk
186
+ */
187
+
188
+ /**
189
+ * @param {DatabasesUpdateRequestParams} params
190
+ */
122
191
  const databasesUpdate = async ({ databaseId, name, enabled, parseOutput = true, sdk = undefined}) => {
123
- /* @param {string} databaseId */
124
- /* @param {string} name */
125
- /* @param {boolean} enabled */
126
-
127
192
  let client = !sdk ? await sdkForProject() : sdk;
128
193
  let apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
129
194
  let payload = {};
130
-
131
- /** Body Params */
132
-
133
195
  if (typeof name !== 'undefined') {
134
196
  payload['name'] = name;
135
197
  }
136
-
137
-
138
198
  if (typeof enabled !== 'undefined') {
139
199
  payload['enabled'] = enabled;
140
200
  }
141
201
 
142
202
  let response = undefined;
203
+
143
204
  response = await client.call('put', apiPath, {
144
205
  'content-type': 'application/json',
145
206
  }, payload);
146
-
207
+
147
208
  if (parseOutput) {
148
209
  parse(response)
149
210
  success()
150
211
  }
212
+
151
213
  return response;
152
214
  }
153
215
 
154
- const databasesDelete = async ({ databaseId, parseOutput = true, sdk = undefined}) => {
155
- /* @param {string} databaseId */
216
+ /**
217
+ * @typedef {Object} DatabasesDeleteRequestParams
218
+ * @property {string} databaseId Database ID.
219
+ * @property {boolean} parseOutput
220
+ * @property {libClient | undefined} sdk
221
+ */
156
222
 
223
+ /**
224
+ * @param {DatabasesDeleteRequestParams} params
225
+ */
226
+ const databasesDelete = async ({ databaseId, parseOutput = true, sdk = undefined}) => {
157
227
  let client = !sdk ? await sdkForProject() : sdk;
158
228
  let apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
159
229
  let payload = {};
230
+
160
231
  let response = undefined;
232
+
161
233
  response = await client.call('delete', apiPath, {
162
234
  'content-type': 'application/json',
163
235
  }, payload);
164
-
236
+
165
237
  if (parseOutput) {
166
238
  parse(response)
167
239
  success()
168
240
  }
241
+
169
242
  return response;
170
243
  }
171
244
 
245
+ /**
246
+ * @typedef {Object} DatabasesListCollectionsRequestParams
247
+ * @property {string} databaseId Database ID.
248
+ * @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, documentSecurity
249
+ * @property {string} search Search term to filter your list results. Max length: 256 chars.
250
+ * @property {boolean} parseOutput
251
+ * @property {libClient | undefined} sdk
252
+ */
253
+
254
+ /**
255
+ * @param {DatabasesListCollectionsRequestParams} params
256
+ */
172
257
  const databasesListCollections = async ({ databaseId, queries, search, parseOutput = true, sdk = undefined}) => {
173
- /* @param {string} databaseId */
174
- /* @param {string[]} queries */
175
- /* @param {string} search */
176
-
177
258
  let client = !sdk ? await sdkForProject() : sdk;
178
259
  let apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
179
260
  let payload = {};
180
-
181
- /** Query Params */
182
261
  if (typeof queries !== 'undefined') {
183
262
  payload['queries'] = queries;
184
263
  }
185
264
  if (typeof search !== 'undefined') {
186
265
  payload['search'] = search;
187
266
  }
267
+
188
268
  let response = undefined;
269
+
189
270
  response = await client.call('get', apiPath, {
190
271
  'content-type': 'application/json',
191
272
  }, payload);
192
-
273
+
193
274
  if (parseOutput) {
194
275
  parse(response)
195
276
  success()
196
277
  }
278
+
197
279
  return response;
198
280
  }
199
281
 
282
+ /**
283
+ * @typedef {Object} DatabasesCreateCollectionRequestParams
284
+ * @property {string} databaseId Database ID.
285
+ * @property {string} collectionId 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.
286
+ * @property {string} name Collection name. Max length: 128 chars.
287
+ * @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).
288
+ * @property {boolean} documentSecurity Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
289
+ * @property {boolean} enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
290
+ * @property {boolean} parseOutput
291
+ * @property {libClient | undefined} sdk
292
+ */
293
+
294
+ /**
295
+ * @param {DatabasesCreateCollectionRequestParams} params
296
+ */
200
297
  const databasesCreateCollection = async ({ databaseId, collectionId, name, permissions, documentSecurity, enabled, parseOutput = true, sdk = undefined}) => {
201
- /* @param {string} databaseId */
202
- /* @param {string} collectionId */
203
- /* @param {string} name */
204
- /* @param {string[]} permissions */
205
- /* @param {boolean} documentSecurity */
206
- /* @param {boolean} enabled */
207
-
208
298
  let client = !sdk ? await sdkForProject() : sdk;
209
299
  let apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
210
300
  let payload = {};
211
-
212
- /** Body Params */
213
-
214
301
  if (typeof collectionId !== 'undefined') {
215
302
  payload['collectionId'] = collectionId;
216
303
  }
217
-
218
-
219
304
  if (typeof name !== 'undefined') {
220
305
  payload['name'] = name;
221
306
  }
222
-
223
307
  permissions = permissions === true ? [] : permissions;
224
-
225
308
  if (typeof permissions !== 'undefined') {
226
309
  payload['permissions'] = permissions;
227
310
  }
228
-
229
-
230
311
  if (typeof documentSecurity !== 'undefined') {
231
312
  payload['documentSecurity'] = documentSecurity;
232
313
  }
233
-
234
-
235
314
  if (typeof enabled !== 'undefined') {
236
315
  payload['enabled'] = enabled;
237
316
  }
238
317
 
239
318
  let response = undefined;
319
+
240
320
  response = await client.call('post', apiPath, {
241
321
  'content-type': 'application/json',
242
322
  }, payload);
243
-
323
+
244
324
  if (parseOutput) {
245
325
  parse(response)
246
326
  success()
247
327
  }
328
+
248
329
  return response;
249
330
  }
250
331
 
332
+ /**
333
+ * @typedef {Object} DatabasesGetCollectionRequestParams
334
+ * @property {string} databaseId Database ID.
335
+ * @property {string} collectionId Collection ID.
336
+ * @property {boolean} parseOutput
337
+ * @property {libClient | undefined} sdk
338
+ */
339
+
340
+ /**
341
+ * @param {DatabasesGetCollectionRequestParams} params
342
+ */
251
343
  const databasesGetCollection = async ({ databaseId, collectionId, parseOutput = true, sdk = undefined}) => {
252
- /* @param {string} databaseId */
253
- /* @param {string} collectionId */
254
-
255
344
  let client = !sdk ? await sdkForProject() : sdk;
256
345
  let apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
257
346
  let payload = {};
347
+
258
348
  let response = undefined;
349
+
259
350
  response = await client.call('get', apiPath, {
260
351
  'content-type': 'application/json',
261
352
  }, payload);
262
-
353
+
263
354
  if (parseOutput) {
264
355
  parse(response)
265
356
  success()
266
357
  }
358
+
267
359
  return response;
268
360
  }
269
361
 
362
+ /**
363
+ * @typedef {Object} DatabasesUpdateCollectionRequestParams
364
+ * @property {string} databaseId Database ID.
365
+ * @property {string} collectionId Collection ID.
366
+ * @property {string} name Collection name. Max length: 128 chars.
367
+ * @property {string[]} permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
368
+ * @property {boolean} documentSecurity Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
369
+ * @property {boolean} enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
370
+ * @property {boolean} parseOutput
371
+ * @property {libClient | undefined} sdk
372
+ */
373
+
374
+ /**
375
+ * @param {DatabasesUpdateCollectionRequestParams} params
376
+ */
270
377
  const databasesUpdateCollection = async ({ databaseId, collectionId, name, permissions, documentSecurity, enabled, parseOutput = true, sdk = undefined}) => {
271
- /* @param {string} databaseId */
272
- /* @param {string} collectionId */
273
- /* @param {string} name */
274
- /* @param {string[]} permissions */
275
- /* @param {boolean} documentSecurity */
276
- /* @param {boolean} enabled */
277
-
278
378
  let client = !sdk ? await sdkForProject() : sdk;
279
379
  let apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
280
380
  let payload = {};
281
-
282
- /** Body Params */
283
-
284
381
  if (typeof name !== 'undefined') {
285
382
  payload['name'] = name;
286
383
  }
287
-
288
384
  permissions = permissions === true ? [] : permissions;
289
-
290
385
  if (typeof permissions !== 'undefined') {
291
386
  payload['permissions'] = permissions;
292
387
  }
293
-
294
-
295
388
  if (typeof documentSecurity !== 'undefined') {
296
389
  payload['documentSecurity'] = documentSecurity;
297
390
  }
298
-
299
-
300
391
  if (typeof enabled !== 'undefined') {
301
392
  payload['enabled'] = enabled;
302
393
  }
303
394
 
304
395
  let response = undefined;
396
+
305
397
  response = await client.call('put', apiPath, {
306
398
  'content-type': 'application/json',
307
399
  }, payload);
308
-
400
+
309
401
  if (parseOutput) {
310
402
  parse(response)
311
403
  success()
312
404
  }
405
+
313
406
  return response;
314
407
  }
315
408
 
409
+ /**
410
+ * @typedef {Object} DatabasesDeleteCollectionRequestParams
411
+ * @property {string} databaseId Database ID.
412
+ * @property {string} collectionId Collection ID.
413
+ * @property {boolean} parseOutput
414
+ * @property {libClient | undefined} sdk
415
+ */
416
+
417
+ /**
418
+ * @param {DatabasesDeleteCollectionRequestParams} params
419
+ */
316
420
  const databasesDeleteCollection = async ({ databaseId, collectionId, parseOutput = true, sdk = undefined}) => {
317
- /* @param {string} databaseId */
318
- /* @param {string} collectionId */
319
-
320
421
  let client = !sdk ? await sdkForProject() : sdk;
321
422
  let apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
322
423
  let payload = {};
424
+
323
425
  let response = undefined;
426
+
324
427
  response = await client.call('delete', apiPath, {
325
428
  'content-type': 'application/json',
326
429
  }, payload);
327
-
430
+
328
431
  if (parseOutput) {
329
432
  parse(response)
330
433
  success()
331
434
  }
435
+
332
436
  return response;
333
437
  }
334
438
 
439
+ /**
440
+ * @typedef {Object} DatabasesListAttributesRequestParams
441
+ * @property {string} databaseId Database ID.
442
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
443
+ * @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
444
+ * @property {boolean} parseOutput
445
+ * @property {libClient | undefined} sdk
446
+ */
447
+
448
+ /**
449
+ * @param {DatabasesListAttributesRequestParams} params
450
+ */
335
451
  const databasesListAttributes = async ({ databaseId, collectionId, queries, parseOutput = true, sdk = undefined}) => {
336
- /* @param {string} databaseId */
337
- /* @param {string} collectionId */
338
- /* @param {string[]} queries */
339
-
340
452
  let client = !sdk ? await sdkForProject() : sdk;
341
453
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
342
454
  let payload = {};
343
-
344
- /** Query Params */
345
455
  if (typeof queries !== 'undefined') {
346
456
  payload['queries'] = queries;
347
457
  }
458
+
348
459
  let response = undefined;
460
+
349
461
  response = await client.call('get', apiPath, {
350
462
  'content-type': 'application/json',
351
463
  }, payload);
352
-
464
+
353
465
  if (parseOutput) {
354
466
  parse(response)
355
467
  success()
356
468
  }
469
+
357
470
  return response;
358
471
  }
359
472
 
473
+ /**
474
+ * @typedef {Object} DatabasesCreateBooleanAttributeRequestParams
475
+ * @property {string} databaseId Database ID.
476
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
477
+ * @property {string} key Attribute Key.
478
+ * @property {boolean} required Is attribute required?
479
+ * @property {boolean} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
480
+ * @property {boolean} array Is attribute an array?
481
+ * @property {boolean} parseOutput
482
+ * @property {libClient | undefined} sdk
483
+ */
484
+
485
+ /**
486
+ * @param {DatabasesCreateBooleanAttributeRequestParams} params
487
+ */
360
488
  const databasesCreateBooleanAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
361
- /* @param {string} databaseId */
362
- /* @param {string} collectionId */
363
- /* @param {string} key */
364
- /* @param {boolean} required */
365
- /* @param {boolean} xdefault */
366
- /* @param {boolean} array */
367
-
368
489
  let client = !sdk ? await sdkForProject() : sdk;
369
490
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
370
491
  let payload = {};
371
-
372
- /** Body Params */
373
-
374
492
  if (typeof key !== 'undefined') {
375
493
  payload['key'] = key;
376
494
  }
377
-
378
-
379
495
  if (typeof required !== 'undefined') {
380
496
  payload['required'] = required;
381
497
  }
382
-
383
-
384
498
  if (typeof xdefault !== 'undefined') {
385
499
  payload['default'] = xdefault;
386
500
  }
387
-
388
-
389
501
  if (typeof array !== 'undefined') {
390
502
  payload['array'] = array;
391
503
  }
392
504
 
393
505
  let response = undefined;
506
+
394
507
  response = await client.call('post', apiPath, {
395
508
  'content-type': 'application/json',
396
509
  }, payload);
397
-
510
+
398
511
  if (parseOutput) {
399
512
  parse(response)
400
513
  success()
401
514
  }
515
+
402
516
  return response;
403
517
  }
404
518
 
519
+ /**
520
+ * @typedef {Object} DatabasesUpdateBooleanAttributeRequestParams
521
+ * @property {string} databaseId Database ID.
522
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
523
+ * @property {string} key Attribute Key.
524
+ * @property {boolean} required Is attribute required?
525
+ * @property {boolean} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
526
+ * @property {boolean} parseOutput
527
+ * @property {libClient | undefined} sdk
528
+ */
529
+
530
+ /**
531
+ * @param {DatabasesUpdateBooleanAttributeRequestParams} params
532
+ */
405
533
  const databasesUpdateBooleanAttribute = async ({ databaseId, collectionId, key, required, xdefault, parseOutput = true, sdk = undefined}) => {
406
- /* @param {string} databaseId */
407
- /* @param {string} collectionId */
408
- /* @param {string} key */
409
- /* @param {boolean} required */
410
- /* @param {boolean} xdefault */
411
-
412
534
  let client = !sdk ? await sdkForProject() : sdk;
413
535
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
414
536
  let payload = {};
415
-
416
- /** Body Params */
417
-
418
537
  if (typeof required !== 'undefined') {
419
538
  payload['required'] = required;
420
539
  }
421
-
422
-
423
540
  if (typeof xdefault !== 'undefined') {
424
541
  payload['default'] = xdefault;
425
542
  }
426
543
 
427
544
  let response = undefined;
545
+
428
546
  response = await client.call('patch', apiPath, {
429
547
  'content-type': 'application/json',
430
548
  }, payload);
431
-
549
+
432
550
  if (parseOutput) {
433
551
  parse(response)
434
552
  success()
435
553
  }
554
+
436
555
  return response;
437
556
  }
438
557
 
558
+ /**
559
+ * @typedef {Object} DatabasesCreateDatetimeAttributeRequestParams
560
+ * @property {string} databaseId Database ID.
561
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
562
+ * @property {string} key Attribute Key.
563
+ * @property {boolean} required Is attribute required?
564
+ * @property {string} xdefault Default value for the attribute in ISO 8601 format. Cannot be set when attribute is required.
565
+ * @property {boolean} array Is attribute an array?
566
+ * @property {boolean} parseOutput
567
+ * @property {libClient | undefined} sdk
568
+ */
569
+
570
+ /**
571
+ * @param {DatabasesCreateDatetimeAttributeRequestParams} params
572
+ */
439
573
  const databasesCreateDatetimeAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
440
- /* @param {string} databaseId */
441
- /* @param {string} collectionId */
442
- /* @param {string} key */
443
- /* @param {boolean} required */
444
- /* @param {string} xdefault */
445
- /* @param {boolean} array */
446
-
447
574
  let client = !sdk ? await sdkForProject() : sdk;
448
575
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
449
576
  let payload = {};
450
-
451
- /** Body Params */
452
-
453
577
  if (typeof key !== 'undefined') {
454
578
  payload['key'] = key;
455
579
  }
456
-
457
-
458
580
  if (typeof required !== 'undefined') {
459
581
  payload['required'] = required;
460
582
  }
461
-
462
-
463
583
  if (typeof xdefault !== 'undefined') {
464
584
  payload['default'] = xdefault;
465
585
  }
466
-
467
-
468
586
  if (typeof array !== 'undefined') {
469
587
  payload['array'] = array;
470
588
  }
471
589
 
472
590
  let response = undefined;
591
+
473
592
  response = await client.call('post', apiPath, {
474
593
  'content-type': 'application/json',
475
594
  }, payload);
476
-
595
+
477
596
  if (parseOutput) {
478
597
  parse(response)
479
598
  success()
480
599
  }
600
+
481
601
  return response;
482
602
  }
483
603
 
604
+ /**
605
+ * @typedef {Object} DatabasesUpdateDatetimeAttributeRequestParams
606
+ * @property {string} databaseId Database ID.
607
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
608
+ * @property {string} key Attribute Key.
609
+ * @property {boolean} required Is attribute required?
610
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
611
+ * @property {boolean} parseOutput
612
+ * @property {libClient | undefined} sdk
613
+ */
614
+
615
+ /**
616
+ * @param {DatabasesUpdateDatetimeAttributeRequestParams} params
617
+ */
484
618
  const databasesUpdateDatetimeAttribute = async ({ databaseId, collectionId, key, required, xdefault, parseOutput = true, sdk = undefined}) => {
485
- /* @param {string} databaseId */
486
- /* @param {string} collectionId */
487
- /* @param {string} key */
488
- /* @param {boolean} required */
489
- /* @param {string} xdefault */
490
-
491
619
  let client = !sdk ? await sdkForProject() : sdk;
492
620
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
493
621
  let payload = {};
494
-
495
- /** Body Params */
496
-
497
622
  if (typeof required !== 'undefined') {
498
623
  payload['required'] = required;
499
624
  }
500
-
501
-
502
625
  if (typeof xdefault !== 'undefined') {
503
626
  payload['default'] = xdefault;
504
627
  }
505
628
 
506
629
  let response = undefined;
630
+
507
631
  response = await client.call('patch', apiPath, {
508
632
  'content-type': 'application/json',
509
633
  }, payload);
510
-
634
+
511
635
  if (parseOutput) {
512
636
  parse(response)
513
637
  success()
514
638
  }
639
+
515
640
  return response;
516
641
  }
517
642
 
643
+ /**
644
+ * @typedef {Object} DatabasesCreateEmailAttributeRequestParams
645
+ * @property {string} databaseId Database ID.
646
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
647
+ * @property {string} key Attribute Key.
648
+ * @property {boolean} required Is attribute required?
649
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
650
+ * @property {boolean} array Is attribute an array?
651
+ * @property {boolean} parseOutput
652
+ * @property {libClient | undefined} sdk
653
+ */
654
+
655
+ /**
656
+ * @param {DatabasesCreateEmailAttributeRequestParams} params
657
+ */
518
658
  const databasesCreateEmailAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
519
- /* @param {string} databaseId */
520
- /* @param {string} collectionId */
521
- /* @param {string} key */
522
- /* @param {boolean} required */
523
- /* @param {string} xdefault */
524
- /* @param {boolean} array */
525
-
526
659
  let client = !sdk ? await sdkForProject() : sdk;
527
660
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
528
661
  let payload = {};
529
-
530
- /** Body Params */
531
-
532
662
  if (typeof key !== 'undefined') {
533
663
  payload['key'] = key;
534
664
  }
535
-
536
-
537
665
  if (typeof required !== 'undefined') {
538
666
  payload['required'] = required;
539
667
  }
540
-
541
-
542
668
  if (typeof xdefault !== 'undefined') {
543
669
  payload['default'] = xdefault;
544
670
  }
545
-
546
-
547
671
  if (typeof array !== 'undefined') {
548
672
  payload['array'] = array;
549
673
  }
550
674
 
551
675
  let response = undefined;
676
+
552
677
  response = await client.call('post', apiPath, {
553
678
  'content-type': 'application/json',
554
679
  }, payload);
555
-
680
+
556
681
  if (parseOutput) {
557
682
  parse(response)
558
683
  success()
559
684
  }
685
+
560
686
  return response;
561
687
  }
562
688
 
689
+ /**
690
+ * @typedef {Object} DatabasesUpdateEmailAttributeRequestParams
691
+ * @property {string} databaseId Database ID.
692
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
693
+ * @property {string} key Attribute Key.
694
+ * @property {boolean} required Is attribute required?
695
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
696
+ * @property {boolean} parseOutput
697
+ * @property {libClient | undefined} sdk
698
+ */
699
+
700
+ /**
701
+ * @param {DatabasesUpdateEmailAttributeRequestParams} params
702
+ */
563
703
  const databasesUpdateEmailAttribute = async ({ databaseId, collectionId, key, required, xdefault, parseOutput = true, sdk = undefined}) => {
564
- /* @param {string} databaseId */
565
- /* @param {string} collectionId */
566
- /* @param {string} key */
567
- /* @param {boolean} required */
568
- /* @param {string} xdefault */
569
-
570
704
  let client = !sdk ? await sdkForProject() : sdk;
571
705
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
572
706
  let payload = {};
573
-
574
- /** Body Params */
575
-
576
707
  if (typeof required !== 'undefined') {
577
708
  payload['required'] = required;
578
709
  }
579
-
580
-
581
710
  if (typeof xdefault !== 'undefined') {
582
711
  payload['default'] = xdefault;
583
712
  }
584
713
 
585
714
  let response = undefined;
715
+
586
716
  response = await client.call('patch', apiPath, {
587
717
  'content-type': 'application/json',
588
718
  }, payload);
589
-
719
+
590
720
  if (parseOutput) {
591
721
  parse(response)
592
722
  success()
593
723
  }
724
+
594
725
  return response;
595
726
  }
596
727
 
728
+ /**
729
+ * @typedef {Object} DatabasesCreateEnumAttributeRequestParams
730
+ * @property {string} databaseId Database ID.
731
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
732
+ * @property {string} key Attribute Key.
733
+ * @property {string[]} elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long.
734
+ * @property {boolean} required Is attribute required?
735
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
736
+ * @property {boolean} array Is attribute an array?
737
+ * @property {boolean} parseOutput
738
+ * @property {libClient | undefined} sdk
739
+ */
740
+
741
+ /**
742
+ * @param {DatabasesCreateEnumAttributeRequestParams} params
743
+ */
597
744
  const databasesCreateEnumAttribute = async ({ databaseId, collectionId, key, elements, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
598
- /* @param {string} databaseId */
599
- /* @param {string} collectionId */
600
- /* @param {string} key */
601
- /* @param {string[]} elements */
602
- /* @param {boolean} required */
603
- /* @param {string} xdefault */
604
- /* @param {boolean} array */
605
-
606
745
  let client = !sdk ? await sdkForProject() : sdk;
607
746
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
608
747
  let payload = {};
609
-
610
- /** Body Params */
611
-
612
748
  if (typeof key !== 'undefined') {
613
749
  payload['key'] = key;
614
750
  }
615
-
616
751
  elements = elements === true ? [] : elements;
617
-
618
752
  if (typeof elements !== 'undefined') {
619
753
  payload['elements'] = elements;
620
754
  }
621
-
622
-
623
755
  if (typeof required !== 'undefined') {
624
756
  payload['required'] = required;
625
757
  }
626
-
627
-
628
758
  if (typeof xdefault !== 'undefined') {
629
759
  payload['default'] = xdefault;
630
760
  }
631
-
632
-
633
761
  if (typeof array !== 'undefined') {
634
762
  payload['array'] = array;
635
763
  }
636
764
 
637
765
  let response = undefined;
766
+
638
767
  response = await client.call('post', apiPath, {
639
768
  'content-type': 'application/json',
640
769
  }, payload);
641
-
770
+
642
771
  if (parseOutput) {
643
772
  parse(response)
644
773
  success()
645
774
  }
775
+
646
776
  return response;
647
777
  }
648
778
 
779
+ /**
780
+ * @typedef {Object} DatabasesUpdateEnumAttributeRequestParams
781
+ * @property {string} databaseId Database ID.
782
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
783
+ * @property {string} key Attribute Key.
784
+ * @property {string[]} elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long.
785
+ * @property {boolean} required Is attribute required?
786
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
787
+ * @property {boolean} parseOutput
788
+ * @property {libClient | undefined} sdk
789
+ */
790
+
791
+ /**
792
+ * @param {DatabasesUpdateEnumAttributeRequestParams} params
793
+ */
649
794
  const databasesUpdateEnumAttribute = async ({ databaseId, collectionId, key, elements, required, xdefault, parseOutput = true, sdk = undefined}) => {
650
- /* @param {string} databaseId */
651
- /* @param {string} collectionId */
652
- /* @param {string} key */
653
- /* @param {string[]} elements */
654
- /* @param {boolean} required */
655
- /* @param {string} xdefault */
656
-
657
795
  let client = !sdk ? await sdkForProject() : sdk;
658
796
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
659
797
  let payload = {};
660
-
661
- /** Body Params */
662
798
  elements = elements === true ? [] : elements;
663
-
664
799
  if (typeof elements !== 'undefined') {
665
800
  payload['elements'] = elements;
666
801
  }
667
-
668
-
669
802
  if (typeof required !== 'undefined') {
670
803
  payload['required'] = required;
671
804
  }
672
-
673
-
674
805
  if (typeof xdefault !== 'undefined') {
675
806
  payload['default'] = xdefault;
676
807
  }
677
808
 
678
809
  let response = undefined;
810
+
679
811
  response = await client.call('patch', apiPath, {
680
812
  'content-type': 'application/json',
681
813
  }, payload);
682
-
814
+
683
815
  if (parseOutput) {
684
816
  parse(response)
685
817
  success()
686
818
  }
819
+
687
820
  return response;
688
821
  }
689
822
 
823
+ /**
824
+ * @typedef {Object} DatabasesCreateFloatAttributeRequestParams
825
+ * @property {string} databaseId Database ID.
826
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
827
+ * @property {string} key Attribute Key.
828
+ * @property {boolean} required Is attribute required?
829
+ * @property {number} min Minimum value to enforce on new documents
830
+ * @property {number} max Maximum value to enforce on new documents
831
+ * @property {number} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
832
+ * @property {boolean} array Is attribute an array?
833
+ * @property {boolean} parseOutput
834
+ * @property {libClient | undefined} sdk
835
+ */
836
+
837
+ /**
838
+ * @param {DatabasesCreateFloatAttributeRequestParams} params
839
+ */
690
840
  const databasesCreateFloatAttribute = async ({ databaseId, collectionId, key, required, min, max, xdefault, array, parseOutput = true, sdk = undefined}) => {
691
- /* @param {string} databaseId */
692
- /* @param {string} collectionId */
693
- /* @param {string} key */
694
- /* @param {boolean} required */
695
- /* @param {number} min */
696
- /* @param {number} max */
697
- /* @param {number} xdefault */
698
- /* @param {boolean} array */
699
-
700
841
  let client = !sdk ? await sdkForProject() : sdk;
701
842
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
702
843
  let payload = {};
703
-
704
- /** Body Params */
705
-
706
844
  if (typeof key !== 'undefined') {
707
845
  payload['key'] = key;
708
846
  }
709
-
710
-
711
847
  if (typeof required !== 'undefined') {
712
848
  payload['required'] = required;
713
849
  }
714
-
715
-
716
850
  if (typeof min !== 'undefined') {
717
851
  payload['min'] = min;
718
852
  }
719
-
720
-
721
853
  if (typeof max !== 'undefined') {
722
854
  payload['max'] = max;
723
855
  }
724
-
725
-
726
856
  if (typeof xdefault !== 'undefined') {
727
857
  payload['default'] = xdefault;
728
858
  }
729
-
730
-
731
859
  if (typeof array !== 'undefined') {
732
860
  payload['array'] = array;
733
861
  }
734
862
 
735
863
  let response = undefined;
864
+
736
865
  response = await client.call('post', apiPath, {
737
866
  'content-type': 'application/json',
738
867
  }, payload);
739
-
868
+
740
869
  if (parseOutput) {
741
870
  parse(response)
742
871
  success()
743
872
  }
873
+
744
874
  return response;
745
875
  }
746
876
 
877
+ /**
878
+ * @typedef {Object} DatabasesUpdateFloatAttributeRequestParams
879
+ * @property {string} databaseId Database ID.
880
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
881
+ * @property {string} key Attribute Key.
882
+ * @property {boolean} required Is attribute required?
883
+ * @property {number} min Minimum value to enforce on new documents
884
+ * @property {number} max Maximum value to enforce on new documents
885
+ * @property {number} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
886
+ * @property {boolean} parseOutput
887
+ * @property {libClient | undefined} sdk
888
+ */
889
+
890
+ /**
891
+ * @param {DatabasesUpdateFloatAttributeRequestParams} params
892
+ */
747
893
  const databasesUpdateFloatAttribute = async ({ databaseId, collectionId, key, required, min, max, xdefault, parseOutput = true, sdk = undefined}) => {
748
- /* @param {string} databaseId */
749
- /* @param {string} collectionId */
750
- /* @param {string} key */
751
- /* @param {boolean} required */
752
- /* @param {number} min */
753
- /* @param {number} max */
754
- /* @param {number} xdefault */
755
-
756
894
  let client = !sdk ? await sdkForProject() : sdk;
757
895
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
758
896
  let payload = {};
759
-
760
- /** Body Params */
761
-
762
897
  if (typeof required !== 'undefined') {
763
898
  payload['required'] = required;
764
899
  }
765
-
766
-
767
900
  if (typeof min !== 'undefined') {
768
901
  payload['min'] = min;
769
902
  }
770
-
771
-
772
903
  if (typeof max !== 'undefined') {
773
904
  payload['max'] = max;
774
905
  }
775
-
776
-
777
906
  if (typeof xdefault !== 'undefined') {
778
907
  payload['default'] = xdefault;
779
908
  }
780
909
 
781
910
  let response = undefined;
911
+
782
912
  response = await client.call('patch', apiPath, {
783
913
  'content-type': 'application/json',
784
914
  }, payload);
785
-
915
+
786
916
  if (parseOutput) {
787
917
  parse(response)
788
918
  success()
789
919
  }
920
+
790
921
  return response;
791
922
  }
792
923
 
924
+ /**
925
+ * @typedef {Object} DatabasesCreateIntegerAttributeRequestParams
926
+ * @property {string} databaseId Database ID.
927
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
928
+ * @property {string} key Attribute Key.
929
+ * @property {boolean} required Is attribute required?
930
+ * @property {number} min Minimum value to enforce on new documents
931
+ * @property {number} max Maximum value to enforce on new documents
932
+ * @property {number} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
933
+ * @property {boolean} array Is attribute an array?
934
+ * @property {boolean} parseOutput
935
+ * @property {libClient | undefined} sdk
936
+ */
937
+
938
+ /**
939
+ * @param {DatabasesCreateIntegerAttributeRequestParams} params
940
+ */
793
941
  const databasesCreateIntegerAttribute = async ({ databaseId, collectionId, key, required, min, max, xdefault, array, parseOutput = true, sdk = undefined}) => {
794
- /* @param {string} databaseId */
795
- /* @param {string} collectionId */
796
- /* @param {string} key */
797
- /* @param {boolean} required */
798
- /* @param {number} min */
799
- /* @param {number} max */
800
- /* @param {number} xdefault */
801
- /* @param {boolean} array */
802
-
803
942
  let client = !sdk ? await sdkForProject() : sdk;
804
943
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
805
944
  let payload = {};
806
-
807
- /** Body Params */
808
-
809
945
  if (typeof key !== 'undefined') {
810
946
  payload['key'] = key;
811
947
  }
812
-
813
-
814
948
  if (typeof required !== 'undefined') {
815
949
  payload['required'] = required;
816
950
  }
817
-
818
-
819
951
  if (typeof min !== 'undefined') {
820
952
  payload['min'] = min;
821
953
  }
822
-
823
-
824
954
  if (typeof max !== 'undefined') {
825
955
  payload['max'] = max;
826
956
  }
827
-
828
-
829
957
  if (typeof xdefault !== 'undefined') {
830
958
  payload['default'] = xdefault;
831
959
  }
832
-
833
-
834
960
  if (typeof array !== 'undefined') {
835
961
  payload['array'] = array;
836
962
  }
837
963
 
838
964
  let response = undefined;
965
+
839
966
  response = await client.call('post', apiPath, {
840
967
  'content-type': 'application/json',
841
968
  }, payload);
842
-
969
+
843
970
  if (parseOutput) {
844
971
  parse(response)
845
972
  success()
846
973
  }
974
+
847
975
  return response;
848
976
  }
849
977
 
978
+ /**
979
+ * @typedef {Object} DatabasesUpdateIntegerAttributeRequestParams
980
+ * @property {string} databaseId Database ID.
981
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
982
+ * @property {string} key Attribute Key.
983
+ * @property {boolean} required Is attribute required?
984
+ * @property {number} min Minimum value to enforce on new documents
985
+ * @property {number} max Maximum value to enforce on new documents
986
+ * @property {number} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
987
+ * @property {boolean} parseOutput
988
+ * @property {libClient | undefined} sdk
989
+ */
990
+
991
+ /**
992
+ * @param {DatabasesUpdateIntegerAttributeRequestParams} params
993
+ */
850
994
  const databasesUpdateIntegerAttribute = async ({ databaseId, collectionId, key, required, min, max, xdefault, parseOutput = true, sdk = undefined}) => {
851
- /* @param {string} databaseId */
852
- /* @param {string} collectionId */
853
- /* @param {string} key */
854
- /* @param {boolean} required */
855
- /* @param {number} min */
856
- /* @param {number} max */
857
- /* @param {number} xdefault */
858
-
859
995
  let client = !sdk ? await sdkForProject() : sdk;
860
996
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
861
997
  let payload = {};
862
-
863
- /** Body Params */
864
-
865
998
  if (typeof required !== 'undefined') {
866
999
  payload['required'] = required;
867
1000
  }
868
-
869
-
870
1001
  if (typeof min !== 'undefined') {
871
1002
  payload['min'] = min;
872
1003
  }
873
-
874
-
875
1004
  if (typeof max !== 'undefined') {
876
1005
  payload['max'] = max;
877
1006
  }
878
-
879
-
880
1007
  if (typeof xdefault !== 'undefined') {
881
1008
  payload['default'] = xdefault;
882
1009
  }
883
1010
 
884
1011
  let response = undefined;
1012
+
885
1013
  response = await client.call('patch', apiPath, {
886
1014
  'content-type': 'application/json',
887
1015
  }, payload);
888
-
1016
+
889
1017
  if (parseOutput) {
890
1018
  parse(response)
891
1019
  success()
892
1020
  }
1021
+
893
1022
  return response;
894
1023
  }
895
1024
 
1025
+ /**
1026
+ * @typedef {Object} DatabasesCreateIpAttributeRequestParams
1027
+ * @property {string} databaseId Database ID.
1028
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1029
+ * @property {string} key Attribute Key.
1030
+ * @property {boolean} required Is attribute required?
1031
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
1032
+ * @property {boolean} array Is attribute an array?
1033
+ * @property {boolean} parseOutput
1034
+ * @property {libClient | undefined} sdk
1035
+ */
1036
+
1037
+ /**
1038
+ * @param {DatabasesCreateIpAttributeRequestParams} params
1039
+ */
896
1040
  const databasesCreateIpAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
897
- /* @param {string} databaseId */
898
- /* @param {string} collectionId */
899
- /* @param {string} key */
900
- /* @param {boolean} required */
901
- /* @param {string} xdefault */
902
- /* @param {boolean} array */
903
-
904
1041
  let client = !sdk ? await sdkForProject() : sdk;
905
1042
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
906
1043
  let payload = {};
907
-
908
- /** Body Params */
909
-
910
1044
  if (typeof key !== 'undefined') {
911
1045
  payload['key'] = key;
912
1046
  }
913
-
914
-
915
1047
  if (typeof required !== 'undefined') {
916
1048
  payload['required'] = required;
917
1049
  }
918
-
919
-
920
1050
  if (typeof xdefault !== 'undefined') {
921
1051
  payload['default'] = xdefault;
922
1052
  }
923
-
924
-
925
1053
  if (typeof array !== 'undefined') {
926
1054
  payload['array'] = array;
927
1055
  }
928
1056
 
929
1057
  let response = undefined;
1058
+
930
1059
  response = await client.call('post', apiPath, {
931
1060
  'content-type': 'application/json',
932
1061
  }, payload);
933
-
1062
+
934
1063
  if (parseOutput) {
935
1064
  parse(response)
936
1065
  success()
937
1066
  }
1067
+
938
1068
  return response;
939
1069
  }
940
1070
 
1071
+ /**
1072
+ * @typedef {Object} DatabasesUpdateIpAttributeRequestParams
1073
+ * @property {string} databaseId Database ID.
1074
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1075
+ * @property {string} key Attribute Key.
1076
+ * @property {boolean} required Is attribute required?
1077
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
1078
+ * @property {boolean} parseOutput
1079
+ * @property {libClient | undefined} sdk
1080
+ */
1081
+
1082
+ /**
1083
+ * @param {DatabasesUpdateIpAttributeRequestParams} params
1084
+ */
941
1085
  const databasesUpdateIpAttribute = async ({ databaseId, collectionId, key, required, xdefault, parseOutput = true, sdk = undefined}) => {
942
- /* @param {string} databaseId */
943
- /* @param {string} collectionId */
944
- /* @param {string} key */
945
- /* @param {boolean} required */
946
- /* @param {string} xdefault */
947
-
948
1086
  let client = !sdk ? await sdkForProject() : sdk;
949
1087
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
950
1088
  let payload = {};
951
-
952
- /** Body Params */
953
-
954
1089
  if (typeof required !== 'undefined') {
955
1090
  payload['required'] = required;
956
1091
  }
957
-
958
-
959
1092
  if (typeof xdefault !== 'undefined') {
960
1093
  payload['default'] = xdefault;
961
1094
  }
962
1095
 
963
1096
  let response = undefined;
1097
+
964
1098
  response = await client.call('patch', apiPath, {
965
1099
  'content-type': 'application/json',
966
1100
  }, payload);
967
-
1101
+
968
1102
  if (parseOutput) {
969
1103
  parse(response)
970
1104
  success()
971
1105
  }
1106
+
972
1107
  return response;
973
1108
  }
974
1109
 
1110
+ /**
1111
+ * @typedef {Object} DatabasesCreateRelationshipAttributeRequestParams
1112
+ * @property {string} databaseId Database ID.
1113
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1114
+ * @property {string} relatedCollectionId Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1115
+ * @property {string} type Relation type
1116
+ * @property {boolean} twoWay Is Two Way?
1117
+ * @property {string} key Attribute Key.
1118
+ * @property {string} twoWayKey Two Way Attribute Key.
1119
+ * @property {string} onDelete Constraints option
1120
+ * @property {boolean} parseOutput
1121
+ * @property {libClient | undefined} sdk
1122
+ */
1123
+
1124
+ /**
1125
+ * @param {DatabasesCreateRelationshipAttributeRequestParams} params
1126
+ */
975
1127
  const databasesCreateRelationshipAttribute = async ({ databaseId, collectionId, relatedCollectionId, type, twoWay, key, twoWayKey, onDelete, parseOutput = true, sdk = undefined}) => {
976
- /* @param {string} databaseId */
977
- /* @param {string} collectionId */
978
- /* @param {string} relatedCollectionId */
979
- /* @param {string} type */
980
- /* @param {boolean} twoWay */
981
- /* @param {string} key */
982
- /* @param {string} twoWayKey */
983
- /* @param {string} onDelete */
984
-
985
1128
  let client = !sdk ? await sdkForProject() : sdk;
986
1129
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
987
1130
  let payload = {};
988
-
989
- /** Body Params */
990
-
991
1131
  if (typeof relatedCollectionId !== 'undefined') {
992
1132
  payload['relatedCollectionId'] = relatedCollectionId;
993
1133
  }
994
-
995
-
996
1134
  if (typeof type !== 'undefined') {
997
1135
  payload['type'] = type;
998
1136
  }
999
-
1000
-
1001
1137
  if (typeof twoWay !== 'undefined') {
1002
1138
  payload['twoWay'] = twoWay;
1003
1139
  }
1004
-
1005
-
1006
1140
  if (typeof key !== 'undefined') {
1007
1141
  payload['key'] = key;
1008
1142
  }
1009
-
1010
-
1011
1143
  if (typeof twoWayKey !== 'undefined') {
1012
1144
  payload['twoWayKey'] = twoWayKey;
1013
1145
  }
1014
-
1015
-
1016
1146
  if (typeof onDelete !== 'undefined') {
1017
1147
  payload['onDelete'] = onDelete;
1018
1148
  }
1019
1149
 
1020
1150
  let response = undefined;
1151
+
1021
1152
  response = await client.call('post', apiPath, {
1022
1153
  'content-type': 'application/json',
1023
1154
  }, payload);
1024
-
1155
+
1025
1156
  if (parseOutput) {
1026
1157
  parse(response)
1027
1158
  success()
1028
1159
  }
1160
+
1029
1161
  return response;
1030
1162
  }
1031
1163
 
1164
+ /**
1165
+ * @typedef {Object} DatabasesCreateStringAttributeRequestParams
1166
+ * @property {string} databaseId Database ID.
1167
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1168
+ * @property {string} key Attribute Key.
1169
+ * @property {number} size Attribute size for text attributes, in number of characters.
1170
+ * @property {boolean} required Is attribute required?
1171
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
1172
+ * @property {boolean} array Is attribute an array?
1173
+ * @property {boolean} encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.
1174
+ * @property {boolean} parseOutput
1175
+ * @property {libClient | undefined} sdk
1176
+ */
1177
+
1178
+ /**
1179
+ * @param {DatabasesCreateStringAttributeRequestParams} params
1180
+ */
1032
1181
  const databasesCreateStringAttribute = async ({ databaseId, collectionId, key, size, required, xdefault, array, encrypt, parseOutput = true, sdk = undefined}) => {
1033
- /* @param {string} databaseId */
1034
- /* @param {string} collectionId */
1035
- /* @param {string} key */
1036
- /* @param {number} size */
1037
- /* @param {boolean} required */
1038
- /* @param {string} xdefault */
1039
- /* @param {boolean} array */
1040
- /* @param {boolean} encrypt */
1041
-
1042
1182
  let client = !sdk ? await sdkForProject() : sdk;
1043
1183
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1044
1184
  let payload = {};
1045
-
1046
- /** Body Params */
1047
-
1048
1185
  if (typeof key !== 'undefined') {
1049
1186
  payload['key'] = key;
1050
1187
  }
1051
-
1052
-
1053
1188
  if (typeof size !== 'undefined') {
1054
1189
  payload['size'] = size;
1055
1190
  }
1056
-
1057
-
1058
1191
  if (typeof required !== 'undefined') {
1059
1192
  payload['required'] = required;
1060
1193
  }
1061
-
1062
-
1063
1194
  if (typeof xdefault !== 'undefined') {
1064
1195
  payload['default'] = xdefault;
1065
1196
  }
1066
-
1067
-
1068
1197
  if (typeof array !== 'undefined') {
1069
1198
  payload['array'] = array;
1070
1199
  }
1071
-
1072
-
1073
1200
  if (typeof encrypt !== 'undefined') {
1074
1201
  payload['encrypt'] = encrypt;
1075
1202
  }
1076
1203
 
1077
1204
  let response = undefined;
1205
+
1078
1206
  response = await client.call('post', apiPath, {
1079
1207
  'content-type': 'application/json',
1080
1208
  }, payload);
1081
-
1209
+
1082
1210
  if (parseOutput) {
1083
1211
  parse(response)
1084
1212
  success()
1085
1213
  }
1214
+
1086
1215
  return response;
1087
1216
  }
1088
1217
 
1218
+ /**
1219
+ * @typedef {Object} DatabasesUpdateStringAttributeRequestParams
1220
+ * @property {string} databaseId Database ID.
1221
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1222
+ * @property {string} key Attribute Key.
1223
+ * @property {boolean} required Is attribute required?
1224
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
1225
+ * @property {boolean} parseOutput
1226
+ * @property {libClient | undefined} sdk
1227
+ */
1228
+
1229
+ /**
1230
+ * @param {DatabasesUpdateStringAttributeRequestParams} params
1231
+ */
1089
1232
  const databasesUpdateStringAttribute = async ({ databaseId, collectionId, key, required, xdefault, parseOutput = true, sdk = undefined}) => {
1090
- /* @param {string} databaseId */
1091
- /* @param {string} collectionId */
1092
- /* @param {string} key */
1093
- /* @param {boolean} required */
1094
- /* @param {string} xdefault */
1095
-
1096
1233
  let client = !sdk ? await sdkForProject() : sdk;
1097
1234
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1098
1235
  let payload = {};
1099
-
1100
- /** Body Params */
1101
-
1102
1236
  if (typeof required !== 'undefined') {
1103
1237
  payload['required'] = required;
1104
1238
  }
1105
-
1106
-
1107
1239
  if (typeof xdefault !== 'undefined') {
1108
1240
  payload['default'] = xdefault;
1109
1241
  }
1110
1242
 
1111
1243
  let response = undefined;
1244
+
1112
1245
  response = await client.call('patch', apiPath, {
1113
1246
  'content-type': 'application/json',
1114
1247
  }, payload);
1115
-
1248
+
1116
1249
  if (parseOutput) {
1117
1250
  parse(response)
1118
1251
  success()
1119
1252
  }
1253
+
1120
1254
  return response;
1121
1255
  }
1122
1256
 
1257
+ /**
1258
+ * @typedef {Object} DatabasesCreateUrlAttributeRequestParams
1259
+ * @property {string} databaseId Database ID.
1260
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1261
+ * @property {string} key Attribute Key.
1262
+ * @property {boolean} required Is attribute required?
1263
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
1264
+ * @property {boolean} array Is attribute an array?
1265
+ * @property {boolean} parseOutput
1266
+ * @property {libClient | undefined} sdk
1267
+ */
1268
+
1269
+ /**
1270
+ * @param {DatabasesCreateUrlAttributeRequestParams} params
1271
+ */
1123
1272
  const databasesCreateUrlAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
1124
- /* @param {string} databaseId */
1125
- /* @param {string} collectionId */
1126
- /* @param {string} key */
1127
- /* @param {boolean} required */
1128
- /* @param {string} xdefault */
1129
- /* @param {boolean} array */
1130
-
1131
1273
  let client = !sdk ? await sdkForProject() : sdk;
1132
1274
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1133
1275
  let payload = {};
1134
-
1135
- /** Body Params */
1136
-
1137
1276
  if (typeof key !== 'undefined') {
1138
1277
  payload['key'] = key;
1139
1278
  }
1140
-
1141
-
1142
1279
  if (typeof required !== 'undefined') {
1143
1280
  payload['required'] = required;
1144
1281
  }
1145
-
1146
-
1147
1282
  if (typeof xdefault !== 'undefined') {
1148
1283
  payload['default'] = xdefault;
1149
1284
  }
1150
-
1151
-
1152
1285
  if (typeof array !== 'undefined') {
1153
1286
  payload['array'] = array;
1154
1287
  }
1155
1288
 
1156
1289
  let response = undefined;
1290
+
1157
1291
  response = await client.call('post', apiPath, {
1158
1292
  'content-type': 'application/json',
1159
1293
  }, payload);
1160
-
1294
+
1161
1295
  if (parseOutput) {
1162
1296
  parse(response)
1163
1297
  success()
1164
1298
  }
1299
+
1165
1300
  return response;
1166
1301
  }
1167
1302
 
1303
+ /**
1304
+ * @typedef {Object} DatabasesUpdateUrlAttributeRequestParams
1305
+ * @property {string} databaseId Database ID.
1306
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1307
+ * @property {string} key Attribute Key.
1308
+ * @property {boolean} required Is attribute required?
1309
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
1310
+ * @property {boolean} parseOutput
1311
+ * @property {libClient | undefined} sdk
1312
+ */
1313
+
1314
+ /**
1315
+ * @param {DatabasesUpdateUrlAttributeRequestParams} params
1316
+ */
1168
1317
  const databasesUpdateUrlAttribute = async ({ databaseId, collectionId, key, required, xdefault, parseOutput = true, sdk = undefined}) => {
1169
- /* @param {string} databaseId */
1170
- /* @param {string} collectionId */
1171
- /* @param {string} key */
1172
- /* @param {boolean} required */
1173
- /* @param {string} xdefault */
1174
-
1175
1318
  let client = !sdk ? await sdkForProject() : sdk;
1176
1319
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1177
1320
  let payload = {};
1178
-
1179
- /** Body Params */
1180
-
1181
1321
  if (typeof required !== 'undefined') {
1182
1322
  payload['required'] = required;
1183
1323
  }
1184
-
1185
-
1186
1324
  if (typeof xdefault !== 'undefined') {
1187
1325
  payload['default'] = xdefault;
1188
1326
  }
1189
1327
 
1190
1328
  let response = undefined;
1329
+
1191
1330
  response = await client.call('patch', apiPath, {
1192
1331
  'content-type': 'application/json',
1193
1332
  }, payload);
1194
-
1333
+
1195
1334
  if (parseOutput) {
1196
1335
  parse(response)
1197
1336
  success()
1198
1337
  }
1338
+
1199
1339
  return response;
1200
1340
  }
1201
1341
 
1342
+ /**
1343
+ * @typedef {Object} DatabasesGetAttributeRequestParams
1344
+ * @property {string} databaseId Database ID.
1345
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1346
+ * @property {string} key Attribute Key.
1347
+ * @property {boolean} parseOutput
1348
+ * @property {libClient | undefined} sdk
1349
+ */
1350
+
1351
+ /**
1352
+ * @param {DatabasesGetAttributeRequestParams} params
1353
+ */
1202
1354
  const databasesGetAttribute = async ({ databaseId, collectionId, key, parseOutput = true, sdk = undefined}) => {
1203
- /* @param {string} databaseId */
1204
- /* @param {string} collectionId */
1205
- /* @param {string} key */
1206
-
1207
1355
  let client = !sdk ? await sdkForProject() : sdk;
1208
1356
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1209
1357
  let payload = {};
1358
+
1210
1359
  let response = undefined;
1360
+
1211
1361
  response = await client.call('get', apiPath, {
1212
1362
  'content-type': 'application/json',
1213
1363
  }, payload);
1214
-
1364
+
1215
1365
  if (parseOutput) {
1216
1366
  parse(response)
1217
1367
  success()
1218
1368
  }
1369
+
1219
1370
  return response;
1220
1371
  }
1221
1372
 
1373
+ /**
1374
+ * @typedef {Object} DatabasesDeleteAttributeRequestParams
1375
+ * @property {string} databaseId Database ID.
1376
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1377
+ * @property {string} key Attribute Key.
1378
+ * @property {boolean} parseOutput
1379
+ * @property {libClient | undefined} sdk
1380
+ */
1381
+
1382
+ /**
1383
+ * @param {DatabasesDeleteAttributeRequestParams} params
1384
+ */
1222
1385
  const databasesDeleteAttribute = async ({ databaseId, collectionId, key, parseOutput = true, sdk = undefined}) => {
1223
- /* @param {string} databaseId */
1224
- /* @param {string} collectionId */
1225
- /* @param {string} key */
1226
-
1227
1386
  let client = !sdk ? await sdkForProject() : sdk;
1228
1387
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1229
1388
  let payload = {};
1389
+
1230
1390
  let response = undefined;
1391
+
1231
1392
  response = await client.call('delete', apiPath, {
1232
1393
  'content-type': 'application/json',
1233
1394
  }, payload);
1234
-
1395
+
1235
1396
  if (parseOutput) {
1236
1397
  parse(response)
1237
1398
  success()
1238
1399
  }
1400
+
1239
1401
  return response;
1240
1402
  }
1241
1403
 
1404
+ /**
1405
+ * @typedef {Object} DatabasesUpdateRelationshipAttributeRequestParams
1406
+ * @property {string} databaseId Database ID.
1407
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1408
+ * @property {string} key Attribute Key.
1409
+ * @property {string} onDelete Constraints option
1410
+ * @property {boolean} parseOutput
1411
+ * @property {libClient | undefined} sdk
1412
+ */
1413
+
1414
+ /**
1415
+ * @param {DatabasesUpdateRelationshipAttributeRequestParams} params
1416
+ */
1242
1417
  const databasesUpdateRelationshipAttribute = async ({ databaseId, collectionId, key, onDelete, parseOutput = true, sdk = undefined}) => {
1243
- /* @param {string} databaseId */
1244
- /* @param {string} collectionId */
1245
- /* @param {string} key */
1246
- /* @param {string} onDelete */
1247
-
1248
1418
  let client = !sdk ? await sdkForProject() : sdk;
1249
1419
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1250
1420
  let payload = {};
1251
-
1252
- /** Body Params */
1253
-
1254
1421
  if (typeof onDelete !== 'undefined') {
1255
1422
  payload['onDelete'] = onDelete;
1256
1423
  }
1257
1424
 
1258
1425
  let response = undefined;
1426
+
1259
1427
  response = await client.call('patch', apiPath, {
1260
1428
  'content-type': 'application/json',
1261
1429
  }, payload);
1262
-
1430
+
1263
1431
  if (parseOutput) {
1264
1432
  parse(response)
1265
1433
  success()
1266
1434
  }
1435
+
1267
1436
  return response;
1268
1437
  }
1269
1438
 
1439
+ /**
1440
+ * @typedef {Object} DatabasesListDocumentsRequestParams
1441
+ * @property {string} databaseId Database ID.
1442
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1443
+ * @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.
1444
+ * @property {boolean} parseOutput
1445
+ * @property {libClient | undefined} sdk
1446
+ */
1447
+
1448
+ /**
1449
+ * @param {DatabasesListDocumentsRequestParams} params
1450
+ */
1270
1451
  const databasesListDocuments = async ({ databaseId, collectionId, queries, parseOutput = true, sdk = undefined}) => {
1271
- /* @param {string} databaseId */
1272
- /* @param {string} collectionId */
1273
- /* @param {string[]} queries */
1274
-
1275
1452
  let client = !sdk ? await sdkForProject() : sdk;
1276
1453
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1277
1454
  let payload = {};
1278
-
1279
- /** Query Params */
1280
1455
  if (typeof queries !== 'undefined') {
1281
1456
  payload['queries'] = queries;
1282
1457
  }
1458
+
1283
1459
  let response = undefined;
1460
+
1284
1461
  response = await client.call('get', apiPath, {
1285
1462
  'content-type': 'application/json',
1286
1463
  }, payload);
1287
-
1464
+
1288
1465
  if (parseOutput) {
1289
1466
  parse(response)
1290
1467
  success()
1291
1468
  }
1469
+
1292
1470
  return response;
1293
1471
  }
1294
1472
 
1473
+ /**
1474
+ * @typedef {Object} DatabasesCreateDocumentRequestParams
1475
+ * @property {string} databaseId Database ID.
1476
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
1477
+ * @property {string} documentId Document 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.
1478
+ * @property {object} data Document data as JSON object.
1479
+ * @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).
1480
+ * @property {boolean} parseOutput
1481
+ * @property {libClient | undefined} sdk
1482
+ */
1483
+
1484
+ /**
1485
+ * @param {DatabasesCreateDocumentRequestParams} params
1486
+ */
1295
1487
  const databasesCreateDocument = async ({ databaseId, collectionId, documentId, data, permissions, parseOutput = true, sdk = undefined}) => {
1296
- /* @param {string} databaseId */
1297
- /* @param {string} collectionId */
1298
- /* @param {string} documentId */
1299
- /* @param {object} data */
1300
- /* @param {string[]} permissions */
1301
-
1302
1488
  let client = !sdk ? await sdkForProject() : sdk;
1303
1489
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1304
1490
  let payload = {};
1305
-
1306
- /** Body Params */
1307
-
1308
1491
  if (typeof documentId !== 'undefined') {
1309
1492
  payload['documentId'] = documentId;
1310
1493
  }
1311
-
1312
1494
  if (typeof data !== 'undefined') {
1313
1495
  payload['data'] = JSON.parse(data);
1314
1496
  }
1315
-
1316
1497
  permissions = permissions === true ? [] : permissions;
1317
-
1318
1498
  if (typeof permissions !== 'undefined') {
1319
1499
  payload['permissions'] = permissions;
1320
1500
  }
1321
1501
 
1322
1502
  let response = undefined;
1503
+
1323
1504
  response = await client.call('post', apiPath, {
1324
1505
  'content-type': 'application/json',
1325
1506
  }, payload);
1326
-
1507
+
1327
1508
  if (parseOutput) {
1328
1509
  parse(response)
1329
1510
  success()
1330
1511
  }
1512
+
1331
1513
  return response;
1332
1514
  }
1333
1515
 
1516
+ /**
1517
+ * @typedef {Object} DatabasesGetDocumentRequestParams
1518
+ * @property {string} databaseId Database ID.
1519
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1520
+ * @property {string} documentId Document ID.
1521
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only method allowed is select.
1522
+ * @property {boolean} parseOutput
1523
+ * @property {libClient | undefined} sdk
1524
+ */
1525
+
1526
+ /**
1527
+ * @param {DatabasesGetDocumentRequestParams} params
1528
+ */
1334
1529
  const databasesGetDocument = async ({ databaseId, collectionId, documentId, queries, parseOutput = true, sdk = undefined}) => {
1335
- /* @param {string} databaseId */
1336
- /* @param {string} collectionId */
1337
- /* @param {string} documentId */
1338
- /* @param {string[]} queries */
1339
-
1340
1530
  let client = !sdk ? await sdkForProject() : sdk;
1341
1531
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1342
1532
  let payload = {};
1343
-
1344
- /** Query Params */
1345
1533
  if (typeof queries !== 'undefined') {
1346
1534
  payload['queries'] = queries;
1347
1535
  }
1536
+
1348
1537
  let response = undefined;
1538
+
1349
1539
  response = await client.call('get', apiPath, {
1350
1540
  'content-type': 'application/json',
1351
1541
  }, payload);
1352
-
1542
+
1353
1543
  if (parseOutput) {
1354
1544
  parse(response)
1355
1545
  success()
1356
1546
  }
1547
+
1357
1548
  return response;
1358
1549
  }
1359
1550
 
1551
+ /**
1552
+ * @typedef {Object} DatabasesUpdateDocumentRequestParams
1553
+ * @property {string} databaseId Database ID.
1554
+ * @property {string} collectionId Collection ID.
1555
+ * @property {string} documentId Document ID.
1556
+ * @property {object} data Document data as JSON object. Include only attribute and value pairs to be updated.
1557
+ * @property {string[]} permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
1558
+ * @property {boolean} parseOutput
1559
+ * @property {libClient | undefined} sdk
1560
+ */
1561
+
1562
+ /**
1563
+ * @param {DatabasesUpdateDocumentRequestParams} params
1564
+ */
1360
1565
  const databasesUpdateDocument = async ({ databaseId, collectionId, documentId, data, permissions, parseOutput = true, sdk = undefined}) => {
1361
- /* @param {string} databaseId */
1362
- /* @param {string} collectionId */
1363
- /* @param {string} documentId */
1364
- /* @param {object} data */
1365
- /* @param {string[]} permissions */
1366
-
1367
1566
  let client = !sdk ? await sdkForProject() : sdk;
1368
1567
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1369
1568
  let payload = {};
1370
-
1371
- /** Body Params */
1372
1569
  if (typeof data !== 'undefined') {
1373
1570
  payload['data'] = JSON.parse(data);
1374
1571
  }
1375
-
1376
1572
  permissions = permissions === true ? [] : permissions;
1377
-
1378
1573
  if (typeof permissions !== 'undefined') {
1379
1574
  payload['permissions'] = permissions;
1380
1575
  }
1381
1576
 
1382
1577
  let response = undefined;
1578
+
1383
1579
  response = await client.call('patch', apiPath, {
1384
1580
  'content-type': 'application/json',
1385
1581
  }, payload);
1386
-
1582
+
1387
1583
  if (parseOutput) {
1388
1584
  parse(response)
1389
1585
  success()
1390
1586
  }
1587
+
1391
1588
  return response;
1392
1589
  }
1393
1590
 
1591
+ /**
1592
+ * @typedef {Object} DatabasesDeleteDocumentRequestParams
1593
+ * @property {string} databaseId Database ID.
1594
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1595
+ * @property {string} documentId Document ID.
1596
+ * @property {boolean} parseOutput
1597
+ * @property {libClient | undefined} sdk
1598
+ */
1599
+
1600
+ /**
1601
+ * @param {DatabasesDeleteDocumentRequestParams} params
1602
+ */
1394
1603
  const databasesDeleteDocument = async ({ databaseId, collectionId, documentId, parseOutput = true, sdk = undefined}) => {
1395
- /* @param {string} databaseId */
1396
- /* @param {string} collectionId */
1397
- /* @param {string} documentId */
1398
-
1399
1604
  let client = !sdk ? await sdkForProject() : sdk;
1400
1605
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1401
1606
  let payload = {};
1607
+
1402
1608
  let response = undefined;
1609
+
1403
1610
  response = await client.call('delete', apiPath, {
1404
1611
  'content-type': 'application/json',
1405
1612
  }, payload);
1406
-
1613
+
1407
1614
  if (parseOutput) {
1408
1615
  parse(response)
1409
1616
  success()
1410
1617
  }
1618
+
1411
1619
  return response;
1412
1620
  }
1413
1621
 
1622
+ /**
1623
+ * @typedef {Object} DatabasesListDocumentLogsRequestParams
1624
+ * @property {string} databaseId Database ID.
1625
+ * @property {string} collectionId Collection ID.
1626
+ * @property {string} documentId Document ID.
1627
+ * @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
1628
+ * @property {boolean} parseOutput
1629
+ * @property {libClient | undefined} sdk
1630
+ */
1631
+
1632
+ /**
1633
+ * @param {DatabasesListDocumentLogsRequestParams} params
1634
+ */
1414
1635
  const databasesListDocumentLogs = async ({ databaseId, collectionId, documentId, queries, parseOutput = true, sdk = undefined}) => {
1415
- /* @param {string} databaseId */
1416
- /* @param {string} collectionId */
1417
- /* @param {string} documentId */
1418
- /* @param {string[]} queries */
1419
-
1420
1636
  let client = !sdk ? await sdkForProject() : sdk;
1421
1637
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1422
1638
  let payload = {};
1423
-
1424
- /** Query Params */
1425
1639
  if (typeof queries !== 'undefined') {
1426
1640
  payload['queries'] = queries;
1427
1641
  }
1642
+
1428
1643
  let response = undefined;
1644
+
1429
1645
  response = await client.call('get', apiPath, {
1430
1646
  'content-type': 'application/json',
1431
1647
  }, payload);
1432
-
1648
+
1433
1649
  if (parseOutput) {
1434
1650
  parse(response)
1435
1651
  success()
1436
1652
  }
1653
+
1437
1654
  return response;
1438
1655
  }
1439
1656
 
1657
+ /**
1658
+ * @typedef {Object} DatabasesListIndexesRequestParams
1659
+ * @property {string} databaseId Database ID.
1660
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1661
+ * @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
1662
+ * @property {boolean} parseOutput
1663
+ * @property {libClient | undefined} sdk
1664
+ */
1665
+
1666
+ /**
1667
+ * @param {DatabasesListIndexesRequestParams} params
1668
+ */
1440
1669
  const databasesListIndexes = async ({ databaseId, collectionId, queries, parseOutput = true, sdk = undefined}) => {
1441
- /* @param {string} databaseId */
1442
- /* @param {string} collectionId */
1443
- /* @param {string[]} queries */
1444
-
1445
1670
  let client = !sdk ? await sdkForProject() : sdk;
1446
1671
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1447
1672
  let payload = {};
1448
-
1449
- /** Query Params */
1450
1673
  if (typeof queries !== 'undefined') {
1451
1674
  payload['queries'] = queries;
1452
1675
  }
1676
+
1453
1677
  let response = undefined;
1678
+
1454
1679
  response = await client.call('get', apiPath, {
1455
1680
  'content-type': 'application/json',
1456
1681
  }, payload);
1457
-
1682
+
1458
1683
  if (parseOutput) {
1459
1684
  parse(response)
1460
1685
  success()
1461
1686
  }
1687
+
1462
1688
  return response;
1463
1689
  }
1464
1690
 
1691
+ /**
1692
+ * @typedef {Object} DatabasesCreateIndexRequestParams
1693
+ * @property {string} databaseId Database ID.
1694
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1695
+ * @property {string} key Index Key.
1696
+ * @property {string} type Index type.
1697
+ * @property {string[]} attributes Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.
1698
+ * @property {string[]} orders Array of index orders. Maximum of 100 orders are allowed.
1699
+ * @property {boolean} parseOutput
1700
+ * @property {libClient | undefined} sdk
1701
+ */
1702
+
1703
+ /**
1704
+ * @param {DatabasesCreateIndexRequestParams} params
1705
+ */
1465
1706
  const databasesCreateIndex = async ({ databaseId, collectionId, key, type, attributes, orders, parseOutput = true, sdk = undefined}) => {
1466
- /* @param {string} databaseId */
1467
- /* @param {string} collectionId */
1468
- /* @param {string} key */
1469
- /* @param {string} type */
1470
- /* @param {string[]} attributes */
1471
- /* @param {string[]} orders */
1472
-
1473
1707
  let client = !sdk ? await sdkForProject() : sdk;
1474
1708
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1475
1709
  let payload = {};
1476
-
1477
- /** Body Params */
1478
-
1479
1710
  if (typeof key !== 'undefined') {
1480
1711
  payload['key'] = key;
1481
1712
  }
1482
-
1483
-
1484
1713
  if (typeof type !== 'undefined') {
1485
1714
  payload['type'] = type;
1486
1715
  }
1487
-
1488
1716
  attributes = attributes === true ? [] : attributes;
1489
-
1490
1717
  if (typeof attributes !== 'undefined') {
1491
1718
  payload['attributes'] = attributes;
1492
1719
  }
1493
-
1494
1720
  orders = orders === true ? [] : orders;
1495
-
1496
1721
  if (typeof orders !== 'undefined') {
1497
1722
  payload['orders'] = orders;
1498
1723
  }
1499
1724
 
1500
1725
  let response = undefined;
1726
+
1501
1727
  response = await client.call('post', apiPath, {
1502
1728
  'content-type': 'application/json',
1503
1729
  }, payload);
1504
-
1730
+
1505
1731
  if (parseOutput) {
1506
1732
  parse(response)
1507
1733
  success()
1508
1734
  }
1735
+
1509
1736
  return response;
1510
1737
  }
1511
1738
 
1739
+ /**
1740
+ * @typedef {Object} DatabasesGetIndexRequestParams
1741
+ * @property {string} databaseId Database ID.
1742
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1743
+ * @property {string} key Index Key.
1744
+ * @property {boolean} parseOutput
1745
+ * @property {libClient | undefined} sdk
1746
+ */
1747
+
1748
+ /**
1749
+ * @param {DatabasesGetIndexRequestParams} params
1750
+ */
1512
1751
  const databasesGetIndex = async ({ databaseId, collectionId, key, parseOutput = true, sdk = undefined}) => {
1513
- /* @param {string} databaseId */
1514
- /* @param {string} collectionId */
1515
- /* @param {string} key */
1516
-
1517
1752
  let client = !sdk ? await sdkForProject() : sdk;
1518
1753
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1519
1754
  let payload = {};
1755
+
1520
1756
  let response = undefined;
1757
+
1521
1758
  response = await client.call('get', apiPath, {
1522
1759
  'content-type': 'application/json',
1523
1760
  }, payload);
1524
-
1761
+
1525
1762
  if (parseOutput) {
1526
1763
  parse(response)
1527
1764
  success()
1528
1765
  }
1766
+
1529
1767
  return response;
1530
1768
  }
1531
1769
 
1770
+ /**
1771
+ * @typedef {Object} DatabasesDeleteIndexRequestParams
1772
+ * @property {string} databaseId Database ID.
1773
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1774
+ * @property {string} key Index Key.
1775
+ * @property {boolean} parseOutput
1776
+ * @property {libClient | undefined} sdk
1777
+ */
1778
+
1779
+ /**
1780
+ * @param {DatabasesDeleteIndexRequestParams} params
1781
+ */
1532
1782
  const databasesDeleteIndex = async ({ databaseId, collectionId, key, parseOutput = true, sdk = undefined}) => {
1533
- /* @param {string} databaseId */
1534
- /* @param {string} collectionId */
1535
- /* @param {string} key */
1536
-
1537
1783
  let client = !sdk ? await sdkForProject() : sdk;
1538
1784
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1539
1785
  let payload = {};
1786
+
1540
1787
  let response = undefined;
1788
+
1541
1789
  response = await client.call('delete', apiPath, {
1542
1790
  'content-type': 'application/json',
1543
1791
  }, payload);
1544
-
1792
+
1545
1793
  if (parseOutput) {
1546
1794
  parse(response)
1547
1795
  success()
1548
1796
  }
1797
+
1549
1798
  return response;
1550
1799
  }
1551
1800
 
1801
+ /**
1802
+ * @typedef {Object} DatabasesListCollectionLogsRequestParams
1803
+ * @property {string} databaseId Database ID.
1804
+ * @property {string} collectionId Collection ID.
1805
+ * @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
1806
+ * @property {boolean} parseOutput
1807
+ * @property {libClient | undefined} sdk
1808
+ */
1809
+
1810
+ /**
1811
+ * @param {DatabasesListCollectionLogsRequestParams} params
1812
+ */
1552
1813
  const databasesListCollectionLogs = async ({ databaseId, collectionId, queries, parseOutput = true, sdk = undefined}) => {
1553
- /* @param {string} databaseId */
1554
- /* @param {string} collectionId */
1555
- /* @param {string[]} queries */
1556
-
1557
1814
  let client = !sdk ? await sdkForProject() : sdk;
1558
1815
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1559
1816
  let payload = {};
1560
-
1561
- /** Query Params */
1562
1817
  if (typeof queries !== 'undefined') {
1563
1818
  payload['queries'] = queries;
1564
1819
  }
1820
+
1565
1821
  let response = undefined;
1822
+
1566
1823
  response = await client.call('get', apiPath, {
1567
1824
  'content-type': 'application/json',
1568
1825
  }, payload);
1569
-
1826
+
1570
1827
  if (parseOutput) {
1571
1828
  parse(response)
1572
1829
  success()
1573
1830
  }
1831
+
1574
1832
  return response;
1575
1833
  }
1576
1834
 
1835
+ /**
1836
+ * @typedef {Object} DatabasesGetCollectionUsageRequestParams
1837
+ * @property {string} databaseId Database ID.
1838
+ * @property {string} collectionId Collection ID.
1839
+ * @property {string} range Date range.
1840
+ * @property {boolean} parseOutput
1841
+ * @property {libClient | undefined} sdk
1842
+ */
1843
+
1844
+ /**
1845
+ * @param {DatabasesGetCollectionUsageRequestParams} params
1846
+ */
1577
1847
  const databasesGetCollectionUsage = async ({ databaseId, collectionId, range, parseOutput = true, sdk = undefined}) => {
1578
- /* @param {string} databaseId */
1579
- /* @param {string} collectionId */
1580
- /* @param {string} range */
1581
-
1582
1848
  let client = !sdk ? await sdkForProject() : sdk;
1583
1849
  let apiPath = '/databases/{databaseId}/collections/{collectionId}/usage'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1584
1850
  let payload = {};
1585
-
1586
- /** Query Params */
1587
1851
  if (typeof range !== 'undefined') {
1588
1852
  payload['range'] = range;
1589
1853
  }
1854
+
1590
1855
  let response = undefined;
1856
+
1591
1857
  response = await client.call('get', apiPath, {
1592
1858
  'content-type': 'application/json',
1593
1859
  }, payload);
1594
-
1860
+
1595
1861
  if (parseOutput) {
1596
1862
  parse(response)
1597
1863
  success()
1598
1864
  }
1865
+
1599
1866
  return response;
1600
1867
  }
1601
1868
 
1869
+ /**
1870
+ * @typedef {Object} DatabasesListLogsRequestParams
1871
+ * @property {string} databaseId Database ID.
1872
+ * @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
1873
+ * @property {boolean} parseOutput
1874
+ * @property {libClient | undefined} sdk
1875
+ */
1876
+
1877
+ /**
1878
+ * @param {DatabasesListLogsRequestParams} params
1879
+ */
1602
1880
  const databasesListLogs = async ({ databaseId, queries, parseOutput = true, sdk = undefined}) => {
1603
- /* @param {string} databaseId */
1604
- /* @param {string[]} queries */
1605
-
1606
1881
  let client = !sdk ? await sdkForProject() : sdk;
1607
1882
  let apiPath = '/databases/{databaseId}/logs'.replace('{databaseId}', databaseId);
1608
1883
  let payload = {};
1609
-
1610
- /** Query Params */
1611
1884
  if (typeof queries !== 'undefined') {
1612
1885
  payload['queries'] = queries;
1613
1886
  }
1887
+
1614
1888
  let response = undefined;
1889
+
1615
1890
  response = await client.call('get', apiPath, {
1616
1891
  'content-type': 'application/json',
1617
1892
  }, payload);
1618
-
1893
+
1619
1894
  if (parseOutput) {
1620
1895
  parse(response)
1621
1896
  success()
1622
1897
  }
1898
+
1623
1899
  return response;
1624
1900
  }
1625
1901
 
1902
+ /**
1903
+ * @typedef {Object} DatabasesGetDatabaseUsageRequestParams
1904
+ * @property {string} databaseId Database ID.
1905
+ * @property {string} range 'Date range.
1906
+ * @property {boolean} parseOutput
1907
+ * @property {libClient | undefined} sdk
1908
+ */
1909
+
1910
+ /**
1911
+ * @param {DatabasesGetDatabaseUsageRequestParams} params
1912
+ */
1626
1913
  const databasesGetDatabaseUsage = async ({ databaseId, range, parseOutput = true, sdk = undefined}) => {
1627
- /* @param {string} databaseId */
1628
- /* @param {string} range */
1629
-
1630
1914
  let client = !sdk ? await sdkForProject() : sdk;
1631
1915
  let apiPath = '/databases/{databaseId}/usage'.replace('{databaseId}', databaseId);
1632
1916
  let payload = {};
1633
-
1634
- /** Query Params */
1635
1917
  if (typeof range !== 'undefined') {
1636
1918
  payload['range'] = range;
1637
1919
  }
1920
+
1638
1921
  let response = undefined;
1922
+
1639
1923
  response = await client.call('get', apiPath, {
1640
1924
  'content-type': 'application/json',
1641
1925
  }, payload);
1642
-
1926
+
1643
1927
  if (parseOutput) {
1644
1928
  parse(response)
1645
1929
  success()
1646
1930
  }
1931
+
1647
1932
  return response;
1648
1933
  }
1649
1934
 
1650
-
1651
1935
  databases
1652
1936
  .command(`list`)
1653
1937
  .description(`Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.`)
@@ -1810,7 +2094,7 @@ databases
1810
2094
  .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1811
2095
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1812
2096
  .requiredOption(`--key <key>`, `Attribute Key.`)
1813
- .requiredOption(`--elements [elements...]`, `Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 4096 characters long.`)
2097
+ .requiredOption(`--elements [elements...]`, `Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long.`)
1814
2098
  .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1815
2099
  .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
1816
2100
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
@@ -1822,7 +2106,7 @@ databases
1822
2106
  .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1823
2107
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1824
2108
  .requiredOption(`--key <key>`, `Attribute Key.`)
1825
- .requiredOption(`--elements [elements...]`, `Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 4096 characters long.`)
2109
+ .requiredOption(`--elements [elements...]`, `Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long.`)
1826
2110
  .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1827
2111
  .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
1828
2112
  .action(actionRunner(databasesUpdateEnumAttribute))
@@ -2099,7 +2383,6 @@ databases
2099
2383
  .option(`--range <range>`, `'Date range.`)
2100
2384
  .action(actionRunner(databasesGetDatabaseUsage))
2101
2385
 
2102
-
2103
2386
  module.exports = {
2104
2387
  databases,
2105
2388
  databasesList,
@@ -2150,4 +2433,4 @@ module.exports = {
2150
2433
  databasesGetCollectionUsage,
2151
2434
  databasesListLogs,
2152
2435
  databasesGetDatabaseUsage
2153
- };
2436
+ };