mirror of
https://github.com/appwrite/sdk-for-swift.git
synced 2026-04-07 19:17:48 +00:00
chore: regenerate sdk
This commit is contained in:
@@ -1655,6 +1655,82 @@ open class Databases: Service {
|
||||
)
|
||||
}
|
||||
|
||||
///
|
||||
/// **WARNING: Experimental Feature** - This endpoint is experimental and not
|
||||
/// yet officially supported. It may be subject to breaking changes or removal
|
||||
/// in future versions.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// @param String databaseId
|
||||
/// @param String collectionId
|
||||
/// @param [Any] documents
|
||||
/// @throws Exception
|
||||
/// @return array
|
||||
///
|
||||
open func createDocuments<T>(
|
||||
databaseId: String,
|
||||
collectionId: String,
|
||||
documents: [Any],
|
||||
nestedType: T.Type
|
||||
) async throws -> AppwriteModels.DocumentList<T> {
|
||||
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/documents"
|
||||
.replacingOccurrences(of: "{databaseId}", with: databaseId)
|
||||
.replacingOccurrences(of: "{collectionId}", with: collectionId)
|
||||
|
||||
let apiParams: [String: Any?] = [
|
||||
"documents": documents
|
||||
]
|
||||
|
||||
let apiHeaders: [String: String] = [
|
||||
"content-type": "application/json"
|
||||
]
|
||||
|
||||
let converter: (Any) -> AppwriteModels.DocumentList<T> = { response in
|
||||
return AppwriteModels.DocumentList.from(map: response as! [String: Any])
|
||||
}
|
||||
|
||||
return try await client.call(
|
||||
method: "POST",
|
||||
path: apiPath,
|
||||
headers: apiHeaders,
|
||||
params: apiParams,
|
||||
converter: converter
|
||||
)
|
||||
}
|
||||
|
||||
///
|
||||
/// **WARNING: Experimental Feature** - This endpoint is experimental and not
|
||||
/// yet officially supported. It may be subject to breaking changes or removal
|
||||
/// in future versions.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// @param String databaseId
|
||||
/// @param String collectionId
|
||||
/// @param [Any] documents
|
||||
/// @throws Exception
|
||||
/// @return array
|
||||
///
|
||||
open func createDocuments(
|
||||
databaseId: String,
|
||||
collectionId: String,
|
||||
documents: [Any]
|
||||
) async throws -> AppwriteModels.DocumentList<[String: AnyCodable]> {
|
||||
return try await createDocuments(
|
||||
databaseId: databaseId,
|
||||
collectionId: collectionId,
|
||||
documents: documents,
|
||||
nestedType: [String: AnyCodable].self
|
||||
)
|
||||
}
|
||||
|
||||
///
|
||||
/// **WARNING: Experimental Feature** - This endpoint is experimental and not
|
||||
/// yet officially supported. It may be subject to breaking changes or removal
|
||||
|
||||
@@ -38,7 +38,6 @@ public enum BuildRuntime: String, CustomStringConvertible {
|
||||
case dart31 = "dart-3.1"
|
||||
case dart33 = "dart-3.3"
|
||||
case dart35 = "dart-3.5"
|
||||
case dart38 = "dart-3.8"
|
||||
case dotnet60 = "dotnet-6.0"
|
||||
case dotnet70 = "dotnet-7.0"
|
||||
case dotnet80 = "dotnet-8.0"
|
||||
@@ -65,7 +64,6 @@ public enum BuildRuntime: String, CustomStringConvertible {
|
||||
case flutter324 = "flutter-3.24"
|
||||
case flutter327 = "flutter-3.27"
|
||||
case flutter329 = "flutter-3.29"
|
||||
case flutter332 = "flutter-3.32"
|
||||
|
||||
public var description: String {
|
||||
return rawValue
|
||||
|
||||
@@ -38,7 +38,6 @@ public enum Runtime: String, CustomStringConvertible {
|
||||
case dart31 = "dart-3.1"
|
||||
case dart33 = "dart-3.3"
|
||||
case dart35 = "dart-3.5"
|
||||
case dart38 = "dart-3.8"
|
||||
case dotnet60 = "dotnet-6.0"
|
||||
case dotnet70 = "dotnet-7.0"
|
||||
case dotnet80 = "dotnet-8.0"
|
||||
@@ -65,7 +64,6 @@ public enum Runtime: String, CustomStringConvertible {
|
||||
case flutter324 = "flutter-3.24"
|
||||
case flutter327 = "flutter-3.27"
|
||||
case flutter329 = "flutter-3.29"
|
||||
case flutter332 = "flutter-3.32"
|
||||
|
||||
public var description: String {
|
||||
return rawValue
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import Appwrite
|
||||
|
||||
let client = Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.setKey("<YOUR_API_KEY>") // Your secret API key
|
||||
|
||||
let databases = Databases(client)
|
||||
|
||||
let documentList = try await databases.createDocuments(
|
||||
databaseId: "<DATABASE_ID>",
|
||||
collectionId: "<COLLECTION_ID>",
|
||||
documents: []
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user