@@ -1655,6 +1655,82 @@ open class Databases: Service {
1655
1655
)
1656
1656
}
1657
1657
1658
+ ///
1659
+ /// **WARNING: Experimental Feature** - This endpoint is experimental and not
1660
+ /// yet officially supported. It may be subject to breaking changes or removal
1661
+ /// in future versions.
1662
+ ///
1663
+ /// Create new Documents. Before using this route, you should create a new
1664
+ /// collection resource using either a [server
1665
+ /// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
1666
+ /// API or directly from your database console.
1667
+ ///
1668
+ /// @param String databaseId
1669
+ /// @param String collectionId
1670
+ /// @param [Any] documents
1671
+ /// @throws Exception
1672
+ /// @return array
1673
+ ///
1674
+ open func createDocuments< T> (
1675
+ databaseId: String ,
1676
+ collectionId: String ,
1677
+ documents: [ Any ] ,
1678
+ nestedType: T . Type
1679
+ ) async throws -> AppwriteModels . DocumentList < T > {
1680
+ let apiPath : String = " /databases/{databaseId}/collections/{collectionId}/documents "
1681
+ . replacingOccurrences ( of: " {databaseId} " , with: databaseId)
1682
+ . replacingOccurrences ( of: " {collectionId} " , with: collectionId)
1683
+
1684
+ let apiParams : [ String : Any ? ] = [
1685
+ " documents " : documents
1686
+ ]
1687
+
1688
+ let apiHeaders : [ String : String ] = [
1689
+ " content-type " : " application/json "
1690
+ ]
1691
+
1692
+ let converter : ( Any ) -> AppwriteModels . DocumentList < T > = { response in
1693
+ return AppwriteModels . DocumentList. from ( map: response as! [ String : Any ] )
1694
+ }
1695
+
1696
+ return try await client. call (
1697
+ method: " POST " ,
1698
+ path: apiPath,
1699
+ headers: apiHeaders,
1700
+ params: apiParams,
1701
+ converter: converter
1702
+ )
1703
+ }
1704
+
1705
+ ///
1706
+ /// **WARNING: Experimental Feature** - This endpoint is experimental and not
1707
+ /// yet officially supported. It may be subject to breaking changes or removal
1708
+ /// in future versions.
1709
+ ///
1710
+ /// Create new Documents. Before using this route, you should create a new
1711
+ /// collection resource using either a [server
1712
+ /// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
1713
+ /// API or directly from your database console.
1714
+ ///
1715
+ /// @param String databaseId
1716
+ /// @param String collectionId
1717
+ /// @param [Any] documents
1718
+ /// @throws Exception
1719
+ /// @return array
1720
+ ///
1721
+ open func createDocuments(
1722
+ databaseId: String ,
1723
+ collectionId: String ,
1724
+ documents: [ Any ]
1725
+ ) async throws -> AppwriteModels . DocumentList < [ String : AnyCodable ] > {
1726
+ return try await createDocuments (
1727
+ databaseId: databaseId,
1728
+ collectionId: collectionId,
1729
+ documents: documents,
1730
+ nestedType: [ String : AnyCodable ] . self
1731
+ )
1732
+ }
1733
+
1658
1734
///
1659
1735
/// **WARNING: Experimental Feature** - This endpoint is experimental and not
1660
1736
/// yet officially supported. It may be subject to breaking changes or removal
0 commit comments