From 32f43932b4685330f7b47ad0963ff53d5a51443e Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Sun, 18 May 2025 02:03:51 +1200 Subject: [PATCH] Add 1.7 support --- .../java/databases/create-documents.md | 24 -------- .../kotlin/databases/create-documents.md | 15 ----- .../java/io/appwrite/services/Databases.kt | 58 ------------------- 3 files changed, 97 deletions(-) delete mode 100644 docs/examples/java/databases/create-documents.md delete mode 100644 docs/examples/kotlin/databases/create-documents.md diff --git a/docs/examples/java/databases/create-documents.md b/docs/examples/java/databases/create-documents.md deleted file mode 100644 index dbdc64f..0000000 --- a/docs/examples/java/databases/create-documents.md +++ /dev/null @@ -1,24 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Databases; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setKey(""); // - -Databases databases = new Databases(client); - -databases.createDocuments( - "", // databaseId - "", // collectionId - listOf(), // documents - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - diff --git a/docs/examples/kotlin/databases/create-documents.md b/docs/examples/kotlin/databases/create-documents.md deleted file mode 100644 index 33635b4..0000000 --- a/docs/examples/kotlin/databases/create-documents.md +++ /dev/null @@ -1,15 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Databases - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setKey("") // - -val databases = Databases(client) - -val result = databases.createDocuments( - databaseId = "", - collectionId = "", - documents = listOf(), -) \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/services/Databases.kt b/library/src/main/java/io/appwrite/services/Databases.kt index 73384a1..b6559a9 100644 --- a/library/src/main/java/io/appwrite/services/Databases.kt +++ b/library/src/main/java/io/appwrite/services/Databases.kt @@ -146,64 +146,6 @@ class Databases(client: Client) : Service(client) { nestedType = classOf(), ) - /** - * 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 databaseId Database ID. - * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. - * @param documents Array of documents data as JSON objects. - * @return [io.appwrite.models.DocumentList] - */ - suspend fun createDocuments( - databaseId: String, - collectionId: String, - documents: List, - nestedType: Class, - ): io.appwrite.models.DocumentList { - val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents" - .replace("{databaseId}", databaseId) - .replace("{collectionId}", collectionId) - - val apiParams = mutableMapOf( - "documents" to documents, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.DocumentList = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.DocumentList.from(map = it as Map, nestedType) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * 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 databaseId Database ID. - * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. - * @param documents Array of documents data as JSON objects. - * @return [io.appwrite.models.DocumentList] - */ - @Throws(AppwriteException::class) - suspend fun createDocuments( - databaseId: String, - collectionId: String, - documents: List, - ): io.appwrite.models.DocumentList> = createDocuments( - databaseId, - collectionId, - documents, - nestedType = classOf(), - ) - /** * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. *