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.
@@ -1577,14 +1577,16 @@ var Databases = class {
1577
1577
  );
1578
1578
  }
1579
1579
  /**
1580
- * 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.
1581
- *
1582
- * @param {string} databaseId
1583
- * @param {string} collectionId
1584
- * @param {object[]} documents
1585
- * @throws {AppwriteException}
1586
- * @returns {Promise<Models.DocumentList<Document>>}
1587
- */
1580
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1581
+
1582
+ 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.
1583
+ *
1584
+ * @param {string} databaseId
1585
+ * @param {string} collectionId
1586
+ * @param {object[]} documents
1587
+ * @throws {AppwriteException}
1588
+ * @returns {Promise<Models.DocumentList<Document>>}
1589
+ */
1588
1590
  createDocuments(databaseId, collectionId, documents) {
1589
1591
  if (typeof databaseId === "undefined") {
1590
1592
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -1612,8 +1614,9 @@ var Databases = class {
1612
1614
  );
1613
1615
  }
1614
1616
  /**
1615
- * 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.
1617
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1616
1618
 
1619
+ 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.
1617
1620
  *
1618
1621
  * @param {string} databaseId
1619
1622
  * @param {string} collectionId
@@ -1628,6 +1631,9 @@ var Databases = class {
1628
1631
  if (typeof collectionId === "undefined") {
1629
1632
  throw new AppwriteException('Missing required parameter: "collectionId"');
1630
1633
  }
1634
+ if (typeof documents === "undefined") {
1635
+ throw new AppwriteException('Missing required parameter: "documents"');
1636
+ }
1631
1637
  const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
1632
1638
  const payload = {};
1633
1639
  if (typeof documents !== "undefined") {
@@ -1645,15 +1651,17 @@ var Databases = class {
1645
1651
  );
1646
1652
  }
1647
1653
  /**
1648
- * 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.
1649
- *
1650
- * @param {string} databaseId
1651
- * @param {string} collectionId
1652
- * @param {object} data
1653
- * @param {string[]} queries
1654
- * @throws {AppwriteException}
1655
- * @returns {Promise<Models.DocumentList<Document>>}
1656
- */
1654
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1655
+
1656
+ 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.
1657
+ *
1658
+ * @param {string} databaseId
1659
+ * @param {string} collectionId
1660
+ * @param {object} data
1661
+ * @param {string[]} queries
1662
+ * @throws {AppwriteException}
1663
+ * @returns {Promise<Models.DocumentList<Document>>}
1664
+ */
1657
1665
  updateDocuments(databaseId, collectionId, data, queries) {
1658
1666
  if (typeof databaseId === "undefined") {
1659
1667
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -1681,14 +1689,16 @@ var Databases = class {
1681
1689
  );
1682
1690
  }
1683
1691
  /**
1684
- * Bulk delete documents using queries, if no queries are passed then all documents are deleted.
1685
- *
1686
- * @param {string} databaseId
1687
- * @param {string} collectionId
1688
- * @param {string[]} queries
1689
- * @throws {AppwriteException}
1690
- * @returns {Promise<Models.DocumentList<Document>>}
1691
- */
1692
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1693
+
1694
+ Bulk delete documents using queries, if no queries are passed then all documents are deleted.
1695
+ *
1696
+ * @param {string} databaseId
1697
+ * @param {string} collectionId
1698
+ * @param {string[]} queries
1699
+ * @throws {AppwriteException}
1700
+ * @returns {Promise<Models.DocumentList<Document>>}
1701
+ */
1692
1702
  deleteDocuments(databaseId, collectionId, queries) {
1693
1703
  if (typeof databaseId === "undefined") {
1694
1704
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -1746,6 +1756,51 @@ var Databases = class {
1746
1756
  payload
1747
1757
  );
1748
1758
  }
1759
+ /**
1760
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1761
+
1762
+ 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.
1763
+ *
1764
+ * @param {string} databaseId
1765
+ * @param {string} collectionId
1766
+ * @param {string} documentId
1767
+ * @param {object} data
1768
+ * @param {string[]} permissions
1769
+ * @throws {AppwriteException}
1770
+ * @returns {Promise<Document>}
1771
+ */
1772
+ upsertDocument(databaseId, collectionId, documentId, data, permissions) {
1773
+ if (typeof databaseId === "undefined") {
1774
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1775
+ }
1776
+ if (typeof collectionId === "undefined") {
1777
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1778
+ }
1779
+ if (typeof documentId === "undefined") {
1780
+ throw new AppwriteException('Missing required parameter: "documentId"');
1781
+ }
1782
+ if (typeof data === "undefined") {
1783
+ throw new AppwriteException('Missing required parameter: "data"');
1784
+ }
1785
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{documentId}", documentId);
1786
+ const payload = {};
1787
+ if (typeof data !== "undefined") {
1788
+ payload["data"] = data;
1789
+ }
1790
+ if (typeof permissions !== "undefined") {
1791
+ payload["permissions"] = permissions;
1792
+ }
1793
+ const uri = new URL(this.client.config.endpoint + apiPath);
1794
+ const apiHeaders = {
1795
+ "content-type": "application/json"
1796
+ };
1797
+ return this.client.call(
1798
+ "put",
1799
+ uri,
1800
+ apiHeaders,
1801
+ payload
1802
+ );
1803
+ }
1749
1804
  /**
1750
1805
  * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
1751
1806
  *