node-appwrite 17.2.0 → 18.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/README.md +67 -2
  2. package/dist/client.js +3 -3
  3. package/dist/client.js.map +1 -1
  4. package/dist/client.mjs +3 -3
  5. package/dist/client.mjs.map +1 -1
  6. package/dist/enums/{v-c-s-deployment-type.js → vcs-deployment-type.js} +1 -1
  7. package/dist/enums/vcs-deployment-type.js.map +1 -0
  8. package/dist/enums/{v-c-s-deployment-type.mjs → vcs-deployment-type.mjs} +2 -2
  9. package/dist/enums/vcs-deployment-type.mjs.map +1 -0
  10. package/dist/index.d.mts +2 -1
  11. package/dist/index.d.ts +2 -1
  12. package/dist/index.js +7 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.mjs +2 -1
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/models.d.mts +717 -58
  17. package/dist/models.d.ts +717 -58
  18. package/dist/query.d.mts +70 -0
  19. package/dist/query.d.ts +70 -0
  20. package/dist/query.js +70 -0
  21. package/dist/query.js.map +1 -1
  22. package/dist/query.mjs +70 -0
  23. package/dist/query.mjs.map +1 -1
  24. package/dist/services/account.d.mts +625 -70
  25. package/dist/services/account.d.ts +625 -70
  26. package/dist/services/account.js +592 -292
  27. package/dist/services/account.js.map +1 -1
  28. package/dist/services/account.mjs +592 -292
  29. package/dist/services/account.mjs.map +1 -1
  30. package/dist/services/avatars.d.mts +157 -26
  31. package/dist/services/avatars.d.ts +157 -26
  32. package/dist/services/avatars.js +104 -93
  33. package/dist/services/avatars.js.map +1 -1
  34. package/dist/services/avatars.mjs +104 -93
  35. package/dist/services/avatars.mjs.map +1 -1
  36. package/dist/services/databases.d.mts +1224 -248
  37. package/dist/services/databases.d.ts +1224 -248
  38. package/dist/services/databases.js +877 -611
  39. package/dist/services/databases.js.map +1 -1
  40. package/dist/services/databases.mjs +877 -611
  41. package/dist/services/databases.mjs.map +1 -1
  42. package/dist/services/functions.d.mts +530 -107
  43. package/dist/services/functions.d.ts +530 -107
  44. package/dist/services/functions.js +393 -276
  45. package/dist/services/functions.js.map +1 -1
  46. package/dist/services/functions.mjs +393 -276
  47. package/dist/services/functions.mjs.map +1 -1
  48. package/dist/services/graphql.d.mts +24 -2
  49. package/dist/services/graphql.d.ts +24 -2
  50. package/dist/services/graphql.js +20 -16
  51. package/dist/services/graphql.js.map +1 -1
  52. package/dist/services/graphql.mjs +20 -16
  53. package/dist/services/graphql.mjs.map +1 -1
  54. package/dist/services/health.d.mts +175 -16
  55. package/dist/services/health.d.ts +175 -16
  56. package/dist/services/health.js +144 -115
  57. package/dist/services/health.js.map +1 -1
  58. package/dist/services/health.mjs +144 -115
  59. package/dist/services/health.mjs.map +1 -1
  60. package/dist/services/locale.js.map +1 -1
  61. package/dist/services/locale.mjs.map +1 -1
  62. package/dist/services/messaging.d.mts +1544 -262
  63. package/dist/services/messaging.d.ts +1544 -262
  64. package/dist/services/messaging.js +1417 -592
  65. package/dist/services/messaging.js.map +1 -1
  66. package/dist/services/messaging.mjs +1417 -592
  67. package/dist/services/messaging.mjs.map +1 -1
  68. package/dist/services/sites.d.mts +495 -99
  69. package/dist/services/sites.d.ts +495 -99
  70. package/dist/services/sites.js +371 -258
  71. package/dist/services/sites.js.map +1 -1
  72. package/dist/services/sites.mjs +371 -258
  73. package/dist/services/sites.mjs.map +1 -1
  74. package/dist/services/storage.d.mts +306 -63
  75. package/dist/services/storage.d.ts +306 -63
  76. package/dist/services/storage.js +225 -158
  77. package/dist/services/storage.js.map +1 -1
  78. package/dist/services/storage.mjs +225 -158
  79. package/dist/services/storage.mjs.map +1 -1
  80. package/dist/services/tables-db.d.mts +1549 -0
  81. package/dist/services/tables-db.d.ts +1549 -0
  82. package/dist/services/tables-db.js +2374 -0
  83. package/dist/services/tables-db.js.map +1 -0
  84. package/dist/services/tables-db.mjs +2373 -0
  85. package/dist/services/tables-db.mjs.map +1 -0
  86. package/dist/services/teams.d.mts +233 -39
  87. package/dist/services/teams.d.ts +233 -39
  88. package/dist/services/teams.js +170 -135
  89. package/dist/services/teams.js.map +1 -1
  90. package/dist/services/teams.mjs +170 -135
  91. package/dist/services/teams.mjs.map +1 -1
  92. package/dist/services/tokens.d.mts +76 -11
  93. package/dist/services/tokens.d.ts +76 -11
  94. package/dist/services/tokens.js +60 -45
  95. package/dist/services/tokens.js.map +1 -1
  96. package/dist/services/tokens.mjs +60 -45
  97. package/dist/services/tokens.mjs.map +1 -1
  98. package/dist/services/users.d.mts +842 -115
  99. package/dist/services/users.d.ts +842 -115
  100. package/dist/services/users.js +719 -408
  101. package/dist/services/users.js.map +1 -1
  102. package/dist/services/users.mjs +719 -408
  103. package/dist/services/users.mjs.map +1 -1
  104. package/package.json +1 -1
  105. package/dist/enums/v-c-s-deployment-type.js.map +0 -1
  106. package/dist/enums/v-c-s-deployment-type.mjs.map +0 -1
  107. /package/dist/enums/{v-c-s-deployment-type.d.mts → vcs-deployment-type.d.mts} +0 -0
  108. /package/dist/enums/{v-c-s-deployment-type.d.ts → vcs-deployment-type.d.ts} +0 -0
@@ -6,15 +6,18 @@ class Functions {
6
6
  constructor(client) {
7
7
  this.client = client;
8
8
  }
9
- /**
10
- * Get a list of all the project's functions. You can use the query params to filter your results.
11
- *
12
- * @param {string[]} queries
13
- * @param {string} search
14
- * @throws {AppwriteException}
15
- * @returns {Promise<Models.FunctionList>}
16
- */
17
- list(queries, search) {
9
+ list(paramsOrFirst, ...rest) {
10
+ let params;
11
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
12
+ params = paramsOrFirst || {};
13
+ } else {
14
+ params = {
15
+ queries: paramsOrFirst,
16
+ search: rest[0]
17
+ };
18
+ }
19
+ const queries = params.queries;
20
+ const search = params.search;
18
21
  const apiPath = "/functions";
19
22
  const payload = {};
20
23
  if (typeof queries !== "undefined") {
@@ -32,31 +35,50 @@ class Functions {
32
35
  payload
33
36
  );
34
37
  }
35
- /**
36
- * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API.
37
- *
38
- * @param {string} functionId
39
- * @param {string} name
40
- * @param {Runtime} runtime
41
- * @param {string[]} execute
42
- * @param {string[]} events
43
- * @param {string} schedule
44
- * @param {number} timeout
45
- * @param {boolean} enabled
46
- * @param {boolean} logging
47
- * @param {string} entrypoint
48
- * @param {string} commands
49
- * @param {string[]} scopes
50
- * @param {string} installationId
51
- * @param {string} providerRepositoryId
52
- * @param {string} providerBranch
53
- * @param {boolean} providerSilentMode
54
- * @param {string} providerRootDirectory
55
- * @param {string} specification
56
- * @throws {AppwriteException}
57
- * @returns {Promise<Models.Function>}
58
- */
59
- create(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification) {
38
+ create(paramsOrFirst, ...rest) {
39
+ let params;
40
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
41
+ params = paramsOrFirst || {};
42
+ } else {
43
+ params = {
44
+ functionId: paramsOrFirst,
45
+ name: rest[0],
46
+ runtime: rest[1],
47
+ execute: rest[2],
48
+ events: rest[3],
49
+ schedule: rest[4],
50
+ timeout: rest[5],
51
+ enabled: rest[6],
52
+ logging: rest[7],
53
+ entrypoint: rest[8],
54
+ commands: rest[9],
55
+ scopes: rest[10],
56
+ installationId: rest[11],
57
+ providerRepositoryId: rest[12],
58
+ providerBranch: rest[13],
59
+ providerSilentMode: rest[14],
60
+ providerRootDirectory: rest[15],
61
+ specification: rest[16]
62
+ };
63
+ }
64
+ const functionId = params.functionId;
65
+ const name = params.name;
66
+ const runtime = params.runtime;
67
+ const execute = params.execute;
68
+ const events = params.events;
69
+ const schedule = params.schedule;
70
+ const timeout = params.timeout;
71
+ const enabled = params.enabled;
72
+ const logging = params.logging;
73
+ const entrypoint = params.entrypoint;
74
+ const commands = params.commands;
75
+ const scopes = params.scopes;
76
+ const installationId = params.installationId;
77
+ const providerRepositoryId = params.providerRepositoryId;
78
+ const providerBranch = params.providerBranch;
79
+ const providerSilentMode = params.providerSilentMode;
80
+ const providerRootDirectory = params.providerRootDirectory;
81
+ const specification = params.specification;
60
82
  if (typeof functionId === "undefined") {
61
83
  throw new client.AppwriteException('Missing required parameter: "functionId"');
62
84
  }
@@ -169,14 +191,16 @@ class Functions {
169
191
  payload
170
192
  );
171
193
  }
172
- /**
173
- * Get a function by its unique ID.
174
- *
175
- * @param {string} functionId
176
- * @throws {AppwriteException}
177
- * @returns {Promise<Models.Function>}
178
- */
179
- get(functionId) {
194
+ get(paramsOrFirst) {
195
+ let params;
196
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
197
+ params = paramsOrFirst || {};
198
+ } else {
199
+ params = {
200
+ functionId: paramsOrFirst
201
+ };
202
+ }
203
+ const functionId = params.functionId;
180
204
  if (typeof functionId === "undefined") {
181
205
  throw new client.AppwriteException('Missing required parameter: "functionId"');
182
206
  }
@@ -191,31 +215,50 @@ class Functions {
191
215
  payload
192
216
  );
193
217
  }
194
- /**
195
- * Update function by its unique ID.
196
- *
197
- * @param {string} functionId
198
- * @param {string} name
199
- * @param {Runtime} runtime
200
- * @param {string[]} execute
201
- * @param {string[]} events
202
- * @param {string} schedule
203
- * @param {number} timeout
204
- * @param {boolean} enabled
205
- * @param {boolean} logging
206
- * @param {string} entrypoint
207
- * @param {string} commands
208
- * @param {string[]} scopes
209
- * @param {string} installationId
210
- * @param {string} providerRepositoryId
211
- * @param {string} providerBranch
212
- * @param {boolean} providerSilentMode
213
- * @param {string} providerRootDirectory
214
- * @param {string} specification
215
- * @throws {AppwriteException}
216
- * @returns {Promise<Models.Function>}
217
- */
218
- update(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification) {
218
+ update(paramsOrFirst, ...rest) {
219
+ let params;
220
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
221
+ params = paramsOrFirst || {};
222
+ } else {
223
+ params = {
224
+ functionId: paramsOrFirst,
225
+ name: rest[0],
226
+ runtime: rest[1],
227
+ execute: rest[2],
228
+ events: rest[3],
229
+ schedule: rest[4],
230
+ timeout: rest[5],
231
+ enabled: rest[6],
232
+ logging: rest[7],
233
+ entrypoint: rest[8],
234
+ commands: rest[9],
235
+ scopes: rest[10],
236
+ installationId: rest[11],
237
+ providerRepositoryId: rest[12],
238
+ providerBranch: rest[13],
239
+ providerSilentMode: rest[14],
240
+ providerRootDirectory: rest[15],
241
+ specification: rest[16]
242
+ };
243
+ }
244
+ const functionId = params.functionId;
245
+ const name = params.name;
246
+ const runtime = params.runtime;
247
+ const execute = params.execute;
248
+ const events = params.events;
249
+ const schedule = params.schedule;
250
+ const timeout = params.timeout;
251
+ const enabled = params.enabled;
252
+ const logging = params.logging;
253
+ const entrypoint = params.entrypoint;
254
+ const commands = params.commands;
255
+ const scopes = params.scopes;
256
+ const installationId = params.installationId;
257
+ const providerRepositoryId = params.providerRepositoryId;
258
+ const providerBranch = params.providerBranch;
259
+ const providerSilentMode = params.providerSilentMode;
260
+ const providerRootDirectory = params.providerRootDirectory;
261
+ const specification = params.specification;
219
262
  if (typeof functionId === "undefined") {
220
263
  throw new client.AppwriteException('Missing required parameter: "functionId"');
221
264
  }
@@ -286,14 +329,16 @@ class Functions {
286
329
  payload
287
330
  );
288
331
  }
289
- /**
290
- * Delete a function by its unique ID.
291
- *
292
- * @param {string} functionId
293
- * @throws {AppwriteException}
294
- * @returns {Promise<{}>}
295
- */
296
- delete(functionId) {
332
+ delete(paramsOrFirst) {
333
+ let params;
334
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
335
+ params = paramsOrFirst || {};
336
+ } else {
337
+ params = {
338
+ functionId: paramsOrFirst
339
+ };
340
+ }
341
+ const functionId = params.functionId;
297
342
  if (typeof functionId === "undefined") {
298
343
  throw new client.AppwriteException('Missing required parameter: "functionId"');
299
344
  }
@@ -310,15 +355,18 @@ class Functions {
310
355
  payload
311
356
  );
312
357
  }
313
- /**
314
- * Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function.
315
- *
316
- * @param {string} functionId
317
- * @param {string} deploymentId
318
- * @throws {AppwriteException}
319
- * @returns {Promise<Models.Function>}
320
- */
321
- updateFunctionDeployment(functionId, deploymentId) {
358
+ updateFunctionDeployment(paramsOrFirst, ...rest) {
359
+ let params;
360
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
361
+ params = paramsOrFirst || {};
362
+ } else {
363
+ params = {
364
+ functionId: paramsOrFirst,
365
+ deploymentId: rest[0]
366
+ };
367
+ }
368
+ const functionId = params.functionId;
369
+ const deploymentId = params.deploymentId;
322
370
  if (typeof functionId === "undefined") {
323
371
  throw new client.AppwriteException('Missing required parameter: "functionId"');
324
372
  }
@@ -341,16 +389,20 @@ class Functions {
341
389
  payload
342
390
  );
343
391
  }
344
- /**
345
- * Get a list of all the function&#039;s code deployments. You can use the query params to filter your results.
346
- *
347
- * @param {string} functionId
348
- * @param {string[]} queries
349
- * @param {string} search
350
- * @throws {AppwriteException}
351
- * @returns {Promise<Models.DeploymentList>}
352
- */
353
- listDeployments(functionId, queries, search) {
392
+ listDeployments(paramsOrFirst, ...rest) {
393
+ let params;
394
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
395
+ params = paramsOrFirst || {};
396
+ } else {
397
+ params = {
398
+ functionId: paramsOrFirst,
399
+ queries: rest[0],
400
+ search: rest[1]
401
+ };
402
+ }
403
+ const functionId = params.functionId;
404
+ const queries = params.queries;
405
+ const search = params.search;
354
406
  if (typeof functionId === "undefined") {
355
407
  throw new client.AppwriteException('Missing required parameter: "functionId"');
356
408
  }
@@ -371,23 +423,27 @@ class Functions {
371
423
  payload
372
424
  );
373
425
  }
374
- /**
375
- * Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you&#039;ll need to update the function&#039;s deployment to use your new deployment UID.
376
- *
377
- * This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions).
378
- *
379
- * Use the &quot;command&quot; param to set the entrypoint used to execute your code.
380
- *
381
- * @param {string} functionId
382
- * @param {File} code
383
- * @param {boolean} activate
384
- * @param {string} entrypoint
385
- * @param {string} commands
386
- * @throws {AppwriteException}
387
- * @returns {Promise<Models.Deployment>}
388
- */
389
- createDeployment(functionId, code, activate, entrypoint, commands, onProgress = (progress) => {
390
- }) {
426
+ createDeployment(paramsOrFirst, ...rest) {
427
+ let params;
428
+ let onProgress;
429
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
430
+ params = paramsOrFirst || {};
431
+ onProgress = paramsOrFirst == null ? void 0 : paramsOrFirst.onProgress;
432
+ } else {
433
+ params = {
434
+ functionId: paramsOrFirst,
435
+ code: rest[0],
436
+ activate: rest[1],
437
+ entrypoint: rest[2],
438
+ commands: rest[3]
439
+ };
440
+ onProgress = rest[4];
441
+ }
442
+ const functionId = params.functionId;
443
+ const code = params.code;
444
+ const activate = params.activate;
445
+ const entrypoint = params.entrypoint;
446
+ const commands = params.commands;
391
447
  if (typeof functionId === "undefined") {
392
448
  throw new client.AppwriteException('Missing required parameter: "functionId"');
393
449
  }
@@ -423,16 +479,20 @@ class Functions {
423
479
  onProgress
424
480
  );
425
481
  }
426
- /**
427
- * Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment&#039;s code will be preserved and used for the new build.
428
- *
429
- * @param {string} functionId
430
- * @param {string} deploymentId
431
- * @param {string} buildId
432
- * @throws {AppwriteException}
433
- * @returns {Promise<Models.Deployment>}
434
- */
435
- createDuplicateDeployment(functionId, deploymentId, buildId) {
482
+ createDuplicateDeployment(paramsOrFirst, ...rest) {
483
+ let params;
484
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
485
+ params = paramsOrFirst || {};
486
+ } else {
487
+ params = {
488
+ functionId: paramsOrFirst,
489
+ deploymentId: rest[0],
490
+ buildId: rest[1]
491
+ };
492
+ }
493
+ const functionId = params.functionId;
494
+ const deploymentId = params.deploymentId;
495
+ const buildId = params.buildId;
436
496
  if (typeof functionId === "undefined") {
437
497
  throw new client.AppwriteException('Missing required parameter: "functionId"');
438
498
  }
@@ -458,21 +518,26 @@ class Functions {
458
518
  payload
459
519
  );
460
520
  }
461
- /**
462
- * Create a deployment based on a template.
463
- *
464
- * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details.
465
- *
466
- * @param {string} functionId
467
- * @param {string} repository
468
- * @param {string} owner
469
- * @param {string} rootDirectory
470
- * @param {string} version
471
- * @param {boolean} activate
472
- * @throws {AppwriteException}
473
- * @returns {Promise<Models.Deployment>}
474
- */
475
- createTemplateDeployment(functionId, repository, owner, rootDirectory, version, activate) {
521
+ createTemplateDeployment(paramsOrFirst, ...rest) {
522
+ let params;
523
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
524
+ params = paramsOrFirst || {};
525
+ } else {
526
+ params = {
527
+ functionId: paramsOrFirst,
528
+ repository: rest[0],
529
+ owner: rest[1],
530
+ rootDirectory: rest[2],
531
+ version: rest[3],
532
+ activate: rest[4]
533
+ };
534
+ }
535
+ const functionId = params.functionId;
536
+ const repository = params.repository;
537
+ const owner = params.owner;
538
+ const rootDirectory = params.rootDirectory;
539
+ const version = params.version;
540
+ const activate = params.activate;
476
541
  if (typeof functionId === "undefined") {
477
542
  throw new client.AppwriteException('Missing required parameter: "functionId"');
478
543
  }
@@ -516,19 +581,22 @@ class Functions {
516
581
  payload
517
582
  );
518
583
  }
519
- /**
520
- * Create a deployment when a function is connected to VCS.
521
- *
522
- * This endpoint lets you create deployment from a branch, commit, or a tag.
523
- *
524
- * @param {string} functionId
525
- * @param {VCSDeploymentType} type
526
- * @param {string} reference
527
- * @param {boolean} activate
528
- * @throws {AppwriteException}
529
- * @returns {Promise<Models.Deployment>}
530
- */
531
- createVcsDeployment(functionId, type, reference, activate) {
584
+ createVcsDeployment(paramsOrFirst, ...rest) {
585
+ let params;
586
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
587
+ params = paramsOrFirst || {};
588
+ } else {
589
+ params = {
590
+ functionId: paramsOrFirst,
591
+ type: rest[0],
592
+ reference: rest[1],
593
+ activate: rest[2]
594
+ };
595
+ }
596
+ const functionId = params.functionId;
597
+ const type = params.type;
598
+ const reference = params.reference;
599
+ const activate = params.activate;
532
600
  if (typeof functionId === "undefined") {
533
601
  throw new client.AppwriteException('Missing required parameter: "functionId"');
534
602
  }
@@ -560,15 +628,18 @@ class Functions {
560
628
  payload
561
629
  );
562
630
  }
563
- /**
564
- * Get a function deployment by its unique ID.
565
- *
566
- * @param {string} functionId
567
- * @param {string} deploymentId
568
- * @throws {AppwriteException}
569
- * @returns {Promise<Models.Deployment>}
570
- */
571
- getDeployment(functionId, deploymentId) {
631
+ getDeployment(paramsOrFirst, ...rest) {
632
+ let params;
633
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
634
+ params = paramsOrFirst || {};
635
+ } else {
636
+ params = {
637
+ functionId: paramsOrFirst,
638
+ deploymentId: rest[0]
639
+ };
640
+ }
641
+ const functionId = params.functionId;
642
+ const deploymentId = params.deploymentId;
572
643
  if (typeof functionId === "undefined") {
573
644
  throw new client.AppwriteException('Missing required parameter: "functionId"');
574
645
  }
@@ -586,15 +657,18 @@ class Functions {
586
657
  payload
587
658
  );
588
659
  }
589
- /**
590
- * Delete a code deployment by its unique ID.
591
- *
592
- * @param {string} functionId
593
- * @param {string} deploymentId
594
- * @throws {AppwriteException}
595
- * @returns {Promise<{}>}
596
- */
597
- deleteDeployment(functionId, deploymentId) {
660
+ deleteDeployment(paramsOrFirst, ...rest) {
661
+ let params;
662
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
663
+ params = paramsOrFirst || {};
664
+ } else {
665
+ params = {
666
+ functionId: paramsOrFirst,
667
+ deploymentId: rest[0]
668
+ };
669
+ }
670
+ const functionId = params.functionId;
671
+ const deploymentId = params.deploymentId;
598
672
  if (typeof functionId === "undefined") {
599
673
  throw new client.AppwriteException('Missing required parameter: "functionId"');
600
674
  }
@@ -614,16 +688,20 @@ class Functions {
614
688
  payload
615
689
  );
616
690
  }
617
- /**
618
- * Get a function deployment content by its unique ID. The endpoint response return with a &#039;Content-Disposition: attachment&#039; header that tells the browser to start downloading the file to user downloads directory.
619
- *
620
- * @param {string} functionId
621
- * @param {string} deploymentId
622
- * @param {DeploymentDownloadType} type
623
- * @throws {AppwriteException}
624
- * @returns {Promise<ArrayBuffer>}
625
- */
626
- getDeploymentDownload(functionId, deploymentId, type) {
691
+ getDeploymentDownload(paramsOrFirst, ...rest) {
692
+ let params;
693
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
694
+ params = paramsOrFirst || {};
695
+ } else {
696
+ params = {
697
+ functionId: paramsOrFirst,
698
+ deploymentId: rest[0],
699
+ type: rest[1]
700
+ };
701
+ }
702
+ const functionId = params.functionId;
703
+ const deploymentId = params.deploymentId;
704
+ const type = params.type;
627
705
  if (typeof functionId === "undefined") {
628
706
  throw new client.AppwriteException('Missing required parameter: "functionId"');
629
707
  }
@@ -645,15 +723,18 @@ class Functions {
645
723
  "arrayBuffer"
646
724
  );
647
725
  }
648
- /**
649
- * Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn&#039;t started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status &#039;ready&#039;) or failed. The response includes the final build status and details.
650
- *
651
- * @param {string} functionId
652
- * @param {string} deploymentId
653
- * @throws {AppwriteException}
654
- * @returns {Promise<Models.Deployment>}
655
- */
656
- updateDeploymentStatus(functionId, deploymentId) {
726
+ updateDeploymentStatus(paramsOrFirst, ...rest) {
727
+ let params;
728
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
729
+ params = paramsOrFirst || {};
730
+ } else {
731
+ params = {
732
+ functionId: paramsOrFirst,
733
+ deploymentId: rest[0]
734
+ };
735
+ }
736
+ const functionId = params.functionId;
737
+ const deploymentId = params.deploymentId;
657
738
  if (typeof functionId === "undefined") {
658
739
  throw new client.AppwriteException('Missing required parameter: "functionId"');
659
740
  }
@@ -673,15 +754,18 @@ class Functions {
673
754
  payload
674
755
  );
675
756
  }
676
- /**
677
- * Get a list of all the current user function execution logs. You can use the query params to filter your results.
678
- *
679
- * @param {string} functionId
680
- * @param {string[]} queries
681
- * @throws {AppwriteException}
682
- * @returns {Promise<Models.ExecutionList>}
683
- */
684
- listExecutions(functionId, queries) {
757
+ listExecutions(paramsOrFirst, ...rest) {
758
+ let params;
759
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
760
+ params = paramsOrFirst || {};
761
+ } else {
762
+ params = {
763
+ functionId: paramsOrFirst,
764
+ queries: rest[0]
765
+ };
766
+ }
767
+ const functionId = params.functionId;
768
+ const queries = params.queries;
685
769
  if (typeof functionId === "undefined") {
686
770
  throw new client.AppwriteException('Missing required parameter: "functionId"');
687
771
  }
@@ -699,20 +783,28 @@ class Functions {
699
783
  payload
700
784
  );
701
785
  }
702
- /**
703
- * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.
704
- *
705
- * @param {string} functionId
706
- * @param {string} body
707
- * @param {boolean} async
708
- * @param {string} xpath
709
- * @param {ExecutionMethod} method
710
- * @param {object} headers
711
- * @param {string} scheduledAt
712
- * @throws {AppwriteException}
713
- * @returns {Promise<Models.Execution>}
714
- */
715
- createExecution(functionId, body, async, xpath, method, headers, scheduledAt) {
786
+ createExecution(paramsOrFirst, ...rest) {
787
+ let params;
788
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
789
+ params = paramsOrFirst || {};
790
+ } else {
791
+ params = {
792
+ functionId: paramsOrFirst,
793
+ body: rest[0],
794
+ async: rest[1],
795
+ xpath: rest[2],
796
+ method: rest[3],
797
+ headers: rest[4],
798
+ scheduledAt: rest[5]
799
+ };
800
+ }
801
+ const functionId = params.functionId;
802
+ const body = params.body;
803
+ const async = params.async;
804
+ const xpath = params.xpath;
805
+ const method = params.method;
806
+ const headers = params.headers;
807
+ const scheduledAt = params.scheduledAt;
716
808
  if (typeof functionId === "undefined") {
717
809
  throw new client.AppwriteException('Missing required parameter: "functionId"');
718
810
  }
@@ -747,15 +839,18 @@ class Functions {
747
839
  payload
748
840
  );
749
841
  }
750
- /**
751
- * Get a function execution log by its unique ID.
752
- *
753
- * @param {string} functionId
754
- * @param {string} executionId
755
- * @throws {AppwriteException}
756
- * @returns {Promise<Models.Execution>}
757
- */
758
- getExecution(functionId, executionId) {
842
+ getExecution(paramsOrFirst, ...rest) {
843
+ let params;
844
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
845
+ params = paramsOrFirst || {};
846
+ } else {
847
+ params = {
848
+ functionId: paramsOrFirst,
849
+ executionId: rest[0]
850
+ };
851
+ }
852
+ const functionId = params.functionId;
853
+ const executionId = params.executionId;
759
854
  if (typeof functionId === "undefined") {
760
855
  throw new client.AppwriteException('Missing required parameter: "functionId"');
761
856
  }
@@ -773,15 +868,18 @@ class Functions {
773
868
  payload
774
869
  );
775
870
  }
776
- /**
777
- * Delete a function execution by its unique ID.
778
- *
779
- * @param {string} functionId
780
- * @param {string} executionId
781
- * @throws {AppwriteException}
782
- * @returns {Promise<{}>}
783
- */
784
- deleteExecution(functionId, executionId) {
871
+ deleteExecution(paramsOrFirst, ...rest) {
872
+ let params;
873
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
874
+ params = paramsOrFirst || {};
875
+ } else {
876
+ params = {
877
+ functionId: paramsOrFirst,
878
+ executionId: rest[0]
879
+ };
880
+ }
881
+ const functionId = params.functionId;
882
+ const executionId = params.executionId;
785
883
  if (typeof functionId === "undefined") {
786
884
  throw new client.AppwriteException('Missing required parameter: "functionId"');
787
885
  }
@@ -801,14 +899,16 @@ class Functions {
801
899
  payload
802
900
  );
803
901
  }
804
- /**
805
- * Get a list of all variables of a specific function.
806
- *
807
- * @param {string} functionId
808
- * @throws {AppwriteException}
809
- * @returns {Promise<Models.VariableList>}
810
- */
811
- listVariables(functionId) {
902
+ listVariables(paramsOrFirst) {
903
+ let params;
904
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
905
+ params = paramsOrFirst || {};
906
+ } else {
907
+ params = {
908
+ functionId: paramsOrFirst
909
+ };
910
+ }
911
+ const functionId = params.functionId;
812
912
  if (typeof functionId === "undefined") {
813
913
  throw new client.AppwriteException('Missing required parameter: "functionId"');
814
914
  }
@@ -823,17 +923,22 @@ class Functions {
823
923
  payload
824
924
  );
825
925
  }
826
- /**
827
- * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables.
828
- *
829
- * @param {string} functionId
830
- * @param {string} key
831
- * @param {string} value
832
- * @param {boolean} secret
833
- * @throws {AppwriteException}
834
- * @returns {Promise<Models.Variable>}
835
- */
836
- createVariable(functionId, key, value, secret) {
926
+ createVariable(paramsOrFirst, ...rest) {
927
+ let params;
928
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
929
+ params = paramsOrFirst || {};
930
+ } else {
931
+ params = {
932
+ functionId: paramsOrFirst,
933
+ key: rest[0],
934
+ value: rest[1],
935
+ secret: rest[2]
936
+ };
937
+ }
938
+ const functionId = params.functionId;
939
+ const key = params.key;
940
+ const value = params.value;
941
+ const secret = params.secret;
837
942
  if (typeof functionId === "undefined") {
838
943
  throw new client.AppwriteException('Missing required parameter: "functionId"');
839
944
  }
@@ -865,15 +970,18 @@ class Functions {
865
970
  payload
866
971
  );
867
972
  }
868
- /**
869
- * Get a variable by its unique ID.
870
- *
871
- * @param {string} functionId
872
- * @param {string} variableId
873
- * @throws {AppwriteException}
874
- * @returns {Promise<Models.Variable>}
875
- */
876
- getVariable(functionId, variableId) {
973
+ getVariable(paramsOrFirst, ...rest) {
974
+ let params;
975
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
976
+ params = paramsOrFirst || {};
977
+ } else {
978
+ params = {
979
+ functionId: paramsOrFirst,
980
+ variableId: rest[0]
981
+ };
982
+ }
983
+ const functionId = params.functionId;
984
+ const variableId = params.variableId;
877
985
  if (typeof functionId === "undefined") {
878
986
  throw new client.AppwriteException('Missing required parameter: "functionId"');
879
987
  }
@@ -891,18 +999,24 @@ class Functions {
891
999
  payload
892
1000
  );
893
1001
  }
894
- /**
895
- * Update variable by its unique ID.
896
- *
897
- * @param {string} functionId
898
- * @param {string} variableId
899
- * @param {string} key
900
- * @param {string} value
901
- * @param {boolean} secret
902
- * @throws {AppwriteException}
903
- * @returns {Promise<Models.Variable>}
904
- */
905
- updateVariable(functionId, variableId, key, value, secret) {
1002
+ updateVariable(paramsOrFirst, ...rest) {
1003
+ let params;
1004
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1005
+ params = paramsOrFirst || {};
1006
+ } else {
1007
+ params = {
1008
+ functionId: paramsOrFirst,
1009
+ variableId: rest[0],
1010
+ key: rest[1],
1011
+ value: rest[2],
1012
+ secret: rest[3]
1013
+ };
1014
+ }
1015
+ const functionId = params.functionId;
1016
+ const variableId = params.variableId;
1017
+ const key = params.key;
1018
+ const value = params.value;
1019
+ const secret = params.secret;
906
1020
  if (typeof functionId === "undefined") {
907
1021
  throw new client.AppwriteException('Missing required parameter: "functionId"');
908
1022
  }
@@ -934,15 +1048,18 @@ class Functions {
934
1048
  payload
935
1049
  );
936
1050
  }
937
- /**
938
- * Delete a variable by its unique ID.
939
- *
940
- * @param {string} functionId
941
- * @param {string} variableId
942
- * @throws {AppwriteException}
943
- * @returns {Promise<{}>}
944
- */
945
- deleteVariable(functionId, variableId) {
1051
+ deleteVariable(paramsOrFirst, ...rest) {
1052
+ let params;
1053
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1054
+ params = paramsOrFirst || {};
1055
+ } else {
1056
+ params = {
1057
+ functionId: paramsOrFirst,
1058
+ variableId: rest[0]
1059
+ };
1060
+ }
1061
+ const functionId = params.functionId;
1062
+ const variableId = params.variableId;
946
1063
  if (typeof functionId === "undefined") {
947
1064
  throw new client.AppwriteException('Missing required parameter: "functionId"');
948
1065
  }