node-appwrite 17.0.0 → 17.1.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.
@@ -452,7 +452,9 @@ declare class Databases {
452
452
  */
453
453
  createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: Omit<Document, keyof Models.Document>, permissions?: string[]): Promise<Document>;
454
454
  /**
455
- * 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.
455
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
456
+
457
+ 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.
456
458
  *
457
459
  * @param {string} databaseId
458
460
  * @param {string} collectionId
@@ -462,8 +464,9 @@ declare class Databases {
462
464
  */
463
465
  createDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, documents: object[]): Promise<Models.DocumentList<Document>>;
464
466
  /**
465
- * 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.
467
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
466
468
 
469
+ 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.
467
470
  *
468
471
  * @param {string} databaseId
469
472
  * @param {string} collectionId
@@ -471,9 +474,11 @@ declare class Databases {
471
474
  * @throws {AppwriteException}
472
475
  * @returns {Promise<Models.DocumentList<Document>>}
473
476
  */
474
- upsertDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, documents?: object[]): Promise<Models.DocumentList<Document>>;
477
+ upsertDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, documents: object[]): Promise<Models.DocumentList<Document>>;
475
478
  /**
476
- * 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.
479
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
480
+
481
+ 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.
477
482
  *
478
483
  * @param {string} databaseId
479
484
  * @param {string} collectionId
@@ -484,7 +489,9 @@ declare class Databases {
484
489
  */
485
490
  updateDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, data?: object, queries?: string[]): Promise<Models.DocumentList<Document>>;
486
491
  /**
487
- * Bulk delete documents using queries, if no queries are passed then all documents are deleted.
492
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
493
+
494
+ Bulk delete documents using queries, if no queries are passed then all documents are deleted.
488
495
  *
489
496
  * @param {string} databaseId
490
497
  * @param {string} collectionId
@@ -504,6 +511,20 @@ declare class Databases {
504
511
  * @returns {Promise<Document>}
505
512
  */
506
513
  getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Document>;
514
+ /**
515
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
516
+
517
+ 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.
518
+ *
519
+ * @param {string} databaseId
520
+ * @param {string} collectionId
521
+ * @param {string} documentId
522
+ * @param {object} data
523
+ * @param {string[]} permissions
524
+ * @throws {AppwriteException}
525
+ * @returns {Promise<Document>}
526
+ */
527
+ upsertDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: object, permissions?: string[]): Promise<Document>;
507
528
  /**
508
529
  * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
509
530
  *
@@ -452,7 +452,9 @@ declare class Databases {
452
452
  */
453
453
  createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: Omit<Document, keyof Models.Document>, permissions?: string[]): Promise<Document>;
454
454
  /**
455
- * 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.
455
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
456
+
457
+ 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.
456
458
  *
457
459
  * @param {string} databaseId
458
460
  * @param {string} collectionId
@@ -462,8 +464,9 @@ declare class Databases {
462
464
  */
463
465
  createDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, documents: object[]): Promise<Models.DocumentList<Document>>;
464
466
  /**
465
- * 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.
467
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
466
468
 
469
+ 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.
467
470
  *
468
471
  * @param {string} databaseId
469
472
  * @param {string} collectionId
@@ -471,9 +474,11 @@ declare class Databases {
471
474
  * @throws {AppwriteException}
472
475
  * @returns {Promise<Models.DocumentList<Document>>}
473
476
  */
474
- upsertDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, documents?: object[]): Promise<Models.DocumentList<Document>>;
477
+ upsertDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, documents: object[]): Promise<Models.DocumentList<Document>>;
475
478
  /**
476
- * 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.
479
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
480
+
481
+ 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.
477
482
  *
478
483
  * @param {string} databaseId
479
484
  * @param {string} collectionId
@@ -484,7 +489,9 @@ declare class Databases {
484
489
  */
485
490
  updateDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, data?: object, queries?: string[]): Promise<Models.DocumentList<Document>>;
486
491
  /**
487
- * Bulk delete documents using queries, if no queries are passed then all documents are deleted.
492
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
493
+
494
+ Bulk delete documents using queries, if no queries are passed then all documents are deleted.
488
495
  *
489
496
  * @param {string} databaseId
490
497
  * @param {string} collectionId
@@ -504,6 +511,20 @@ declare class Databases {
504
511
  * @returns {Promise<Document>}
505
512
  */
506
513
  getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Document>;
514
+ /**
515
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
516
+
517
+ 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.
518
+ *
519
+ * @param {string} databaseId
520
+ * @param {string} collectionId
521
+ * @param {string} documentId
522
+ * @param {object} data
523
+ * @param {string[]} permissions
524
+ * @throws {AppwriteException}
525
+ * @returns {Promise<Document>}
526
+ */
527
+ upsertDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: object, permissions?: string[]): Promise<Document>;
507
528
  /**
508
529
  * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
509
530
  *
@@ -1578,14 +1578,16 @@ class Databases {
1578
1578
  );
1579
1579
  }
1580
1580
  /**
1581
- * 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.
1582
- *
1583
- * @param {string} databaseId
1584
- * @param {string} collectionId
1585
- * @param {object[]} documents
1586
- * @throws {AppwriteException}
1587
- * @returns {Promise<Models.DocumentList<Document>>}
1588
- */
1581
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1582
+
1583
+ 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.
1584
+ *
1585
+ * @param {string} databaseId
1586
+ * @param {string} collectionId
1587
+ * @param {object[]} documents
1588
+ * @throws {AppwriteException}
1589
+ * @returns {Promise<Models.DocumentList<Document>>}
1590
+ */
1589
1591
  createDocuments(databaseId, collectionId, documents) {
1590
1592
  if (typeof databaseId === "undefined") {
1591
1593
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
@@ -1613,8 +1615,9 @@ class Databases {
1613
1615
  );
1614
1616
  }
1615
1617
  /**
1616
- * 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.
1618
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1617
1619
 
1620
+ 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.
1618
1621
  *
1619
1622
  * @param {string} databaseId
1620
1623
  * @param {string} collectionId
@@ -1629,6 +1632,9 @@ class Databases {
1629
1632
  if (typeof collectionId === "undefined") {
1630
1633
  throw new client.AppwriteException('Missing required parameter: "collectionId"');
1631
1634
  }
1635
+ if (typeof documents === "undefined") {
1636
+ throw new client.AppwriteException('Missing required parameter: "documents"');
1637
+ }
1632
1638
  const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
1633
1639
  const payload = {};
1634
1640
  if (typeof documents !== "undefined") {
@@ -1646,15 +1652,17 @@ class Databases {
1646
1652
  );
1647
1653
  }
1648
1654
  /**
1649
- * 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.
1650
- *
1651
- * @param {string} databaseId
1652
- * @param {string} collectionId
1653
- * @param {object} data
1654
- * @param {string[]} queries
1655
- * @throws {AppwriteException}
1656
- * @returns {Promise<Models.DocumentList<Document>>}
1657
- */
1655
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1656
+
1657
+ 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.
1658
+ *
1659
+ * @param {string} databaseId
1660
+ * @param {string} collectionId
1661
+ * @param {object} data
1662
+ * @param {string[]} queries
1663
+ * @throws {AppwriteException}
1664
+ * @returns {Promise<Models.DocumentList<Document>>}
1665
+ */
1658
1666
  updateDocuments(databaseId, collectionId, data, queries) {
1659
1667
  if (typeof databaseId === "undefined") {
1660
1668
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
@@ -1682,14 +1690,16 @@ class Databases {
1682
1690
  );
1683
1691
  }
1684
1692
  /**
1685
- * Bulk delete documents using queries, if no queries are passed then all documents are deleted.
1686
- *
1687
- * @param {string} databaseId
1688
- * @param {string} collectionId
1689
- * @param {string[]} queries
1690
- * @throws {AppwriteException}
1691
- * @returns {Promise<Models.DocumentList<Document>>}
1692
- */
1693
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1694
+
1695
+ Bulk delete documents using queries, if no queries are passed then all documents are deleted.
1696
+ *
1697
+ * @param {string} databaseId
1698
+ * @param {string} collectionId
1699
+ * @param {string[]} queries
1700
+ * @throws {AppwriteException}
1701
+ * @returns {Promise<Models.DocumentList<Document>>}
1702
+ */
1693
1703
  deleteDocuments(databaseId, collectionId, queries) {
1694
1704
  if (typeof databaseId === "undefined") {
1695
1705
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
@@ -1747,6 +1757,51 @@ class Databases {
1747
1757
  payload
1748
1758
  );
1749
1759
  }
1760
+ /**
1761
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1762
+
1763
+ 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.
1764
+ *
1765
+ * @param {string} databaseId
1766
+ * @param {string} collectionId
1767
+ * @param {string} documentId
1768
+ * @param {object} data
1769
+ * @param {string[]} permissions
1770
+ * @throws {AppwriteException}
1771
+ * @returns {Promise<Document>}
1772
+ */
1773
+ upsertDocument(databaseId, collectionId, documentId, data, permissions) {
1774
+ if (typeof databaseId === "undefined") {
1775
+ throw new client.AppwriteException('Missing required parameter: "databaseId"');
1776
+ }
1777
+ if (typeof collectionId === "undefined") {
1778
+ throw new client.AppwriteException('Missing required parameter: "collectionId"');
1779
+ }
1780
+ if (typeof documentId === "undefined") {
1781
+ throw new client.AppwriteException('Missing required parameter: "documentId"');
1782
+ }
1783
+ if (typeof data === "undefined") {
1784
+ throw new client.AppwriteException('Missing required parameter: "data"');
1785
+ }
1786
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{documentId}", documentId);
1787
+ const payload = {};
1788
+ if (typeof data !== "undefined") {
1789
+ payload["data"] = data;
1790
+ }
1791
+ if (typeof permissions !== "undefined") {
1792
+ payload["permissions"] = permissions;
1793
+ }
1794
+ const uri = new URL(this.client.config.endpoint + apiPath);
1795
+ const apiHeaders = {
1796
+ "content-type": "application/json"
1797
+ };
1798
+ return this.client.call(
1799
+ "put",
1800
+ uri,
1801
+ apiHeaders,
1802
+ payload
1803
+ );
1804
+ }
1750
1805
  /**
1751
1806
  * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
1752
1807
  *