appwrite-cli 4.1.0 → 4.2.1

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