@appwrite.io/console 1.8.0 → 1.10.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 (105) hide show
  1. package/.github/workflows/publish.yml +1 -1
  2. package/CHANGELOG.md +45 -6
  3. package/README.md +82 -2
  4. package/dist/cjs/sdk.js +532 -200
  5. package/dist/cjs/sdk.js.map +1 -1
  6. package/dist/esm/sdk.js +533 -201
  7. package/dist/esm/sdk.js.map +1 -1
  8. package/dist/iife/sdk.js +532 -200
  9. package/docs/examples/databases/create-document.md +1 -3
  10. package/docs/examples/databases/create-documents.md +1 -1
  11. package/docs/examples/databases/decrement-document-attribute.md +18 -0
  12. package/docs/examples/databases/increment-document-attribute.md +18 -0
  13. package/docs/examples/databases/upsert-documents.md +1 -1
  14. package/docs/examples/domains/create-record-a-a-a-a.md +1 -1
  15. package/docs/examples/domains/create-record-a.md +1 -1
  16. package/docs/examples/domains/create-record-alias.md +1 -1
  17. package/docs/examples/domains/create-record-c-a-a.md +1 -1
  18. package/docs/examples/domains/create-record-c-n-a-m-e.md +1 -1
  19. package/docs/examples/domains/create-record-h-t-t-p-s.md +1 -1
  20. package/docs/examples/domains/create-record-m-x.md +1 -1
  21. package/docs/examples/domains/create-record-n-s.md +1 -1
  22. package/docs/examples/domains/create-record-s-r-v.md +1 -1
  23. package/docs/examples/domains/create-record-t-x-t.md +1 -1
  24. package/docs/examples/domains/update-record-a-a-a-a.md +1 -1
  25. package/docs/examples/domains/update-record-a.md +1 -1
  26. package/docs/examples/domains/update-record-alias.md +1 -1
  27. package/docs/examples/domains/update-record-c-a-a.md +1 -1
  28. package/docs/examples/domains/update-record-c-n-a-m-e.md +1 -1
  29. package/docs/examples/domains/update-record-h-t-t-p-s.md +1 -1
  30. package/docs/examples/domains/update-record-m-x.md +1 -1
  31. package/docs/examples/domains/update-record-n-s.md +1 -1
  32. package/docs/examples/domains/update-record-s-r-v.md +1 -1
  33. package/docs/examples/domains/update-record-t-x-t.md +1 -1
  34. package/docs/examples/functions/create-execution.md +1 -1
  35. package/docs/examples/health/{get-queue-stats-usage-dump.md → get-queue-billing-project-aggregation.md} +2 -2
  36. package/docs/examples/health/{get-queue-billing-aggregation.md → get-queue-billing-team-aggregation.md} +1 -1
  37. package/docs/examples/organizations/cancel-downgrade.md +13 -0
  38. package/docs/examples/organizations/estimation-create-organization.md +16 -0
  39. package/docs/examples/organizations/estimation-delete-organization.md +13 -0
  40. package/docs/examples/organizations/estimation-update-plan.md +16 -0
  41. package/docs/examples/organizations/get-available-credits.md +13 -0
  42. package/docs/examples/organizations/get-usage.md +1 -1
  43. package/docs/examples/organizations/update-projects.md +14 -0
  44. package/docs/examples/organizations/validate-payment.md +14 -0
  45. package/docs/examples/proxy/create-redirect-rule.md +4 -2
  46. package/docs/examples/vcs/get-repository-contents.md +2 -1
  47. package/package.json +1 -1
  48. package/src/client.ts +5 -4
  49. package/src/enums/build-runtime.ts +2 -0
  50. package/src/enums/image-format.ts +1 -0
  51. package/src/enums/proxy-resource-type.ts +4 -0
  52. package/src/enums/runtime.ts +2 -0
  53. package/src/index.ts +1 -0
  54. package/src/models.ts +513 -11
  55. package/src/services/account.ts +97 -36
  56. package/src/services/avatars.ts +26 -20
  57. package/src/services/backups.ts +11 -0
  58. package/src/services/console.ts +8 -1
  59. package/src/services/databases.ts +190 -31
  60. package/src/services/domains.ts +111 -69
  61. package/src/services/functions.ts +37 -8
  62. package/src/services/graphql.ts +1 -0
  63. package/src/services/health.ts +54 -4
  64. package/src/services/locale.ts +9 -2
  65. package/src/services/messaging.ts +53 -8
  66. package/src/services/migrations.ts +12 -0
  67. package/src/services/organizations.ts +301 -14
  68. package/src/services/project.ts +5 -0
  69. package/src/services/projects.ts +50 -0
  70. package/src/services/proxy.ts +23 -1
  71. package/src/services/sites.ts +32 -4
  72. package/src/services/storage.ts +23 -9
  73. package/src/services/teams.ts +30 -17
  74. package/src/services/tokens.ts +4 -0
  75. package/src/services/users.ts +69 -27
  76. package/src/services/vcs.ts +16 -4
  77. package/types/enums/build-runtime.d.ts +3 -1
  78. package/types/enums/image-format.d.ts +2 -1
  79. package/types/enums/proxy-resource-type.d.ts +4 -0
  80. package/types/enums/runtime.d.ts +3 -1
  81. package/types/index.d.ts +1 -0
  82. package/types/models.d.ts +494 -188
  83. package/types/services/account.d.ts +36 -36
  84. package/types/services/avatars.d.ts +20 -20
  85. package/types/services/console.d.ts +1 -1
  86. package/types/services/databases.d.ts +67 -31
  87. package/types/services/domains.d.ts +69 -69
  88. package/types/services/functions.d.ts +8 -8
  89. package/types/services/health.d.ts +11 -3
  90. package/types/services/locale.d.ts +2 -2
  91. package/types/services/messaging.d.ts +8 -8
  92. package/types/services/organizations.d.ts +88 -14
  93. package/types/services/proxy.d.ts +4 -1
  94. package/types/services/sites.d.ts +4 -4
  95. package/types/services/storage.d.ts +9 -9
  96. package/types/services/teams.d.ts +17 -17
  97. package/types/services/users.d.ts +27 -27
  98. package/types/services/vcs.d.ts +4 -4
  99. package/docs/examples/functions/create-build.md +0 -15
  100. package/docs/examples/functions/get-function-usage.md +0 -14
  101. package/docs/examples/functions/update-deployment-build.md +0 -14
  102. package/docs/examples/functions/update-deployment.md +0 -14
  103. package/docs/examples/proxy/create-rule.md +0 -15
  104. package/src/enums/resource-type.ts +0 -4
  105. package/types/enums/resource-type.d.ts +0 -4
@@ -42,9 +42,10 @@ export class Databases {
42
42
  payload
43
43
  );
44
44
  }
45
+
45
46
  /**
46
47
  * Create a new Database.
47
-
48
+ *
48
49
  *
49
50
  * @param {string} databaseId
50
51
  * @param {string} name
@@ -83,6 +84,7 @@ export class Databases {
83
84
  payload
84
85
  );
85
86
  }
87
+
86
88
  /**
87
89
  * Get usage metrics and statistics for all databases in the project. You can view the total number of databases, collections, documents, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.
88
90
  *
@@ -108,6 +110,7 @@ export class Databases {
108
110
  payload
109
111
  );
110
112
  }
113
+
111
114
  /**
112
115
  * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.
113
116
  *
@@ -133,6 +136,7 @@ export class Databases {
133
136
  payload
134
137
  );
135
138
  }
139
+
136
140
  /**
137
141
  * Update a database by its unique ID.
138
142
  *
@@ -170,6 +174,7 @@ export class Databases {
170
174
  payload
171
175
  );
172
176
  }
177
+
173
178
  /**
174
179
  * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.
175
180
  *
@@ -196,6 +201,7 @@ export class Databases {
196
201
  payload
197
202
  );
198
203
  }
204
+
199
205
  /**
200
206
  * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.
201
207
  *
@@ -229,6 +235,7 @@ export class Databases {
229
235
  payload
230
236
  );
231
237
  }
238
+
232
239
  /**
233
240
  * 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.
234
241
  *
@@ -281,6 +288,7 @@ export class Databases {
281
288
  payload
282
289
  );
283
290
  }
291
+
284
292
  /**
285
293
  * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.
286
294
  *
@@ -310,6 +318,7 @@ export class Databases {
310
318
  payload
311
319
  );
312
320
  }
321
+
313
322
  /**
314
323
  * Update a collection by its unique ID.
315
324
  *
@@ -359,6 +368,7 @@ export class Databases {
359
368
  payload
360
369
  );
361
370
  }
371
+
362
372
  /**
363
373
  * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.
364
374
  *
@@ -389,6 +399,7 @@ export class Databases {
389
399
  payload
390
400
  );
391
401
  }
402
+
392
403
  /**
393
404
  * List attributes in the collection.
394
405
  *
@@ -422,9 +433,10 @@ export class Databases {
422
433
  payload
423
434
  );
424
435
  }
436
+
425
437
  /**
426
438
  * Create a boolean attribute.
427
-
439
+ *
428
440
  *
429
441
  * @param {string} databaseId
430
442
  * @param {string} collectionId
@@ -475,6 +487,7 @@ export class Databases {
475
487
  payload
476
488
  );
477
489
  }
490
+
478
491
  /**
479
492
  * Update a boolean attribute. Changing the `default` value will not update already existing documents.
480
493
  *
@@ -527,6 +540,7 @@ export class Databases {
527
540
  payload
528
541
  );
529
542
  }
543
+
530
544
  /**
531
545
  * Create a date time attribute according to the ISO 8601 standard.
532
546
  *
@@ -579,6 +593,7 @@ export class Databases {
579
593
  payload
580
594
  );
581
595
  }
596
+
582
597
  /**
583
598
  * Update a date time attribute. Changing the `default` value will not update already existing documents.
584
599
  *
@@ -631,9 +646,10 @@ export class Databases {
631
646
  payload
632
647
  );
633
648
  }
649
+
634
650
  /**
635
651
  * Create an email attribute.
636
-
652
+ *
637
653
  *
638
654
  * @param {string} databaseId
639
655
  * @param {string} collectionId
@@ -684,9 +700,10 @@ export class Databases {
684
700
  payload
685
701
  );
686
702
  }
703
+
687
704
  /**
688
705
  * Update an email attribute. Changing the `default` value will not update already existing documents.
689
-
706
+ *
690
707
  *
691
708
  * @param {string} databaseId
692
709
  * @param {string} collectionId
@@ -737,9 +754,10 @@ export class Databases {
737
754
  payload
738
755
  );
739
756
  }
757
+
740
758
  /**
741
759
  * Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute.
742
-
760
+ *
743
761
  *
744
762
  * @param {string} databaseId
745
763
  * @param {string} collectionId
@@ -797,9 +815,10 @@ export class Databases {
797
815
  payload
798
816
  );
799
817
  }
818
+
800
819
  /**
801
820
  * Update an enum attribute. Changing the `default` value will not update already existing documents.
802
-
821
+ *
803
822
  *
804
823
  * @param {string} databaseId
805
824
  * @param {string} collectionId
@@ -857,9 +876,10 @@ export class Databases {
857
876
  payload
858
877
  );
859
878
  }
879
+
860
880
  /**
861
881
  * Create a float attribute. Optionally, minimum and maximum values can be provided.
862
-
882
+ *
863
883
  *
864
884
  * @param {string} databaseId
865
885
  * @param {string} collectionId
@@ -918,9 +938,10 @@ export class Databases {
918
938
  payload
919
939
  );
920
940
  }
941
+
921
942
  /**
922
943
  * Update a float attribute. Changing the `default` value will not update already existing documents.
923
-
944
+ *
924
945
  *
925
946
  * @param {string} databaseId
926
947
  * @param {string} collectionId
@@ -979,9 +1000,10 @@ export class Databases {
979
1000
  payload
980
1001
  );
981
1002
  }
1003
+
982
1004
  /**
983
1005
  * Create an integer attribute. Optionally, minimum and maximum values can be provided.
984
-
1006
+ *
985
1007
  *
986
1008
  * @param {string} databaseId
987
1009
  * @param {string} collectionId
@@ -1040,9 +1062,10 @@ export class Databases {
1040
1062
  payload
1041
1063
  );
1042
1064
  }
1065
+
1043
1066
  /**
1044
1067
  * Update an integer attribute. Changing the `default` value will not update already existing documents.
1045
-
1068
+ *
1046
1069
  *
1047
1070
  * @param {string} databaseId
1048
1071
  * @param {string} collectionId
@@ -1101,9 +1124,10 @@ export class Databases {
1101
1124
  payload
1102
1125
  );
1103
1126
  }
1127
+
1104
1128
  /**
1105
1129
  * Create IP address attribute.
1106
-
1130
+ *
1107
1131
  *
1108
1132
  * @param {string} databaseId
1109
1133
  * @param {string} collectionId
@@ -1154,9 +1178,10 @@ export class Databases {
1154
1178
  payload
1155
1179
  );
1156
1180
  }
1181
+
1157
1182
  /**
1158
1183
  * Update an ip attribute. Changing the `default` value will not update already existing documents.
1159
-
1184
+ *
1160
1185
  *
1161
1186
  * @param {string} databaseId
1162
1187
  * @param {string} collectionId
@@ -1207,9 +1232,10 @@ export class Databases {
1207
1232
  payload
1208
1233
  );
1209
1234
  }
1235
+
1210
1236
  /**
1211
1237
  * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
1212
-
1238
+ *
1213
1239
  *
1214
1240
  * @param {string} databaseId
1215
1241
  * @param {string} collectionId
@@ -1268,9 +1294,10 @@ export class Databases {
1268
1294
  payload
1269
1295
  );
1270
1296
  }
1297
+
1271
1298
  /**
1272
1299
  * Create a string attribute.
1273
-
1300
+ *
1274
1301
  *
1275
1302
  * @param {string} databaseId
1276
1303
  * @param {string} collectionId
@@ -1332,9 +1359,10 @@ export class Databases {
1332
1359
  payload
1333
1360
  );
1334
1361
  }
1362
+
1335
1363
  /**
1336
1364
  * Update a string attribute. Changing the `default` value will not update already existing documents.
1337
-
1365
+ *
1338
1366
  *
1339
1367
  * @param {string} databaseId
1340
1368
  * @param {string} collectionId
@@ -1389,9 +1417,10 @@ export class Databases {
1389
1417
  payload
1390
1418
  );
1391
1419
  }
1420
+
1392
1421
  /**
1393
1422
  * Create a URL attribute.
1394
-
1423
+ *
1395
1424
  *
1396
1425
  * @param {string} databaseId
1397
1426
  * @param {string} collectionId
@@ -1442,9 +1471,10 @@ export class Databases {
1442
1471
  payload
1443
1472
  );
1444
1473
  }
1474
+
1445
1475
  /**
1446
1476
  * Update an url attribute. Changing the `default` value will not update already existing documents.
1447
-
1477
+ *
1448
1478
  *
1449
1479
  * @param {string} databaseId
1450
1480
  * @param {string} collectionId
@@ -1495,6 +1525,7 @@ export class Databases {
1495
1525
  payload
1496
1526
  );
1497
1527
  }
1528
+
1498
1529
  /**
1499
1530
  * Get attribute by ID.
1500
1531
  *
@@ -1528,6 +1559,7 @@ export class Databases {
1528
1559
  payload
1529
1560
  );
1530
1561
  }
1562
+
1531
1563
  /**
1532
1564
  * Deletes an attribute.
1533
1565
  *
@@ -1562,9 +1594,10 @@ export class Databases {
1562
1594
  payload
1563
1595
  );
1564
1596
  }
1597
+
1565
1598
  /**
1566
1599
  * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
1567
-
1600
+ *
1568
1601
  *
1569
1602
  * @param {string} databaseId
1570
1603
  * @param {string} collectionId
@@ -1605,6 +1638,7 @@ export class Databases {
1605
1638
  payload
1606
1639
  );
1607
1640
  }
1641
+
1608
1642
  /**
1609
1643
  * Get a list of all the user's documents in a given collection. You can use the query params to filter your results.
1610
1644
  *
@@ -1614,7 +1648,7 @@ export class Databases {
1614
1648
  * @throws {AppwriteException}
1615
1649
  * @returns {Promise<Models.DocumentList<Document>>}
1616
1650
  */
1617
- listDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.DocumentList<Document>> {
1651
+ listDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.DocumentList<Document>> {
1618
1652
  if (typeof databaseId === 'undefined') {
1619
1653
  throw new AppwriteException('Missing required parameter: "databaseId"');
1620
1654
  }
@@ -1638,18 +1672,19 @@ export class Databases {
1638
1672
  payload
1639
1673
  );
1640
1674
  }
1675
+
1641
1676
  /**
1642
1677
  * 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.
1643
1678
  *
1644
1679
  * @param {string} databaseId
1645
1680
  * @param {string} collectionId
1646
1681
  * @param {string} documentId
1647
- * @param {Omit<Document, keyof Models.Document>} data
1682
+ * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} data
1648
1683
  * @param {string[]} permissions
1649
1684
  * @throws {AppwriteException}
1650
1685
  * @returns {Promise<Document>}
1651
1686
  */
1652
- createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: Omit<Document, keyof Models.Document>, permissions?: string[]): Promise<Document> {
1687
+ createDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[]): Promise<Document> {
1653
1688
  if (typeof databaseId === 'undefined') {
1654
1689
  throw new AppwriteException('Missing required parameter: "databaseId"');
1655
1690
  }
@@ -1686,7 +1721,10 @@ export class Databases {
1686
1721
  payload
1687
1722
  );
1688
1723
  }
1724
+
1689
1725
  /**
1726
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1727
+ *
1690
1728
  * Create new Documents. 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.
1691
1729
  *
1692
1730
  * @param {string} databaseId
@@ -1695,7 +1733,7 @@ export class Databases {
1695
1733
  * @throws {AppwriteException}
1696
1734
  * @returns {Promise<Models.DocumentList<Document>>}
1697
1735
  */
1698
- createDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, documents: object[]): Promise<Models.DocumentList<Document>> {
1736
+ createDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documents: object[]): Promise<Models.DocumentList<Document>> {
1699
1737
  if (typeof databaseId === 'undefined') {
1700
1738
  throw new AppwriteException('Missing required parameter: "databaseId"');
1701
1739
  }
@@ -1723,9 +1761,12 @@ export class Databases {
1723
1761
  payload
1724
1762
  );
1725
1763
  }
1764
+
1726
1765
  /**
1766
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1767
+ *
1727
1768
  * Create or update Documents. 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.
1728
-
1769
+ *
1729
1770
  *
1730
1771
  * @param {string} databaseId
1731
1772
  * @param {string} collectionId
@@ -1733,13 +1774,16 @@ export class Databases {
1733
1774
  * @throws {AppwriteException}
1734
1775
  * @returns {Promise<Models.DocumentList<Document>>}
1735
1776
  */
1736
- upsertDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, documents?: object[]): Promise<Models.DocumentList<Document>> {
1777
+ upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documents: object[]): Promise<Models.DocumentList<Document>> {
1737
1778
  if (typeof databaseId === 'undefined') {
1738
1779
  throw new AppwriteException('Missing required parameter: "databaseId"');
1739
1780
  }
1740
1781
  if (typeof collectionId === 'undefined') {
1741
1782
  throw new AppwriteException('Missing required parameter: "collectionId"');
1742
1783
  }
1784
+ if (typeof documents === 'undefined') {
1785
+ throw new AppwriteException('Missing required parameter: "documents"');
1786
+ }
1743
1787
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1744
1788
  const payload: Payload = {};
1745
1789
  if (typeof documents !== 'undefined') {
@@ -1758,7 +1802,10 @@ export class Databases {
1758
1802
  payload
1759
1803
  );
1760
1804
  }
1805
+
1761
1806
  /**
1807
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1808
+ *
1762
1809
  * Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated.
1763
1810
  *
1764
1811
  * @param {string} databaseId
@@ -1768,7 +1815,7 @@ export class Databases {
1768
1815
  * @throws {AppwriteException}
1769
1816
  * @returns {Promise<Models.DocumentList<Document>>}
1770
1817
  */
1771
- updateDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, data?: object, queries?: string[]): Promise<Models.DocumentList<Document>> {
1818
+ updateDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, data?: object, queries?: string[]): Promise<Models.DocumentList<Document>> {
1772
1819
  if (typeof databaseId === 'undefined') {
1773
1820
  throw new AppwriteException('Missing required parameter: "databaseId"');
1774
1821
  }
@@ -1796,7 +1843,10 @@ export class Databases {
1796
1843
  payload
1797
1844
  );
1798
1845
  }
1846
+
1799
1847
  /**
1848
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1849
+ *
1800
1850
  * Bulk delete documents using queries, if no queries are passed then all documents are deleted.
1801
1851
  *
1802
1852
  * @param {string} databaseId
@@ -1805,7 +1855,7 @@ export class Databases {
1805
1855
  * @throws {AppwriteException}
1806
1856
  * @returns {Promise<Models.DocumentList<Document>>}
1807
1857
  */
1808
- deleteDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.DocumentList<Document>> {
1858
+ deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.DocumentList<Document>> {
1809
1859
  if (typeof databaseId === 'undefined') {
1810
1860
  throw new AppwriteException('Missing required parameter: "databaseId"');
1811
1861
  }
@@ -1830,6 +1880,7 @@ export class Databases {
1830
1880
  payload
1831
1881
  );
1832
1882
  }
1883
+
1833
1884
  /**
1834
1885
  * Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
1835
1886
  *
@@ -1840,7 +1891,7 @@ export class Databases {
1840
1891
  * @throws {AppwriteException}
1841
1892
  * @returns {Promise<Document>}
1842
1893
  */
1843
- getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Document> {
1894
+ getDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Document> {
1844
1895
  if (typeof databaseId === 'undefined') {
1845
1896
  throw new AppwriteException('Missing required parameter: "databaseId"');
1846
1897
  }
@@ -1867,7 +1918,10 @@ export class Databases {
1867
1918
  payload
1868
1919
  );
1869
1920
  }
1921
+
1870
1922
  /**
1923
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1924
+ *
1871
1925
  * Create or update a 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.
1872
1926
  *
1873
1927
  * @param {string} databaseId
@@ -1878,7 +1932,7 @@ export class Databases {
1878
1932
  * @throws {AppwriteException}
1879
1933
  * @returns {Promise<Document>}
1880
1934
  */
1881
- upsertDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: object, permissions?: string[]): Promise<Document> {
1935
+ upsertDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data: object, permissions?: string[]): Promise<Document> {
1882
1936
  if (typeof databaseId === 'undefined') {
1883
1937
  throw new AppwriteException('Missing required parameter: "databaseId"');
1884
1938
  }
@@ -1912,18 +1966,19 @@ export class Databases {
1912
1966
  payload
1913
1967
  );
1914
1968
  }
1969
+
1915
1970
  /**
1916
1971
  * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
1917
1972
  *
1918
1973
  * @param {string} databaseId
1919
1974
  * @param {string} collectionId
1920
1975
  * @param {string} documentId
1921
- * @param {Partial<Omit<Document, keyof Models.Document>>} data
1976
+ * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} data
1922
1977
  * @param {string[]} permissions
1923
1978
  * @throws {AppwriteException}
1924
1979
  * @returns {Promise<Document>}
1925
1980
  */
1926
- updateDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data?: Partial<Omit<Document, keyof Models.Document>>, permissions?: string[]): Promise<Document> {
1981
+ updateDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[]): Promise<Document> {
1927
1982
  if (typeof databaseId === 'undefined') {
1928
1983
  throw new AppwriteException('Missing required parameter: "databaseId"');
1929
1984
  }
@@ -1954,6 +2009,7 @@ export class Databases {
1954
2009
  payload
1955
2010
  );
1956
2011
  }
2012
+
1957
2013
  /**
1958
2014
  * Delete a document by its unique ID.
1959
2015
  *
@@ -1988,6 +2044,7 @@ export class Databases {
1988
2044
  payload
1989
2045
  );
1990
2046
  }
2047
+
1991
2048
  /**
1992
2049
  * Get the document activity logs list by its unique ID.
1993
2050
  *
@@ -2025,6 +2082,101 @@ export class Databases {
2025
2082
  payload
2026
2083
  );
2027
2084
  }
2085
+
2086
+ /**
2087
+ * Decrement a specific attribute of a document by a given value.
2088
+ *
2089
+ * @param {string} databaseId
2090
+ * @param {string} collectionId
2091
+ * @param {string} documentId
2092
+ * @param {string} attribute
2093
+ * @param {number} value
2094
+ * @param {number} min
2095
+ * @throws {AppwriteException}
2096
+ * @returns {Promise<Document>}
2097
+ */
2098
+ decrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number): Promise<Document> {
2099
+ if (typeof databaseId === 'undefined') {
2100
+ throw new AppwriteException('Missing required parameter: "databaseId"');
2101
+ }
2102
+ if (typeof collectionId === 'undefined') {
2103
+ throw new AppwriteException('Missing required parameter: "collectionId"');
2104
+ }
2105
+ if (typeof documentId === 'undefined') {
2106
+ throw new AppwriteException('Missing required parameter: "documentId"');
2107
+ }
2108
+ if (typeof attribute === 'undefined') {
2109
+ throw new AppwriteException('Missing required parameter: "attribute"');
2110
+ }
2111
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
2112
+ const payload: Payload = {};
2113
+ if (typeof value !== 'undefined') {
2114
+ payload['value'] = value;
2115
+ }
2116
+ if (typeof min !== 'undefined') {
2117
+ payload['min'] = min;
2118
+ }
2119
+ const uri = new URL(this.client.config.endpoint + apiPath);
2120
+
2121
+ const apiHeaders: { [header: string]: string } = {
2122
+ 'content-type': 'application/json',
2123
+ }
2124
+
2125
+ return this.client.call(
2126
+ 'patch',
2127
+ uri,
2128
+ apiHeaders,
2129
+ payload
2130
+ );
2131
+ }
2132
+
2133
+ /**
2134
+ * Increment a specific attribute of a document by a given value.
2135
+ *
2136
+ * @param {string} databaseId
2137
+ * @param {string} collectionId
2138
+ * @param {string} documentId
2139
+ * @param {string} attribute
2140
+ * @param {number} value
2141
+ * @param {number} max
2142
+ * @throws {AppwriteException}
2143
+ * @returns {Promise<Document>}
2144
+ */
2145
+ incrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number): Promise<Document> {
2146
+ if (typeof databaseId === 'undefined') {
2147
+ throw new AppwriteException('Missing required parameter: "databaseId"');
2148
+ }
2149
+ if (typeof collectionId === 'undefined') {
2150
+ throw new AppwriteException('Missing required parameter: "collectionId"');
2151
+ }
2152
+ if (typeof documentId === 'undefined') {
2153
+ throw new AppwriteException('Missing required parameter: "documentId"');
2154
+ }
2155
+ if (typeof attribute === 'undefined') {
2156
+ throw new AppwriteException('Missing required parameter: "attribute"');
2157
+ }
2158
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
2159
+ const payload: Payload = {};
2160
+ if (typeof value !== 'undefined') {
2161
+ payload['value'] = value;
2162
+ }
2163
+ if (typeof max !== 'undefined') {
2164
+ payload['max'] = max;
2165
+ }
2166
+ const uri = new URL(this.client.config.endpoint + apiPath);
2167
+
2168
+ const apiHeaders: { [header: string]: string } = {
2169
+ 'content-type': 'application/json',
2170
+ }
2171
+
2172
+ return this.client.call(
2173
+ 'patch',
2174
+ uri,
2175
+ apiHeaders,
2176
+ payload
2177
+ );
2178
+ }
2179
+
2028
2180
  /**
2029
2181
  * List indexes in the collection.
2030
2182
  *
@@ -2058,9 +2210,10 @@ export class Databases {
2058
2210
  payload
2059
2211
  );
2060
2212
  }
2213
+
2061
2214
  /**
2062
2215
  * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request.
2063
- Attributes can be `key`, `fulltext`, and `unique`.
2216
+ * Attributes can be `key`, `fulltext`, and `unique`.
2064
2217
  *
2065
2218
  * @param {string} databaseId
2066
2219
  * @param {string} collectionId
@@ -2118,6 +2271,7 @@ Attributes can be `key`, `fulltext`, and `unique`.
2118
2271
  payload
2119
2272
  );
2120
2273
  }
2274
+
2121
2275
  /**
2122
2276
  * Get index by ID.
2123
2277
  *
@@ -2151,6 +2305,7 @@ Attributes can be `key`, `fulltext`, and `unique`.
2151
2305
  payload
2152
2306
  );
2153
2307
  }
2308
+
2154
2309
  /**
2155
2310
  * Delete an index.
2156
2311
  *
@@ -2185,6 +2340,7 @@ Attributes can be `key`, `fulltext`, and `unique`.
2185
2340
  payload
2186
2341
  );
2187
2342
  }
2343
+
2188
2344
  /**
2189
2345
  * Get the collection activity logs list by its unique ID.
2190
2346
  *
@@ -2218,6 +2374,7 @@ Attributes can be `key`, `fulltext`, and `unique`.
2218
2374
  payload
2219
2375
  );
2220
2376
  }
2377
+
2221
2378
  /**
2222
2379
  * Get usage metrics and statistics for a collection. Returning the total number of documents. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.
2223
2380
  *
@@ -2251,6 +2408,7 @@ Attributes can be `key`, `fulltext`, and `unique`.
2251
2408
  payload
2252
2409
  );
2253
2410
  }
2411
+
2254
2412
  /**
2255
2413
  * Get the database activity logs list by its unique ID.
2256
2414
  *
@@ -2280,6 +2438,7 @@ Attributes can be `key`, `fulltext`, and `unique`.
2280
2438
  payload
2281
2439
  );
2282
2440
  }
2441
+
2283
2442
  /**
2284
2443
  * Get usage metrics and statistics for a database. You can view the total number of collections, documents, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.
2285
2444
  *