From 0ad33c78f765b1dff1ff3d076fb38666b1e0612b Mon Sep 17 00:00:00 2001 From: root Date: Tue, 24 Mar 2026 12:58:56 +0000 Subject: [PATCH 1/6] feat: update Android SDK to 12.1.1 * Added Java `DocumentsDB` CRUD operation examples in docs * Updated server compatibility note to Appwrite server version 1.8.x * Updated Gradle/Maven dependencies to `12.1.0` * Updated API version badge to `1.9.0` in README --- CHANGELOG.md | 11 +- README.md | 8 +- .../java/databases/upsert-documents.md | 27 + .../java/documentsdb/create-document.md | 36 + .../java/documentsdb/create-documents.md | 26 + .../java/documentsdb/create-operations.md | 33 + .../java/documentsdb/create-transaction.md | 24 + .../decrement-document-attribute.md | 30 + .../java/documentsdb/delete-document.md | 27 + .../java/documentsdb/delete-transaction.md | 24 + .../examples/java/documentsdb/get-document.md | 28 + .../java/documentsdb/get-transaction.md | 24 + .../increment-document-attribute.md | 30 + .../java/documentsdb/list-documents.md | 29 + .../java/documentsdb/list-transactions.md | 24 + .../java/documentsdb/update-document.md | 31 + .../java/documentsdb/update-transaction.md | 26 + .../java/documentsdb/upsert-document.md | 31 + .../java/vectorsdb/create-document.md | 35 + .../java/vectorsdb/create-operations.md | 33 + .../java/vectorsdb/create-transaction.md | 24 + .../java/vectorsdb/delete-document.md | 27 + .../java/vectorsdb/delete-transaction.md | 24 + docs/examples/java/vectorsdb/get-document.md | 28 + .../java/vectorsdb/get-transaction.md | 24 + .../examples/java/vectorsdb/list-documents.md | 29 + .../java/vectorsdb/list-transactions.md | 24 + .../java/vectorsdb/update-document.md | 31 + .../java/vectorsdb/update-transaction.md | 26 + .../java/vectorsdb/upsert-document.md | 31 + .../kotlin/databases/upsert-documents.md | 18 + .../kotlin/documentsdb/create-document.md | 27 + .../kotlin/documentsdb/create-documents.md | 17 + .../kotlin/documentsdb/create-operations.md | 24 + .../kotlin/documentsdb/create-transaction.md | 15 + .../decrement-document-attribute.md | 21 + .../kotlin/documentsdb/delete-document.md | 18 + .../kotlin/documentsdb/delete-transaction.md | 15 + .../kotlin/documentsdb/get-document.md | 19 + .../kotlin/documentsdb/get-transaction.md | 15 + .../increment-document-attribute.md | 21 + .../kotlin/documentsdb/list-documents.md | 20 + .../kotlin/documentsdb/list-transactions.md | 15 + .../kotlin/documentsdb/update-document.md | 22 + .../kotlin/documentsdb/update-transaction.md | 17 + .../kotlin/documentsdb/upsert-document.md | 22 + .../kotlin/vectorsdb/create-document.md | 26 + .../kotlin/vectorsdb/create-operations.md | 24 + .../kotlin/vectorsdb/create-transaction.md | 15 + .../kotlin/vectorsdb/delete-document.md | 18 + .../kotlin/vectorsdb/delete-transaction.md | 15 + .../examples/kotlin/vectorsdb/get-document.md | 19 + .../kotlin/vectorsdb/get-transaction.md | 15 + .../kotlin/vectorsdb/list-documents.md | 20 + .../kotlin/vectorsdb/list-transactions.md | 15 + .../kotlin/vectorsdb/update-document.md | 22 + .../kotlin/vectorsdb/update-transaction.md | 17 + .../kotlin/vectorsdb/upsert-document.md | 22 + library/src/main/java/io/appwrite/Client.kt | 49 +- .../main/java/io/appwrite/models/Document.kt | 6 +- .../src/main/java/io/appwrite/models/Log.kt | 6 +- .../src/main/java/io/appwrite/models/Row.kt | 6 +- .../src/main/java/io/appwrite/models/User.kt | 20 + .../java/io/appwrite/services/Databases.kt | 76 ++ .../java/io/appwrite/services/DocumentsDB.kt | 854 ++++++++++++++++++ .../java/io/appwrite/services/VectorsDB.kt | 628 +++++++++++++ 66 files changed, 2963 insertions(+), 21 deletions(-) create mode 100644 docs/examples/java/databases/upsert-documents.md create mode 100644 docs/examples/java/documentsdb/create-document.md create mode 100644 docs/examples/java/documentsdb/create-documents.md create mode 100644 docs/examples/java/documentsdb/create-operations.md create mode 100644 docs/examples/java/documentsdb/create-transaction.md create mode 100644 docs/examples/java/documentsdb/decrement-document-attribute.md create mode 100644 docs/examples/java/documentsdb/delete-document.md create mode 100644 docs/examples/java/documentsdb/delete-transaction.md create mode 100644 docs/examples/java/documentsdb/get-document.md create mode 100644 docs/examples/java/documentsdb/get-transaction.md create mode 100644 docs/examples/java/documentsdb/increment-document-attribute.md create mode 100644 docs/examples/java/documentsdb/list-documents.md create mode 100644 docs/examples/java/documentsdb/list-transactions.md create mode 100644 docs/examples/java/documentsdb/update-document.md create mode 100644 docs/examples/java/documentsdb/update-transaction.md create mode 100644 docs/examples/java/documentsdb/upsert-document.md create mode 100644 docs/examples/java/vectorsdb/create-document.md create mode 100644 docs/examples/java/vectorsdb/create-operations.md create mode 100644 docs/examples/java/vectorsdb/create-transaction.md create mode 100644 docs/examples/java/vectorsdb/delete-document.md create mode 100644 docs/examples/java/vectorsdb/delete-transaction.md create mode 100644 docs/examples/java/vectorsdb/get-document.md create mode 100644 docs/examples/java/vectorsdb/get-transaction.md create mode 100644 docs/examples/java/vectorsdb/list-documents.md create mode 100644 docs/examples/java/vectorsdb/list-transactions.md create mode 100644 docs/examples/java/vectorsdb/update-document.md create mode 100644 docs/examples/java/vectorsdb/update-transaction.md create mode 100644 docs/examples/java/vectorsdb/upsert-document.md create mode 100644 docs/examples/kotlin/databases/upsert-documents.md create mode 100644 docs/examples/kotlin/documentsdb/create-document.md create mode 100644 docs/examples/kotlin/documentsdb/create-documents.md create mode 100644 docs/examples/kotlin/documentsdb/create-operations.md create mode 100644 docs/examples/kotlin/documentsdb/create-transaction.md create mode 100644 docs/examples/kotlin/documentsdb/decrement-document-attribute.md create mode 100644 docs/examples/kotlin/documentsdb/delete-document.md create mode 100644 docs/examples/kotlin/documentsdb/delete-transaction.md create mode 100644 docs/examples/kotlin/documentsdb/get-document.md create mode 100644 docs/examples/kotlin/documentsdb/get-transaction.md create mode 100644 docs/examples/kotlin/documentsdb/increment-document-attribute.md create mode 100644 docs/examples/kotlin/documentsdb/list-documents.md create mode 100644 docs/examples/kotlin/documentsdb/list-transactions.md create mode 100644 docs/examples/kotlin/documentsdb/update-document.md create mode 100644 docs/examples/kotlin/documentsdb/update-transaction.md create mode 100644 docs/examples/kotlin/documentsdb/upsert-document.md create mode 100644 docs/examples/kotlin/vectorsdb/create-document.md create mode 100644 docs/examples/kotlin/vectorsdb/create-operations.md create mode 100644 docs/examples/kotlin/vectorsdb/create-transaction.md create mode 100644 docs/examples/kotlin/vectorsdb/delete-document.md create mode 100644 docs/examples/kotlin/vectorsdb/delete-transaction.md create mode 100644 docs/examples/kotlin/vectorsdb/get-document.md create mode 100644 docs/examples/kotlin/vectorsdb/get-transaction.md create mode 100644 docs/examples/kotlin/vectorsdb/list-documents.md create mode 100644 docs/examples/kotlin/vectorsdb/list-transactions.md create mode 100644 docs/examples/kotlin/vectorsdb/update-document.md create mode 100644 docs/examples/kotlin/vectorsdb/update-transaction.md create mode 100644 docs/examples/kotlin/vectorsdb/upsert-document.md create mode 100644 library/src/main/java/io/appwrite/services/DocumentsDB.kt create mode 100644 library/src/main/java/io/appwrite/services/VectorsDB.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 0daed689..76b26619 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,11 @@ # Change Log -## 13.0.0 +## 12.1.1 -* Breaking: Channel factory methods require explicit IDs (no wildcard defaults) -* Added ttl parameter to listDocuments and listRows for caching -* Updated x-sdk-version header to 12.2.1 in Client -* Updated docs and examples to show TTL usage and latest compatibility note -* Updated Document and Row sequence descriptions in models +* Added Java `DocumentsDB` CRUD operation examples in docs +* Updated server compatibility note to Appwrite server version 1.8.x +* Updated Gradle/Maven dependencies to `12.1.0` +* Updated API version badge to `1.9.0` in README ## 12.1.0 diff --git a/README.md b/README.md index 97afbafe..6a6caca2 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,12 @@ ![Maven Central](https://img.shields.io/maven-central/v/io.appwrite/sdk-for-android.svg?color=green&style=flat-square) ![License](https://img.shields.io/github/license/appwrite/sdk-for-android.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.8.1-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.9.0-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-android/releases).** +**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-android/releases).** Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Android SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) @@ -38,7 +38,7 @@ repositories { Next, add the dependency to your project's `build.gradle(.kts)` file: ```groovy -implementation("io.appwrite:sdk-for-android:13.0.0") +implementation("io.appwrite:sdk-for-android:12.1.1") ``` ### Maven @@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-android - 13.0.0 + 12.1.1 ``` diff --git a/docs/examples/java/databases/upsert-documents.md b/docs/examples/java/databases/upsert-documents.md new file mode 100644 index 00000000..b3687f82 --- /dev/null +++ b/docs/examples/java/databases/upsert-documents.md @@ -0,0 +1,27 @@ +```java +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 + .setProject(""); // Your project ID + +Databases databases = new Databases(client); + +databases.upsertDocuments( + "", // databaseId + "", // collectionId + List.of(), // documents + "", // transactionId (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/documentsdb/create-document.md b/docs/examples/java/documentsdb/create-document.md new file mode 100644 index 00000000..c7f5720d --- /dev/null +++ b/docs/examples/java/documentsdb/create-document.md @@ -0,0 +1,36 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.Permission; +import io.appwrite.Role; +import io.appwrite.services.DocumentsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +DocumentsDB documentsDB = new DocumentsDB(client); + +documentsDB.createDocument( + "", // databaseId + "", // collectionId + "", // documentId + Map.of( + "username", "walter.obrien", + "email", "walter.obrien@example.com", + "fullName", "Walter O'Brien", + "age", 30, + "isAdmin", false + ), // data + List.of(Permission.read(Role.any())), // permissions (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/documentsdb/create-documents.md b/docs/examples/java/documentsdb/create-documents.md new file mode 100644 index 00000000..8ff433cb --- /dev/null +++ b/docs/examples/java/documentsdb/create-documents.md @@ -0,0 +1,26 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.DocumentsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +DocumentsDB documentsDB = new DocumentsDB(client); + +documentsDB.createDocuments( + "", // databaseId + "", // collectionId + List.of(), // documents + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/documentsdb/create-operations.md b/docs/examples/java/documentsdb/create-operations.md new file mode 100644 index 00000000..f42f5b11 --- /dev/null +++ b/docs/examples/java/documentsdb/create-operations.md @@ -0,0 +1,33 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.DocumentsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +DocumentsDB documentsDB = new DocumentsDB(client); + +documentsDB.createOperations( + "", // transactionId + List.of(Map.of( + "action", "create", + "databaseId", "", + "collectionId", "", + "documentId", "", + "data", Map.of( + "name", "Walter O'Brien" + ) + )), // operations (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/documentsdb/create-transaction.md b/docs/examples/java/documentsdb/create-transaction.md new file mode 100644 index 00000000..cc329e4f --- /dev/null +++ b/docs/examples/java/documentsdb/create-transaction.md @@ -0,0 +1,24 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.DocumentsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +DocumentsDB documentsDB = new DocumentsDB(client); + +documentsDB.createTransaction( + 60, // ttl (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/documentsdb/decrement-document-attribute.md b/docs/examples/java/documentsdb/decrement-document-attribute.md new file mode 100644 index 00000000..db8b9c96 --- /dev/null +++ b/docs/examples/java/documentsdb/decrement-document-attribute.md @@ -0,0 +1,30 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.DocumentsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +DocumentsDB documentsDB = new DocumentsDB(client); + +documentsDB.decrementDocumentAttribute( + "", // databaseId + "", // collectionId + "", // documentId + "", // attribute + 0, // value (optional) + 0, // min (optional) + "", // transactionId (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/documentsdb/delete-document.md b/docs/examples/java/documentsdb/delete-document.md new file mode 100644 index 00000000..d2547598 --- /dev/null +++ b/docs/examples/java/documentsdb/delete-document.md @@ -0,0 +1,27 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.DocumentsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +DocumentsDB documentsDB = new DocumentsDB(client); + +documentsDB.deleteDocument( + "", // databaseId + "", // collectionId + "", // documentId + "", // transactionId (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/documentsdb/delete-transaction.md b/docs/examples/java/documentsdb/delete-transaction.md new file mode 100644 index 00000000..7d480e1a --- /dev/null +++ b/docs/examples/java/documentsdb/delete-transaction.md @@ -0,0 +1,24 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.DocumentsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +DocumentsDB documentsDB = new DocumentsDB(client); + +documentsDB.deleteTransaction( + "", // transactionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/documentsdb/get-document.md b/docs/examples/java/documentsdb/get-document.md new file mode 100644 index 00000000..227052e8 --- /dev/null +++ b/docs/examples/java/documentsdb/get-document.md @@ -0,0 +1,28 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.DocumentsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +DocumentsDB documentsDB = new DocumentsDB(client); + +documentsDB.getDocument( + "", // databaseId + "", // collectionId + "", // documentId + List.of(), // queries (optional) + "", // transactionId (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/documentsdb/get-transaction.md b/docs/examples/java/documentsdb/get-transaction.md new file mode 100644 index 00000000..4ea856d9 --- /dev/null +++ b/docs/examples/java/documentsdb/get-transaction.md @@ -0,0 +1,24 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.DocumentsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +DocumentsDB documentsDB = new DocumentsDB(client); + +documentsDB.getTransaction( + "", // transactionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/documentsdb/increment-document-attribute.md b/docs/examples/java/documentsdb/increment-document-attribute.md new file mode 100644 index 00000000..a88252b8 --- /dev/null +++ b/docs/examples/java/documentsdb/increment-document-attribute.md @@ -0,0 +1,30 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.DocumentsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +DocumentsDB documentsDB = new DocumentsDB(client); + +documentsDB.incrementDocumentAttribute( + "", // databaseId + "", // collectionId + "", // documentId + "", // attribute + 0, // value (optional) + 0, // max (optional) + "", // transactionId (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/documentsdb/list-documents.md b/docs/examples/java/documentsdb/list-documents.md new file mode 100644 index 00000000..10af35fd --- /dev/null +++ b/docs/examples/java/documentsdb/list-documents.md @@ -0,0 +1,29 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.DocumentsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +DocumentsDB documentsDB = new DocumentsDB(client); + +documentsDB.listDocuments( + "", // databaseId + "", // collectionId + List.of(), // queries (optional) + "", // transactionId (optional) + false, // total (optional) + 0, // ttl (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/documentsdb/list-transactions.md b/docs/examples/java/documentsdb/list-transactions.md new file mode 100644 index 00000000..54506e0e --- /dev/null +++ b/docs/examples/java/documentsdb/list-transactions.md @@ -0,0 +1,24 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.DocumentsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +DocumentsDB documentsDB = new DocumentsDB(client); + +documentsDB.listTransactions( + List.of(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/documentsdb/update-document.md b/docs/examples/java/documentsdb/update-document.md new file mode 100644 index 00000000..8fe84930 --- /dev/null +++ b/docs/examples/java/documentsdb/update-document.md @@ -0,0 +1,31 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.Permission; +import io.appwrite.Role; +import io.appwrite.services.DocumentsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +DocumentsDB documentsDB = new DocumentsDB(client); + +documentsDB.updateDocument( + "", // databaseId + "", // collectionId + "", // documentId + Map.of("a", "b"), // data (optional) + List.of(Permission.read(Role.any())), // permissions (optional) + "", // transactionId (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/documentsdb/update-transaction.md b/docs/examples/java/documentsdb/update-transaction.md new file mode 100644 index 00000000..dd15c62d --- /dev/null +++ b/docs/examples/java/documentsdb/update-transaction.md @@ -0,0 +1,26 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.DocumentsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +DocumentsDB documentsDB = new DocumentsDB(client); + +documentsDB.updateTransaction( + "", // transactionId + false, // commit (optional) + false, // rollback (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/documentsdb/upsert-document.md b/docs/examples/java/documentsdb/upsert-document.md new file mode 100644 index 00000000..f949f286 --- /dev/null +++ b/docs/examples/java/documentsdb/upsert-document.md @@ -0,0 +1,31 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.Permission; +import io.appwrite.Role; +import io.appwrite.services.DocumentsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +DocumentsDB documentsDB = new DocumentsDB(client); + +documentsDB.upsertDocument( + "", // databaseId + "", // collectionId + "", // documentId + Map.of("a", "b"), // data (optional) + List.of(Permission.read(Role.any())), // permissions (optional) + "", // transactionId (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/vectorsdb/create-document.md b/docs/examples/java/vectorsdb/create-document.md new file mode 100644 index 00000000..dad4bd7f --- /dev/null +++ b/docs/examples/java/vectorsdb/create-document.md @@ -0,0 +1,35 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.Permission; +import io.appwrite.Role; +import io.appwrite.services.VectorsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +VectorsDB vectorsDB = new VectorsDB(client); + +vectorsDB.createDocument( + "", // databaseId + "", // collectionId + "", // documentId + Map.of( + "embeddings", List.of(0.12, -0.55, 0.88, 1.02), + "metadata", Map.of( + "key", "value" + ) + ), // data + List.of(Permission.read(Role.any())), // permissions (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/vectorsdb/create-operations.md b/docs/examples/java/vectorsdb/create-operations.md new file mode 100644 index 00000000..acc51c84 --- /dev/null +++ b/docs/examples/java/vectorsdb/create-operations.md @@ -0,0 +1,33 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.VectorsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +VectorsDB vectorsDB = new VectorsDB(client); + +vectorsDB.createOperations( + "", // transactionId + List.of(Map.of( + "action", "create", + "databaseId", "", + "collectionId", "", + "documentId", "", + "data", Map.of( + "name", "Walter O'Brien" + ) + )), // operations (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/vectorsdb/create-transaction.md b/docs/examples/java/vectorsdb/create-transaction.md new file mode 100644 index 00000000..ffc21917 --- /dev/null +++ b/docs/examples/java/vectorsdb/create-transaction.md @@ -0,0 +1,24 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.VectorsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +VectorsDB vectorsDB = new VectorsDB(client); + +vectorsDB.createTransaction( + 60, // ttl (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/vectorsdb/delete-document.md b/docs/examples/java/vectorsdb/delete-document.md new file mode 100644 index 00000000..6df52e88 --- /dev/null +++ b/docs/examples/java/vectorsdb/delete-document.md @@ -0,0 +1,27 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.VectorsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +VectorsDB vectorsDB = new VectorsDB(client); + +vectorsDB.deleteDocument( + "", // databaseId + "", // collectionId + "", // documentId + "", // transactionId (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/vectorsdb/delete-transaction.md b/docs/examples/java/vectorsdb/delete-transaction.md new file mode 100644 index 00000000..aef0ee27 --- /dev/null +++ b/docs/examples/java/vectorsdb/delete-transaction.md @@ -0,0 +1,24 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.VectorsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +VectorsDB vectorsDB = new VectorsDB(client); + +vectorsDB.deleteTransaction( + "", // transactionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/vectorsdb/get-document.md b/docs/examples/java/vectorsdb/get-document.md new file mode 100644 index 00000000..b9a00b17 --- /dev/null +++ b/docs/examples/java/vectorsdb/get-document.md @@ -0,0 +1,28 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.VectorsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +VectorsDB vectorsDB = new VectorsDB(client); + +vectorsDB.getDocument( + "", // databaseId + "", // collectionId + "", // documentId + List.of(), // queries (optional) + "", // transactionId (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/vectorsdb/get-transaction.md b/docs/examples/java/vectorsdb/get-transaction.md new file mode 100644 index 00000000..13e6dca4 --- /dev/null +++ b/docs/examples/java/vectorsdb/get-transaction.md @@ -0,0 +1,24 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.VectorsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +VectorsDB vectorsDB = new VectorsDB(client); + +vectorsDB.getTransaction( + "", // transactionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/vectorsdb/list-documents.md b/docs/examples/java/vectorsdb/list-documents.md new file mode 100644 index 00000000..183704c8 --- /dev/null +++ b/docs/examples/java/vectorsdb/list-documents.md @@ -0,0 +1,29 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.VectorsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +VectorsDB vectorsDB = new VectorsDB(client); + +vectorsDB.listDocuments( + "", // databaseId + "", // collectionId + List.of(), // queries (optional) + "", // transactionId (optional) + false, // total (optional) + 0, // ttl (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/vectorsdb/list-transactions.md b/docs/examples/java/vectorsdb/list-transactions.md new file mode 100644 index 00000000..19d9cbaf --- /dev/null +++ b/docs/examples/java/vectorsdb/list-transactions.md @@ -0,0 +1,24 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.VectorsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +VectorsDB vectorsDB = new VectorsDB(client); + +vectorsDB.listTransactions( + List.of(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/vectorsdb/update-document.md b/docs/examples/java/vectorsdb/update-document.md new file mode 100644 index 00000000..1ed8b639 --- /dev/null +++ b/docs/examples/java/vectorsdb/update-document.md @@ -0,0 +1,31 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.Permission; +import io.appwrite.Role; +import io.appwrite.services.VectorsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +VectorsDB vectorsDB = new VectorsDB(client); + +vectorsDB.updateDocument( + "", // databaseId + "", // collectionId + "", // documentId + Map.of("a", "b"), // data (optional) + List.of(Permission.read(Role.any())), // permissions (optional) + "", // transactionId (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/vectorsdb/update-transaction.md b/docs/examples/java/vectorsdb/update-transaction.md new file mode 100644 index 00000000..6bea2a97 --- /dev/null +++ b/docs/examples/java/vectorsdb/update-transaction.md @@ -0,0 +1,26 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.VectorsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +VectorsDB vectorsDB = new VectorsDB(client); + +vectorsDB.updateTransaction( + "", // transactionId + false, // commit (optional) + false, // rollback (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/java/vectorsdb/upsert-document.md b/docs/examples/java/vectorsdb/upsert-document.md new file mode 100644 index 00000000..199b0891 --- /dev/null +++ b/docs/examples/java/vectorsdb/upsert-document.md @@ -0,0 +1,31 @@ +```java +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.Permission; +import io.appwrite.Role; +import io.appwrite.services.VectorsDB; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +VectorsDB vectorsDB = new VectorsDB(client); + +vectorsDB.upsertDocument( + "", // databaseId + "", // collectionId + "", // documentId + Map.of("a", "b"), // data (optional) + List.of(Permission.read(Role.any())), // permissions (optional) + "", // transactionId (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + +``` diff --git a/docs/examples/kotlin/databases/upsert-documents.md b/docs/examples/kotlin/databases/upsert-documents.md new file mode 100644 index 00000000..ac256884 --- /dev/null +++ b/docs/examples/kotlin/databases/upsert-documents.md @@ -0,0 +1,18 @@ +```kotlin +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 + .setProject("") // Your project ID + +val databases = Databases(client) + +val result = databases.upsertDocuments( + databaseId = "", + collectionId = "", + documents = listOf(), + transactionId = "", // (optional) +) +``` diff --git a/docs/examples/kotlin/documentsdb/create-document.md b/docs/examples/kotlin/documentsdb/create-document.md new file mode 100644 index 00000000..270dd1bf --- /dev/null +++ b/docs/examples/kotlin/documentsdb/create-document.md @@ -0,0 +1,27 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.DocumentsDB +import io.appwrite.Permission +import io.appwrite.Role + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val documentsDB = DocumentsDB(client) + +val result = documentsDB.createDocument( + databaseId = "", + collectionId = "", + documentId = "", + data = mapOf( + "username" to "walter.obrien", + "email" to "walter.obrien@example.com", + "fullName" to "Walter O'Brien", + "age" to 30, + "isAdmin" to false + ), + permissions = listOf(Permission.read(Role.any())), // (optional) +) +``` diff --git a/docs/examples/kotlin/documentsdb/create-documents.md b/docs/examples/kotlin/documentsdb/create-documents.md new file mode 100644 index 00000000..8f4d7c46 --- /dev/null +++ b/docs/examples/kotlin/documentsdb/create-documents.md @@ -0,0 +1,17 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.DocumentsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val documentsDB = DocumentsDB(client) + +val result = documentsDB.createDocuments( + databaseId = "", + collectionId = "", + documents = listOf(), +) +``` diff --git a/docs/examples/kotlin/documentsdb/create-operations.md b/docs/examples/kotlin/documentsdb/create-operations.md new file mode 100644 index 00000000..c6258095 --- /dev/null +++ b/docs/examples/kotlin/documentsdb/create-operations.md @@ -0,0 +1,24 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.DocumentsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val documentsDB = DocumentsDB(client) + +val result = documentsDB.createOperations( + transactionId = "", + operations = listOf(mapOf( + "action" to "create", + "databaseId" to "", + "collectionId" to "", + "documentId" to "", + "data" to mapOf( + "name" to "Walter O'Brien" + ) + )), // (optional) +) +``` diff --git a/docs/examples/kotlin/documentsdb/create-transaction.md b/docs/examples/kotlin/documentsdb/create-transaction.md new file mode 100644 index 00000000..ad1f0b21 --- /dev/null +++ b/docs/examples/kotlin/documentsdb/create-transaction.md @@ -0,0 +1,15 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.DocumentsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val documentsDB = DocumentsDB(client) + +val result = documentsDB.createTransaction( + ttl = 60, // (optional) +) +``` diff --git a/docs/examples/kotlin/documentsdb/decrement-document-attribute.md b/docs/examples/kotlin/documentsdb/decrement-document-attribute.md new file mode 100644 index 00000000..50a17fb6 --- /dev/null +++ b/docs/examples/kotlin/documentsdb/decrement-document-attribute.md @@ -0,0 +1,21 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.DocumentsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val documentsDB = DocumentsDB(client) + +val result = documentsDB.decrementDocumentAttribute( + databaseId = "", + collectionId = "", + documentId = "", + attribute = "", + value = 0, // (optional) + min = 0, // (optional) + transactionId = "", // (optional) +) +``` diff --git a/docs/examples/kotlin/documentsdb/delete-document.md b/docs/examples/kotlin/documentsdb/delete-document.md new file mode 100644 index 00000000..648a83ca --- /dev/null +++ b/docs/examples/kotlin/documentsdb/delete-document.md @@ -0,0 +1,18 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.DocumentsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val documentsDB = DocumentsDB(client) + +val result = documentsDB.deleteDocument( + databaseId = "", + collectionId = "", + documentId = "", + transactionId = "", // (optional) +) +``` diff --git a/docs/examples/kotlin/documentsdb/delete-transaction.md b/docs/examples/kotlin/documentsdb/delete-transaction.md new file mode 100644 index 00000000..d991466f --- /dev/null +++ b/docs/examples/kotlin/documentsdb/delete-transaction.md @@ -0,0 +1,15 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.DocumentsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val documentsDB = DocumentsDB(client) + +val result = documentsDB.deleteTransaction( + transactionId = "", +) +``` diff --git a/docs/examples/kotlin/documentsdb/get-document.md b/docs/examples/kotlin/documentsdb/get-document.md new file mode 100644 index 00000000..1988e002 --- /dev/null +++ b/docs/examples/kotlin/documentsdb/get-document.md @@ -0,0 +1,19 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.DocumentsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val documentsDB = DocumentsDB(client) + +val result = documentsDB.getDocument( + databaseId = "", + collectionId = "", + documentId = "", + queries = listOf(), // (optional) + transactionId = "", // (optional) +) +``` diff --git a/docs/examples/kotlin/documentsdb/get-transaction.md b/docs/examples/kotlin/documentsdb/get-transaction.md new file mode 100644 index 00000000..695412e7 --- /dev/null +++ b/docs/examples/kotlin/documentsdb/get-transaction.md @@ -0,0 +1,15 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.DocumentsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val documentsDB = DocumentsDB(client) + +val result = documentsDB.getTransaction( + transactionId = "", +) +``` diff --git a/docs/examples/kotlin/documentsdb/increment-document-attribute.md b/docs/examples/kotlin/documentsdb/increment-document-attribute.md new file mode 100644 index 00000000..3267a0d2 --- /dev/null +++ b/docs/examples/kotlin/documentsdb/increment-document-attribute.md @@ -0,0 +1,21 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.DocumentsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val documentsDB = DocumentsDB(client) + +val result = documentsDB.incrementDocumentAttribute( + databaseId = "", + collectionId = "", + documentId = "", + attribute = "", + value = 0, // (optional) + max = 0, // (optional) + transactionId = "", // (optional) +) +``` diff --git a/docs/examples/kotlin/documentsdb/list-documents.md b/docs/examples/kotlin/documentsdb/list-documents.md new file mode 100644 index 00000000..a8c1b66b --- /dev/null +++ b/docs/examples/kotlin/documentsdb/list-documents.md @@ -0,0 +1,20 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.DocumentsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val documentsDB = DocumentsDB(client) + +val result = documentsDB.listDocuments( + databaseId = "", + collectionId = "", + queries = listOf(), // (optional) + transactionId = "", // (optional) + total = false, // (optional) + ttl = 0, // (optional) +) +``` diff --git a/docs/examples/kotlin/documentsdb/list-transactions.md b/docs/examples/kotlin/documentsdb/list-transactions.md new file mode 100644 index 00000000..46571468 --- /dev/null +++ b/docs/examples/kotlin/documentsdb/list-transactions.md @@ -0,0 +1,15 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.DocumentsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val documentsDB = DocumentsDB(client) + +val result = documentsDB.listTransactions( + queries = listOf(), // (optional) +) +``` diff --git a/docs/examples/kotlin/documentsdb/update-document.md b/docs/examples/kotlin/documentsdb/update-document.md new file mode 100644 index 00000000..69668863 --- /dev/null +++ b/docs/examples/kotlin/documentsdb/update-document.md @@ -0,0 +1,22 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.DocumentsDB +import io.appwrite.Permission +import io.appwrite.Role + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val documentsDB = DocumentsDB(client) + +val result = documentsDB.updateDocument( + databaseId = "", + collectionId = "", + documentId = "", + data = mapOf( "a" to "b" ), // (optional) + permissions = listOf(Permission.read(Role.any())), // (optional) + transactionId = "", // (optional) +) +``` diff --git a/docs/examples/kotlin/documentsdb/update-transaction.md b/docs/examples/kotlin/documentsdb/update-transaction.md new file mode 100644 index 00000000..78fb3e7b --- /dev/null +++ b/docs/examples/kotlin/documentsdb/update-transaction.md @@ -0,0 +1,17 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.DocumentsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val documentsDB = DocumentsDB(client) + +val result = documentsDB.updateTransaction( + transactionId = "", + commit = false, // (optional) + rollback = false, // (optional) +) +``` diff --git a/docs/examples/kotlin/documentsdb/upsert-document.md b/docs/examples/kotlin/documentsdb/upsert-document.md new file mode 100644 index 00000000..defc50a2 --- /dev/null +++ b/docs/examples/kotlin/documentsdb/upsert-document.md @@ -0,0 +1,22 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.DocumentsDB +import io.appwrite.Permission +import io.appwrite.Role + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val documentsDB = DocumentsDB(client) + +val result = documentsDB.upsertDocument( + databaseId = "", + collectionId = "", + documentId = "", + data = mapOf( "a" to "b" ), // (optional) + permissions = listOf(Permission.read(Role.any())), // (optional) + transactionId = "", // (optional) +) +``` diff --git a/docs/examples/kotlin/vectorsdb/create-document.md b/docs/examples/kotlin/vectorsdb/create-document.md new file mode 100644 index 00000000..57221ffc --- /dev/null +++ b/docs/examples/kotlin/vectorsdb/create-document.md @@ -0,0 +1,26 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.VectorsDB +import io.appwrite.Permission +import io.appwrite.Role + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val vectorsDB = VectorsDB(client) + +val result = vectorsDB.createDocument( + databaseId = "", + collectionId = "", + documentId = "", + data = mapOf( + "embeddings" to listOf(0.12, -0.55, 0.88, 1.02), + "metadata" to mapOf( + "key" to "value" + ) + ), + permissions = listOf(Permission.read(Role.any())), // (optional) +) +``` diff --git a/docs/examples/kotlin/vectorsdb/create-operations.md b/docs/examples/kotlin/vectorsdb/create-operations.md new file mode 100644 index 00000000..1a2908af --- /dev/null +++ b/docs/examples/kotlin/vectorsdb/create-operations.md @@ -0,0 +1,24 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.VectorsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val vectorsDB = VectorsDB(client) + +val result = vectorsDB.createOperations( + transactionId = "", + operations = listOf(mapOf( + "action" to "create", + "databaseId" to "", + "collectionId" to "", + "documentId" to "", + "data" to mapOf( + "name" to "Walter O'Brien" + ) + )), // (optional) +) +``` diff --git a/docs/examples/kotlin/vectorsdb/create-transaction.md b/docs/examples/kotlin/vectorsdb/create-transaction.md new file mode 100644 index 00000000..9ca3de5c --- /dev/null +++ b/docs/examples/kotlin/vectorsdb/create-transaction.md @@ -0,0 +1,15 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.VectorsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val vectorsDB = VectorsDB(client) + +val result = vectorsDB.createTransaction( + ttl = 60, // (optional) +) +``` diff --git a/docs/examples/kotlin/vectorsdb/delete-document.md b/docs/examples/kotlin/vectorsdb/delete-document.md new file mode 100644 index 00000000..9cc1856f --- /dev/null +++ b/docs/examples/kotlin/vectorsdb/delete-document.md @@ -0,0 +1,18 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.VectorsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val vectorsDB = VectorsDB(client) + +val result = vectorsDB.deleteDocument( + databaseId = "", + collectionId = "", + documentId = "", + transactionId = "", // (optional) +) +``` diff --git a/docs/examples/kotlin/vectorsdb/delete-transaction.md b/docs/examples/kotlin/vectorsdb/delete-transaction.md new file mode 100644 index 00000000..e97ab53a --- /dev/null +++ b/docs/examples/kotlin/vectorsdb/delete-transaction.md @@ -0,0 +1,15 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.VectorsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val vectorsDB = VectorsDB(client) + +val result = vectorsDB.deleteTransaction( + transactionId = "", +) +``` diff --git a/docs/examples/kotlin/vectorsdb/get-document.md b/docs/examples/kotlin/vectorsdb/get-document.md new file mode 100644 index 00000000..22584ab1 --- /dev/null +++ b/docs/examples/kotlin/vectorsdb/get-document.md @@ -0,0 +1,19 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.VectorsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val vectorsDB = VectorsDB(client) + +val result = vectorsDB.getDocument( + databaseId = "", + collectionId = "", + documentId = "", + queries = listOf(), // (optional) + transactionId = "", // (optional) +) +``` diff --git a/docs/examples/kotlin/vectorsdb/get-transaction.md b/docs/examples/kotlin/vectorsdb/get-transaction.md new file mode 100644 index 00000000..2a510ea8 --- /dev/null +++ b/docs/examples/kotlin/vectorsdb/get-transaction.md @@ -0,0 +1,15 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.VectorsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val vectorsDB = VectorsDB(client) + +val result = vectorsDB.getTransaction( + transactionId = "", +) +``` diff --git a/docs/examples/kotlin/vectorsdb/list-documents.md b/docs/examples/kotlin/vectorsdb/list-documents.md new file mode 100644 index 00000000..90a7f04a --- /dev/null +++ b/docs/examples/kotlin/vectorsdb/list-documents.md @@ -0,0 +1,20 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.VectorsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val vectorsDB = VectorsDB(client) + +val result = vectorsDB.listDocuments( + databaseId = "", + collectionId = "", + queries = listOf(), // (optional) + transactionId = "", // (optional) + total = false, // (optional) + ttl = 0, // (optional) +) +``` diff --git a/docs/examples/kotlin/vectorsdb/list-transactions.md b/docs/examples/kotlin/vectorsdb/list-transactions.md new file mode 100644 index 00000000..97981c01 --- /dev/null +++ b/docs/examples/kotlin/vectorsdb/list-transactions.md @@ -0,0 +1,15 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.VectorsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val vectorsDB = VectorsDB(client) + +val result = vectorsDB.listTransactions( + queries = listOf(), // (optional) +) +``` diff --git a/docs/examples/kotlin/vectorsdb/update-document.md b/docs/examples/kotlin/vectorsdb/update-document.md new file mode 100644 index 00000000..13422596 --- /dev/null +++ b/docs/examples/kotlin/vectorsdb/update-document.md @@ -0,0 +1,22 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.VectorsDB +import io.appwrite.Permission +import io.appwrite.Role + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val vectorsDB = VectorsDB(client) + +val result = vectorsDB.updateDocument( + databaseId = "", + collectionId = "", + documentId = "", + data = mapOf( "a" to "b" ), // (optional) + permissions = listOf(Permission.read(Role.any())), // (optional) + transactionId = "", // (optional) +) +``` diff --git a/docs/examples/kotlin/vectorsdb/update-transaction.md b/docs/examples/kotlin/vectorsdb/update-transaction.md new file mode 100644 index 00000000..c49da348 --- /dev/null +++ b/docs/examples/kotlin/vectorsdb/update-transaction.md @@ -0,0 +1,17 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.VectorsDB + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val vectorsDB = VectorsDB(client) + +val result = vectorsDB.updateTransaction( + transactionId = "", + commit = false, // (optional) + rollback = false, // (optional) +) +``` diff --git a/docs/examples/kotlin/vectorsdb/upsert-document.md b/docs/examples/kotlin/vectorsdb/upsert-document.md new file mode 100644 index 00000000..111b61c6 --- /dev/null +++ b/docs/examples/kotlin/vectorsdb/upsert-document.md @@ -0,0 +1,22 @@ +```kotlin +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.VectorsDB +import io.appwrite.Permission +import io.appwrite.Role + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val vectorsDB = VectorsDB(client) + +val result = vectorsDB.upsertDocument( + databaseId = "", + collectionId = "", + documentId = "", + data = mapOf( "a" to "b" ), // (optional) + permissions = listOf(Permission.read(Role.any())), // (optional) + transactionId = "", // (optional) +) +``` diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt index 79bf1a28..67e7dd83 100644 --- a/library/src/main/java/io/appwrite/Client.kt +++ b/library/src/main/java/io/appwrite/Client.kt @@ -87,8 +87,8 @@ class Client @JvmOverloads constructor( "x-sdk-name" to "Android", "x-sdk-platform" to "client", "x-sdk-language" to "android", - "x-sdk-version" to "13.0.0", - "x-appwrite-response-format" to "1.8.0" + "x-sdk-version" to "12.1.1", + "x-appwrite-response-format" to "1.9.0" ) config = mutableMapOf() @@ -168,6 +168,51 @@ class Client @JvmOverloads constructor( return this } + /** + * Set ImpersonateUserId + * + * Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + * + * @param {string} impersonateuserid + * + * @return this + */ + fun setImpersonateUserId(value: String): Client { + config["impersonateUserId"] = value + addHeader("x-appwrite-impersonate-user-id", value) + return this + } + + /** + * Set ImpersonateUserEmail + * + * Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + * + * @param {string} impersonateuseremail + * + * @return this + */ + fun setImpersonateUserEmail(value: String): Client { + config["impersonateUserEmail"] = value + addHeader("x-appwrite-impersonate-user-email", value) + return this + } + + /** + * Set ImpersonateUserPhone + * + * Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + * + * @param {string} impersonateuserphone + * + * @return this + */ + fun setImpersonateUserPhone(value: String): Client { + config["impersonateUserPhone"] = value + addHeader("x-appwrite-impersonate-user-phone", value) + return this + } + /** * Set self Signed * diff --git a/library/src/main/java/io/appwrite/models/Document.kt b/library/src/main/java/io/appwrite/models/Document.kt index 830fe384..c55e6d26 100644 --- a/library/src/main/java/io/appwrite/models/Document.kt +++ b/library/src/main/java/io/appwrite/models/Document.kt @@ -17,7 +17,7 @@ data class Document( * Document sequence ID. */ @SerializedName("\$sequence") - val sequence: Long, + val sequence: String, /** * Collection ID. @@ -69,7 +69,7 @@ data class Document( companion object { operator fun invoke( id: String, - sequence: Long, + sequence: String, collectionId: String, databaseId: String, createdAt: String, @@ -93,7 +93,7 @@ data class Document( nestedType: Class ) = Document( id = map["\$id"] as String, - sequence = (map["\$sequence"] as Number).toLong(), + sequence = map["\$sequence"] as String, collectionId = map["\$collectionId"] as String, databaseId = map["\$databaseId"] as String, createdAt = map["\$createdAt"] as String, diff --git a/library/src/main/java/io/appwrite/models/Log.kt b/library/src/main/java/io/appwrite/models/Log.kt index c2df960f..fe8c60b3 100644 --- a/library/src/main/java/io/appwrite/models/Log.kt +++ b/library/src/main/java/io/appwrite/models/Log.kt @@ -14,19 +14,19 @@ data class Log( val event: String, /** - * User ID. + * User ID of the actor recorded for this log. During impersonation, this is the original impersonator, not the impersonated target user. */ @SerializedName("userId") val userId: String, /** - * User Email. + * User email of the actor recorded for this log. During impersonation, this is the original impersonator. */ @SerializedName("userEmail") val userEmail: String, /** - * User Name. + * User name of the actor recorded for this log. During impersonation, this is the original impersonator. */ @SerializedName("userName") val userName: String, diff --git a/library/src/main/java/io/appwrite/models/Row.kt b/library/src/main/java/io/appwrite/models/Row.kt index 793d2782..488ec7bc 100644 --- a/library/src/main/java/io/appwrite/models/Row.kt +++ b/library/src/main/java/io/appwrite/models/Row.kt @@ -17,7 +17,7 @@ data class Row( * Row sequence ID. */ @SerializedName("\$sequence") - val sequence: Long, + val sequence: String, /** * Table ID. @@ -69,7 +69,7 @@ data class Row( companion object { operator fun invoke( id: String, - sequence: Long, + sequence: String, tableId: String, databaseId: String, createdAt: String, @@ -93,7 +93,7 @@ data class Row( nestedType: Class ) = Row( id = map["\$id"] as String, - sequence = (map["\$sequence"] as Number).toLong(), + sequence = map["\$sequence"] as String, tableId = map["\$tableId"] as String, databaseId = map["\$databaseId"] as String, createdAt = map["\$createdAt"] as String, diff --git a/library/src/main/java/io/appwrite/models/User.kt b/library/src/main/java/io/appwrite/models/User.kt index e9a11443..a76d61f0 100644 --- a/library/src/main/java/io/appwrite/models/User.kt +++ b/library/src/main/java/io/appwrite/models/User.kt @@ -121,6 +121,18 @@ data class User( @SerializedName("accessedAt") val accessedAt: String, + /** + * Whether the user can impersonate other users. + */ + @SerializedName("impersonator") + var impersonator: Boolean?, + + /** + * ID of the original actor performing the impersonation. Present only when the current request is impersonating another user. Internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data. + */ + @SerializedName("impersonatorUserId") + var impersonatorUserId: String?, + ) { fun toMap(): Map = mapOf( "\$id" to id as Any, @@ -142,6 +154,8 @@ data class User( "prefs" to prefs.toMap() as Any, "targets" to targets.map { it.toMap() } as Any, "accessedAt" to accessedAt as Any, + "impersonator" to impersonator as Any, + "impersonatorUserId" to impersonatorUserId as Any, ) companion object { @@ -165,6 +179,8 @@ data class User( prefs: Preferences>, targets: List, accessedAt: String, + impersonator: Boolean?, + impersonatorUserId: String?, ) = User>( id, createdAt, @@ -185,6 +201,8 @@ data class User( prefs, targets, accessedAt, + impersonator, + impersonatorUserId, ) @Suppress("UNCHECKED_CAST") @@ -211,6 +229,8 @@ data class User( prefs = Preferences.from(map = map["prefs"] as Map, nestedType), targets = (map["targets"] as List>).map { Target.from(map = it) }, accessedAt = map["accessedAt"] as String, + impersonator = map["impersonator"] as? Boolean, + impersonatorUserId = map["impersonatorUserId"] as? String, ) } } \ 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 dda11375..f28fd177 100644 --- a/library/src/main/java/io/appwrite/services/Databases.kt +++ b/library/src/main/java/io/appwrite/services/Databases.kt @@ -383,6 +383,82 @@ class Databases(client: Client) : Service(client) { nestedType = classOf(), ) + /** + * 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. + * + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documents Array of document data as JSON objects. May contain partial documents. + * @param transactionId Transaction ID for staging the operation. + * @return [io.appwrite.models.DocumentList] + */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.upsertRows") + ) + @JvmOverloads + suspend fun upsertDocuments( + databaseId: String, + collectionId: String, + documents: List, + transactionId: String? = null, + 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, + "transactionId" to transactionId, + ) + 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( + "PUT", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * 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. + * + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documents Array of document data as JSON objects. May contain partial documents. + * @param transactionId Transaction ID for staging the operation. + * @return [io.appwrite.models.DocumentList] + */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.upsertRows") + ) + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun upsertDocuments( + databaseId: String, + collectionId: String, + documents: List, + transactionId: String? = null, + ): io.appwrite.models.DocumentList> = upsertDocuments( + databaseId, + collectionId, + documents, + transactionId, + nestedType = classOf(), + ) + /** * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. * diff --git a/library/src/main/java/io/appwrite/services/DocumentsDB.kt b/library/src/main/java/io/appwrite/services/DocumentsDB.kt new file mode 100644 index 00000000..1523ffb9 --- /dev/null +++ b/library/src/main/java/io/appwrite/services/DocumentsDB.kt @@ -0,0 +1,854 @@ +package io.appwrite.services + +import android.net.Uri +import io.appwrite.Client +import io.appwrite.Service +import io.appwrite.models.* +import io.appwrite.exceptions.AppwriteException +import io.appwrite.extensions.classOf +import okhttp3.Cookie +import java.io.File + +/** + * + */ +class DocumentsDB(client: Client) : Service(client) { + + /** + * + * + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). + * @return [io.appwrite.models.TransactionList] + */ + @JvmOverloads + suspend fun listTransactions( + queries: List? = null, + ): io.appwrite.models.TransactionList { + val apiPath = "/documentsdb/transactions" + + val apiParams = mutableMapOf( + "queries" to queries, + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.TransactionList = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.TransactionList.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.TransactionList::class.java, + converter, + ) + } + + + /** + * + * + * @param ttl Seconds before the transaction expires. + * @return [io.appwrite.models.Transaction] + */ + @JvmOverloads + suspend fun createTransaction( + ttl: Long? = null, + ): io.appwrite.models.Transaction { + val apiPath = "/documentsdb/transactions" + + val apiParams = mutableMapOf( + "ttl" to ttl, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Transaction = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Transaction.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Transaction::class.java, + converter, + ) + } + + + /** + * + * + * @param transactionId Transaction ID. + * @return [io.appwrite.models.Transaction] + */ + suspend fun getTransaction( + transactionId: String, + ): io.appwrite.models.Transaction { + val apiPath = "/documentsdb/transactions/{transactionId}" + .replace("{transactionId}", transactionId) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.Transaction = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Transaction.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Transaction::class.java, + converter, + ) + } + + + /** + * + * + * @param transactionId Transaction ID. + * @param commit Commit transaction? + * @param rollback Rollback transaction? + * @return [io.appwrite.models.Transaction] + */ + @JvmOverloads + suspend fun updateTransaction( + transactionId: String, + commit: Boolean? = null, + rollback: Boolean? = null, + ): io.appwrite.models.Transaction { + val apiPath = "/documentsdb/transactions/{transactionId}" + .replace("{transactionId}", transactionId) + + val apiParams = mutableMapOf( + "commit" to commit, + "rollback" to rollback, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Transaction = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Transaction.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Transaction::class.java, + converter, + ) + } + + + /** + * + * + * @param transactionId Transaction ID. + * @return [Any] + */ + suspend fun deleteTransaction( + transactionId: String, + ): Any { + val apiPath = "/documentsdb/transactions/{transactionId}" + .replace("{transactionId}", transactionId) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + + + /** + * + * + * @param transactionId Transaction ID. + * @param operations Array of staged operations. + * @return [io.appwrite.models.Transaction] + */ + @JvmOverloads + suspend fun createOperations( + transactionId: String, + operations: List? = null, + ): io.appwrite.models.Transaction { + val apiPath = "/documentsdb/transactions/{transactionId}/operations" + .replace("{transactionId}", transactionId) + + val apiParams = mutableMapOf( + "operations" to operations, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Transaction = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Transaction.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Transaction::class.java, + converter, + ) + } + + + /** + * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + * + * @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). + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param transactionId Transaction ID to read uncommitted changes within the transaction. + * @param total When set to false, the total count returned will be 0 and will not be calculated. + * @param ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + * @return [io.appwrite.models.DocumentList] + */ + @JvmOverloads + suspend fun listDocuments( + databaseId: String, + collectionId: String, + queries: List? = null, + transactionId: String? = null, + total: Boolean? = null, + ttl: Long? = null, + nestedType: Class, + ): io.appwrite.models.DocumentList { + val apiPath = "/documentsdb/{databaseId}/collections/{collectionId}/documents" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + + val apiParams = mutableMapOf( + "queries" to queries, + "transactionId" to transactionId, + "total" to total, + "ttl" to ttl, + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.DocumentList = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.DocumentList.from(map = it as Map, nestedType) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + * + * @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). + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param transactionId Transaction ID to read uncommitted changes within the transaction. + * @param total When set to false, the total count returned will be 0 and will not be calculated. + * @param ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + * @return [io.appwrite.models.DocumentList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun listDocuments( + databaseId: String, + collectionId: String, + queries: List? = null, + transactionId: String? = null, + total: Boolean? = null, + ttl: Long? = null, + ): io.appwrite.models.DocumentList> = listDocuments( + databaseId, + collectionId, + queries, + transactionId, + total, + ttl, + nestedType = classOf(), + ) + + /** + * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) 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 documentId Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param data Document data as JSON object. + * @param permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + suspend fun createDocument( + databaseId: String, + collectionId: String, + documentId: String, + data: Any, + permissions: List? = null, + nestedType: Class, + ): io.appwrite.models.Document { + val apiPath = "/documentsdb/{databaseId}/collections/{collectionId}/documents" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + + val apiParams = mutableMapOf( + "documentId" to documentId, + "data" to data, + "permissions" to permissions, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Document = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Document.from(map = it as Map, nestedType) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) 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 documentId Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param data Document data as JSON object. + * @param permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createDocument( + databaseId: String, + collectionId: String, + documentId: String, + data: Any, + permissions: List? = null, + ): io.appwrite.models.Document> = createDocument( + databaseId, + collectionId, + documentId, + data, + permissions, + 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#documentsDBCreateCollection) 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 = "/documentsdb/{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#documentsDBCreateCollection) 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. + * + * @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). + * @param documentId Document ID. + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param transactionId Transaction ID to read uncommitted changes within the transaction. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + suspend fun getDocument( + databaseId: String, + collectionId: String, + documentId: String, + queries: List? = null, + transactionId: String? = null, + nestedType: Class, + ): io.appwrite.models.Document { + val apiPath = "/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + .replace("{documentId}", documentId) + + val apiParams = mutableMapOf( + "queries" to queries, + "transactionId" to transactionId, + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.Document = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Document.from(map = it as Map, nestedType) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. + * + * @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). + * @param documentId Document ID. + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param transactionId Transaction ID to read uncommitted changes within the transaction. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun getDocument( + databaseId: String, + collectionId: String, + documentId: String, + queries: List? = null, + transactionId: String? = null, + ): io.appwrite.models.Document> = getDocument( + databaseId, + collectionId, + documentId, + queries, + transactionId, + nestedType = classOf(), + ) + + /** + * 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#documentsDBCreateCollection) API or directly from your database console. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param data Document data as JSON object. Include all required fields of the document to be created or updated. + * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param transactionId Transaction ID for staging the operation. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + suspend fun upsertDocument( + databaseId: String, + collectionId: String, + documentId: String, + data: Any? = null, + permissions: List? = null, + transactionId: String? = null, + nestedType: Class, + ): io.appwrite.models.Document { + val apiPath = "/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + .replace("{documentId}", documentId) + + val apiParams = mutableMapOf( + "data" to data, + "permissions" to permissions, + "transactionId" to transactionId, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Document = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Document.from(map = it as Map, nestedType) + } + return client.call( + "PUT", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * 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#documentsDBCreateCollection) API or directly from your database console. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param data Document data as JSON object. Include all required fields of the document to be created or updated. + * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param transactionId Transaction ID for staging the operation. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun upsertDocument( + databaseId: String, + collectionId: String, + documentId: String, + data: Any? = null, + permissions: List? = null, + transactionId: String? = null, + ): io.appwrite.models.Document> = upsertDocument( + databaseId, + collectionId, + documentId, + data, + permissions, + transactionId, + nestedType = classOf(), + ) + + /** + * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param data Document data as JSON object. Include only fields and value pairs to be updated. + * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param transactionId Transaction ID for staging the operation. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + suspend fun updateDocument( + databaseId: String, + collectionId: String, + documentId: String, + data: Any? = null, + permissions: List? = null, + transactionId: String? = null, + nestedType: Class, + ): io.appwrite.models.Document { + val apiPath = "/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + .replace("{documentId}", documentId) + + val apiParams = mutableMapOf( + "data" to data, + "permissions" to permissions, + "transactionId" to transactionId, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Document = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Document.from(map = it as Map, nestedType) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param data Document data as JSON object. Include only fields and value pairs to be updated. + * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param transactionId Transaction ID for staging the operation. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateDocument( + databaseId: String, + collectionId: String, + documentId: String, + data: Any? = null, + permissions: List? = null, + transactionId: String? = null, + ): io.appwrite.models.Document> = updateDocument( + databaseId, + collectionId, + documentId, + data, + permissions, + transactionId, + nestedType = classOf(), + ) + + /** + * Delete a document by its unique ID. + * + * @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). + * @param documentId Document ID. + * @param transactionId Transaction ID for staging the operation. + * @return [Any] + */ + @JvmOverloads + suspend fun deleteDocument( + databaseId: String, + collectionId: String, + documentId: String, + transactionId: String? = null, + ): Any { + val apiPath = "/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + .replace("{documentId}", documentId) + + val apiParams = mutableMapOf( + "transactionId" to transactionId, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + + + /** + * Decrement a specific column of a row by a given value. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param attribute Attribute key. + * @param value Value to decrement the attribute by. The value must be a number. + * @param min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. + * @param transactionId Transaction ID for staging the operation. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + suspend fun decrementDocumentAttribute( + databaseId: String, + collectionId: String, + documentId: String, + attribute: String, + value: Double? = null, + min: Double? = null, + transactionId: String? = null, + nestedType: Class, + ): io.appwrite.models.Document { + val apiPath = "/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + .replace("{documentId}", documentId) + .replace("{attribute}", attribute) + + val apiParams = mutableMapOf( + "value" to value, + "min" to min, + "transactionId" to transactionId, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Document = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Document.from(map = it as Map, nestedType) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Decrement a specific column of a row by a given value. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param attribute Attribute key. + * @param value Value to decrement the attribute by. The value must be a number. + * @param min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. + * @param transactionId Transaction ID for staging the operation. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun decrementDocumentAttribute( + databaseId: String, + collectionId: String, + documentId: String, + attribute: String, + value: Double? = null, + min: Double? = null, + transactionId: String? = null, + ): io.appwrite.models.Document> = decrementDocumentAttribute( + databaseId, + collectionId, + documentId, + attribute, + value, + min, + transactionId, + nestedType = classOf(), + ) + + /** + * Increment a specific column of a row by a given value. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param attribute Attribute key. + * @param value Value to increment the attribute by. The value must be a number. + * @param max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. + * @param transactionId Transaction ID for staging the operation. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + suspend fun incrementDocumentAttribute( + databaseId: String, + collectionId: String, + documentId: String, + attribute: String, + value: Double? = null, + max: Double? = null, + transactionId: String? = null, + nestedType: Class, + ): io.appwrite.models.Document { + val apiPath = "/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + .replace("{documentId}", documentId) + .replace("{attribute}", attribute) + + val apiParams = mutableMapOf( + "value" to value, + "max" to max, + "transactionId" to transactionId, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Document = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Document.from(map = it as Map, nestedType) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Increment a specific column of a row by a given value. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param attribute Attribute key. + * @param value Value to increment the attribute by. The value must be a number. + * @param max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. + * @param transactionId Transaction ID for staging the operation. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun incrementDocumentAttribute( + databaseId: String, + collectionId: String, + documentId: String, + attribute: String, + value: Double? = null, + max: Double? = null, + transactionId: String? = null, + ): io.appwrite.models.Document> = incrementDocumentAttribute( + databaseId, + collectionId, + documentId, + attribute, + value, + max, + transactionId, + nestedType = classOf(), + ) + +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/services/VectorsDB.kt b/library/src/main/java/io/appwrite/services/VectorsDB.kt new file mode 100644 index 00000000..3bdb74be --- /dev/null +++ b/library/src/main/java/io/appwrite/services/VectorsDB.kt @@ -0,0 +1,628 @@ +package io.appwrite.services + +import android.net.Uri +import io.appwrite.Client +import io.appwrite.Service +import io.appwrite.models.* +import io.appwrite.exceptions.AppwriteException +import io.appwrite.extensions.classOf +import okhttp3.Cookie +import java.io.File + +/** + * + */ +class VectorsDB(client: Client) : Service(client) { + + /** + * + * + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). + * @return [io.appwrite.models.TransactionList] + */ + @JvmOverloads + suspend fun listTransactions( + queries: List? = null, + ): io.appwrite.models.TransactionList { + val apiPath = "/vectorsdb/transactions" + + val apiParams = mutableMapOf( + "queries" to queries, + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.TransactionList = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.TransactionList.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.TransactionList::class.java, + converter, + ) + } + + + /** + * + * + * @param ttl Seconds before the transaction expires. + * @return [io.appwrite.models.Transaction] + */ + @JvmOverloads + suspend fun createTransaction( + ttl: Long? = null, + ): io.appwrite.models.Transaction { + val apiPath = "/vectorsdb/transactions" + + val apiParams = mutableMapOf( + "ttl" to ttl, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Transaction = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Transaction.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Transaction::class.java, + converter, + ) + } + + + /** + * + * + * @param transactionId Transaction ID. + * @return [io.appwrite.models.Transaction] + */ + suspend fun getTransaction( + transactionId: String, + ): io.appwrite.models.Transaction { + val apiPath = "/vectorsdb/transactions/{transactionId}" + .replace("{transactionId}", transactionId) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.Transaction = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Transaction.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Transaction::class.java, + converter, + ) + } + + + /** + * + * + * @param transactionId Transaction ID. + * @param commit Commit transaction? + * @param rollback Rollback transaction? + * @return [io.appwrite.models.Transaction] + */ + @JvmOverloads + suspend fun updateTransaction( + transactionId: String, + commit: Boolean? = null, + rollback: Boolean? = null, + ): io.appwrite.models.Transaction { + val apiPath = "/vectorsdb/transactions/{transactionId}" + .replace("{transactionId}", transactionId) + + val apiParams = mutableMapOf( + "commit" to commit, + "rollback" to rollback, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Transaction = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Transaction.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Transaction::class.java, + converter, + ) + } + + + /** + * + * + * @param transactionId Transaction ID. + * @return [Any] + */ + suspend fun deleteTransaction( + transactionId: String, + ): Any { + val apiPath = "/vectorsdb/transactions/{transactionId}" + .replace("{transactionId}", transactionId) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + + + /** + * + * + * @param transactionId Transaction ID. + * @param operations Array of staged operations. + * @return [io.appwrite.models.Transaction] + */ + @JvmOverloads + suspend fun createOperations( + transactionId: String, + operations: List? = null, + ): io.appwrite.models.Transaction { + val apiPath = "/vectorsdb/transactions/{transactionId}/operations" + .replace("{transactionId}", transactionId) + + val apiParams = mutableMapOf( + "operations" to operations, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Transaction = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Transaction.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Transaction::class.java, + converter, + ) + } + + + /** + * + * + * @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). + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param transactionId Transaction ID to read uncommitted changes within the transaction. + * @param total When set to false, the total count returned will be 0 and will not be calculated. + * @param ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + * @return [io.appwrite.models.DocumentList] + */ + @JvmOverloads + suspend fun listDocuments( + databaseId: String, + collectionId: String, + queries: List? = null, + transactionId: String? = null, + total: Boolean? = null, + ttl: Long? = null, + nestedType: Class, + ): io.appwrite.models.DocumentList { + val apiPath = "/vectorsdb/{databaseId}/collections/{collectionId}/documents" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + + val apiParams = mutableMapOf( + "queries" to queries, + "transactionId" to transactionId, + "total" to total, + "ttl" to ttl, + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.DocumentList = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.DocumentList.from(map = it as Map, nestedType) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * + * + * @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). + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param transactionId Transaction ID to read uncommitted changes within the transaction. + * @param total When set to false, the total count returned will be 0 and will not be calculated. + * @param ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + * @return [io.appwrite.models.DocumentList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun listDocuments( + databaseId: String, + collectionId: String, + queries: List? = null, + transactionId: String? = null, + total: Boolean? = null, + ttl: Long? = null, + ): io.appwrite.models.DocumentList> = listDocuments( + databaseId, + collectionId, + queries, + transactionId, + total, + ttl, + nestedType = classOf(), + ) + + /** + * + * + * @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 documentId Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param data Document data as JSON object. + * @param permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + suspend fun createDocument( + databaseId: String, + collectionId: String, + documentId: String, + data: Any, + permissions: List? = null, + nestedType: Class, + ): io.appwrite.models.Document { + val apiPath = "/vectorsdb/{databaseId}/collections/{collectionId}/documents" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + + val apiParams = mutableMapOf( + "documentId" to documentId, + "data" to data, + "permissions" to permissions, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Document = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Document.from(map = it as Map, nestedType) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * + * + * @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 documentId Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param data Document data as JSON object. + * @param permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createDocument( + databaseId: String, + collectionId: String, + documentId: String, + data: Any, + permissions: List? = null, + ): io.appwrite.models.Document> = createDocument( + databaseId, + collectionId, + documentId, + data, + permissions, + nestedType = classOf(), + ) + + /** + * + * + * @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). + * @param documentId Document ID. + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param transactionId Transaction ID to read uncommitted changes within the transaction. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + suspend fun getDocument( + databaseId: String, + collectionId: String, + documentId: String, + queries: List? = null, + transactionId: String? = null, + nestedType: Class, + ): io.appwrite.models.Document { + val apiPath = "/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + .replace("{documentId}", documentId) + + val apiParams = mutableMapOf( + "queries" to queries, + "transactionId" to transactionId, + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.Document = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Document.from(map = it as Map, nestedType) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * + * + * @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). + * @param documentId Document ID. + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param transactionId Transaction ID to read uncommitted changes within the transaction. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun getDocument( + databaseId: String, + collectionId: String, + documentId: String, + queries: List? = null, + transactionId: String? = null, + ): io.appwrite.models.Document> = getDocument( + databaseId, + collectionId, + documentId, + queries, + transactionId, + nestedType = classOf(), + ) + + /** + * + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param data Document data as JSON object. Include all required fields of the document to be created or updated. + * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param transactionId Transaction ID for staging the operation. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + suspend fun upsertDocument( + databaseId: String, + collectionId: String, + documentId: String, + data: Any? = null, + permissions: List? = null, + transactionId: String? = null, + nestedType: Class, + ): io.appwrite.models.Document { + val apiPath = "/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + .replace("{documentId}", documentId) + + val apiParams = mutableMapOf( + "data" to data, + "permissions" to permissions, + "transactionId" to transactionId, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Document = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Document.from(map = it as Map, nestedType) + } + return client.call( + "PUT", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param data Document data as JSON object. Include all required fields of the document to be created or updated. + * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param transactionId Transaction ID for staging the operation. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun upsertDocument( + databaseId: String, + collectionId: String, + documentId: String, + data: Any? = null, + permissions: List? = null, + transactionId: String? = null, + ): io.appwrite.models.Document> = upsertDocument( + databaseId, + collectionId, + documentId, + data, + permissions, + transactionId, + nestedType = classOf(), + ) + + /** + * + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param data Document data as JSON object. Include only fields and value pairs to be updated. + * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param transactionId Transaction ID for staging the operation. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + suspend fun updateDocument( + databaseId: String, + collectionId: String, + documentId: String, + data: Any? = null, + permissions: List? = null, + transactionId: String? = null, + nestedType: Class, + ): io.appwrite.models.Document { + val apiPath = "/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + .replace("{documentId}", documentId) + + val apiParams = mutableMapOf( + "data" to data, + "permissions" to permissions, + "transactionId" to transactionId, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Document = { + @Suppress("UNCHECKED_CAST") + io.appwrite.models.Document.from(map = it as Map, nestedType) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param data Document data as JSON object. Include only fields and value pairs to be updated. + * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param transactionId Transaction ID for staging the operation. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateDocument( + databaseId: String, + collectionId: String, + documentId: String, + data: Any? = null, + permissions: List? = null, + transactionId: String? = null, + ): io.appwrite.models.Document> = updateDocument( + databaseId, + collectionId, + documentId, + data, + permissions, + transactionId, + nestedType = classOf(), + ) + + /** + * + * + * @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). + * @param documentId Document ID. + * @param transactionId Transaction ID for staging the operation. + * @return [Any] + */ + @JvmOverloads + suspend fun deleteDocument( + databaseId: String, + collectionId: String, + documentId: String, + transactionId: String? = null, + ): Any { + val apiPath = "/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + .replace("{documentId}", documentId) + + val apiParams = mutableMapOf( + "transactionId" to transactionId, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + + +} \ No newline at end of file From 40eeb4ec0940617b8b6cbc2f9e8e1d231c93eac5 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Mar 2026 04:22:57 +0000 Subject: [PATCH 2/6] chore: update Android SDK to 13.0.0 --- CHANGELOG.md | 4 ++-- README.md | 6 +++--- library/src/main/java/io/appwrite/Client.kt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76b26619..6e850f0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ # Change Log -## 12.1.1 +## 13.0.0 -* Added Java `DocumentsDB` CRUD operation examples in docs +* [BREAKING] Changed `$sequence` type from `int` to `string` for rows and documents * Updated server compatibility note to Appwrite server version 1.8.x * Updated Gradle/Maven dependencies to `12.1.0` * Updated API version badge to `1.9.0` in README diff --git a/README.md b/README.md index 6a6caca2..b9270d72 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-android/releases).** +**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-android/releases).** Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Android SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) @@ -38,7 +38,7 @@ repositories { Next, add the dependency to your project's `build.gradle(.kts)` file: ```groovy -implementation("io.appwrite:sdk-for-android:12.1.1") +implementation("io.appwrite:sdk-for-android:13.0.0") ``` ### Maven @@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-android - 12.1.1 + 13.0.0 ``` diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt index 67e7dd83..e5ed6080 100644 --- a/library/src/main/java/io/appwrite/Client.kt +++ b/library/src/main/java/io/appwrite/Client.kt @@ -87,7 +87,7 @@ class Client @JvmOverloads constructor( "x-sdk-name" to "Android", "x-sdk-platform" to "client", "x-sdk-language" to "android", - "x-sdk-version" to "12.1.1", + "x-sdk-version" to "13.0.0", "x-appwrite-response-format" to "1.9.0" ) config = mutableMapOf() From b199e60565bdcef0eb3718e4a0d14a1c818a0e88 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Mar 2026 05:25:04 +0000 Subject: [PATCH 3/6] chore: update Android SDK to 13.0.0 --- .../java/documentsdb/create-document.md | 36 - .../java/documentsdb/create-documents.md | 26 - .../java/documentsdb/create-operations.md | 33 - .../java/documentsdb/create-transaction.md | 24 - .../decrement-document-attribute.md | 30 - .../java/documentsdb/delete-document.md | 27 - .../java/documentsdb/delete-transaction.md | 24 - .../examples/java/documentsdb/get-document.md | 28 - .../java/documentsdb/get-transaction.md | 24 - .../increment-document-attribute.md | 30 - .../java/documentsdb/list-documents.md | 29 - .../java/documentsdb/list-transactions.md | 24 - .../java/documentsdb/update-document.md | 31 - .../java/documentsdb/update-transaction.md | 26 - .../java/documentsdb/upsert-document.md | 31 - .../java/vectorsdb/create-document.md | 35 - .../java/vectorsdb/create-operations.md | 33 - .../java/vectorsdb/create-transaction.md | 24 - .../java/vectorsdb/delete-document.md | 27 - .../java/vectorsdb/delete-transaction.md | 24 - docs/examples/java/vectorsdb/get-document.md | 28 - .../java/vectorsdb/get-transaction.md | 24 - .../examples/java/vectorsdb/list-documents.md | 29 - .../java/vectorsdb/list-transactions.md | 24 - .../java/vectorsdb/update-document.md | 31 - .../java/vectorsdb/update-transaction.md | 26 - .../java/vectorsdb/upsert-document.md | 31 - .../kotlin/documentsdb/create-document.md | 27 - .../kotlin/documentsdb/create-documents.md | 17 - .../kotlin/documentsdb/create-operations.md | 24 - .../kotlin/documentsdb/create-transaction.md | 15 - .../decrement-document-attribute.md | 21 - .../kotlin/documentsdb/delete-document.md | 18 - .../kotlin/documentsdb/delete-transaction.md | 15 - .../kotlin/documentsdb/get-document.md | 19 - .../kotlin/documentsdb/get-transaction.md | 15 - .../increment-document-attribute.md | 21 - .../kotlin/documentsdb/list-documents.md | 20 - .../kotlin/documentsdb/list-transactions.md | 15 - .../kotlin/documentsdb/update-document.md | 22 - .../kotlin/documentsdb/update-transaction.md | 17 - .../kotlin/documentsdb/upsert-document.md | 22 - .../kotlin/vectorsdb/create-document.md | 26 - .../kotlin/vectorsdb/create-operations.md | 24 - .../kotlin/vectorsdb/create-transaction.md | 15 - .../kotlin/vectorsdb/delete-document.md | 18 - .../kotlin/vectorsdb/delete-transaction.md | 15 - .../examples/kotlin/vectorsdb/get-document.md | 19 - .../kotlin/vectorsdb/get-transaction.md | 15 - .../kotlin/vectorsdb/list-documents.md | 20 - .../kotlin/vectorsdb/list-transactions.md | 15 - .../kotlin/vectorsdb/update-document.md | 22 - .../kotlin/vectorsdb/update-transaction.md | 17 - .../kotlin/vectorsdb/upsert-document.md | 22 - .../java/io/appwrite/services/DocumentsDB.kt | 854 ------------------ .../java/io/appwrite/services/VectorsDB.kt | 628 ------------- 56 files changed, 2757 deletions(-) delete mode 100644 docs/examples/java/documentsdb/create-document.md delete mode 100644 docs/examples/java/documentsdb/create-documents.md delete mode 100644 docs/examples/java/documentsdb/create-operations.md delete mode 100644 docs/examples/java/documentsdb/create-transaction.md delete mode 100644 docs/examples/java/documentsdb/decrement-document-attribute.md delete mode 100644 docs/examples/java/documentsdb/delete-document.md delete mode 100644 docs/examples/java/documentsdb/delete-transaction.md delete mode 100644 docs/examples/java/documentsdb/get-document.md delete mode 100644 docs/examples/java/documentsdb/get-transaction.md delete mode 100644 docs/examples/java/documentsdb/increment-document-attribute.md delete mode 100644 docs/examples/java/documentsdb/list-documents.md delete mode 100644 docs/examples/java/documentsdb/list-transactions.md delete mode 100644 docs/examples/java/documentsdb/update-document.md delete mode 100644 docs/examples/java/documentsdb/update-transaction.md delete mode 100644 docs/examples/java/documentsdb/upsert-document.md delete mode 100644 docs/examples/java/vectorsdb/create-document.md delete mode 100644 docs/examples/java/vectorsdb/create-operations.md delete mode 100644 docs/examples/java/vectorsdb/create-transaction.md delete mode 100644 docs/examples/java/vectorsdb/delete-document.md delete mode 100644 docs/examples/java/vectorsdb/delete-transaction.md delete mode 100644 docs/examples/java/vectorsdb/get-document.md delete mode 100644 docs/examples/java/vectorsdb/get-transaction.md delete mode 100644 docs/examples/java/vectorsdb/list-documents.md delete mode 100644 docs/examples/java/vectorsdb/list-transactions.md delete mode 100644 docs/examples/java/vectorsdb/update-document.md delete mode 100644 docs/examples/java/vectorsdb/update-transaction.md delete mode 100644 docs/examples/java/vectorsdb/upsert-document.md delete mode 100644 docs/examples/kotlin/documentsdb/create-document.md delete mode 100644 docs/examples/kotlin/documentsdb/create-documents.md delete mode 100644 docs/examples/kotlin/documentsdb/create-operations.md delete mode 100644 docs/examples/kotlin/documentsdb/create-transaction.md delete mode 100644 docs/examples/kotlin/documentsdb/decrement-document-attribute.md delete mode 100644 docs/examples/kotlin/documentsdb/delete-document.md delete mode 100644 docs/examples/kotlin/documentsdb/delete-transaction.md delete mode 100644 docs/examples/kotlin/documentsdb/get-document.md delete mode 100644 docs/examples/kotlin/documentsdb/get-transaction.md delete mode 100644 docs/examples/kotlin/documentsdb/increment-document-attribute.md delete mode 100644 docs/examples/kotlin/documentsdb/list-documents.md delete mode 100644 docs/examples/kotlin/documentsdb/list-transactions.md delete mode 100644 docs/examples/kotlin/documentsdb/update-document.md delete mode 100644 docs/examples/kotlin/documentsdb/update-transaction.md delete mode 100644 docs/examples/kotlin/documentsdb/upsert-document.md delete mode 100644 docs/examples/kotlin/vectorsdb/create-document.md delete mode 100644 docs/examples/kotlin/vectorsdb/create-operations.md delete mode 100644 docs/examples/kotlin/vectorsdb/create-transaction.md delete mode 100644 docs/examples/kotlin/vectorsdb/delete-document.md delete mode 100644 docs/examples/kotlin/vectorsdb/delete-transaction.md delete mode 100644 docs/examples/kotlin/vectorsdb/get-document.md delete mode 100644 docs/examples/kotlin/vectorsdb/get-transaction.md delete mode 100644 docs/examples/kotlin/vectorsdb/list-documents.md delete mode 100644 docs/examples/kotlin/vectorsdb/list-transactions.md delete mode 100644 docs/examples/kotlin/vectorsdb/update-document.md delete mode 100644 docs/examples/kotlin/vectorsdb/update-transaction.md delete mode 100644 docs/examples/kotlin/vectorsdb/upsert-document.md delete mode 100644 library/src/main/java/io/appwrite/services/DocumentsDB.kt delete mode 100644 library/src/main/java/io/appwrite/services/VectorsDB.kt diff --git a/docs/examples/java/documentsdb/create-document.md b/docs/examples/java/documentsdb/create-document.md deleted file mode 100644 index c7f5720d..00000000 --- a/docs/examples/java/documentsdb/create-document.md +++ /dev/null @@ -1,36 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.Permission; -import io.appwrite.Role; -import io.appwrite.services.DocumentsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -DocumentsDB documentsDB = new DocumentsDB(client); - -documentsDB.createDocument( - "", // databaseId - "", // collectionId - "", // documentId - Map.of( - "username", "walter.obrien", - "email", "walter.obrien@example.com", - "fullName", "Walter O'Brien", - "age", 30, - "isAdmin", false - ), // data - List.of(Permission.read(Role.any())), // permissions (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/documentsdb/create-documents.md b/docs/examples/java/documentsdb/create-documents.md deleted file mode 100644 index 8ff433cb..00000000 --- a/docs/examples/java/documentsdb/create-documents.md +++ /dev/null @@ -1,26 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.DocumentsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -DocumentsDB documentsDB = new DocumentsDB(client); - -documentsDB.createDocuments( - "", // databaseId - "", // collectionId - List.of(), // documents - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/documentsdb/create-operations.md b/docs/examples/java/documentsdb/create-operations.md deleted file mode 100644 index f42f5b11..00000000 --- a/docs/examples/java/documentsdb/create-operations.md +++ /dev/null @@ -1,33 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.DocumentsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -DocumentsDB documentsDB = new DocumentsDB(client); - -documentsDB.createOperations( - "", // transactionId - List.of(Map.of( - "action", "create", - "databaseId", "", - "collectionId", "", - "documentId", "", - "data", Map.of( - "name", "Walter O'Brien" - ) - )), // operations (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/documentsdb/create-transaction.md b/docs/examples/java/documentsdb/create-transaction.md deleted file mode 100644 index cc329e4f..00000000 --- a/docs/examples/java/documentsdb/create-transaction.md +++ /dev/null @@ -1,24 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.DocumentsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -DocumentsDB documentsDB = new DocumentsDB(client); - -documentsDB.createTransaction( - 60, // ttl (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/documentsdb/decrement-document-attribute.md b/docs/examples/java/documentsdb/decrement-document-attribute.md deleted file mode 100644 index db8b9c96..00000000 --- a/docs/examples/java/documentsdb/decrement-document-attribute.md +++ /dev/null @@ -1,30 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.DocumentsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -DocumentsDB documentsDB = new DocumentsDB(client); - -documentsDB.decrementDocumentAttribute( - "", // databaseId - "", // collectionId - "", // documentId - "", // attribute - 0, // value (optional) - 0, // min (optional) - "", // transactionId (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/documentsdb/delete-document.md b/docs/examples/java/documentsdb/delete-document.md deleted file mode 100644 index d2547598..00000000 --- a/docs/examples/java/documentsdb/delete-document.md +++ /dev/null @@ -1,27 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.DocumentsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -DocumentsDB documentsDB = new DocumentsDB(client); - -documentsDB.deleteDocument( - "", // databaseId - "", // collectionId - "", // documentId - "", // transactionId (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/documentsdb/delete-transaction.md b/docs/examples/java/documentsdb/delete-transaction.md deleted file mode 100644 index 7d480e1a..00000000 --- a/docs/examples/java/documentsdb/delete-transaction.md +++ /dev/null @@ -1,24 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.DocumentsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -DocumentsDB documentsDB = new DocumentsDB(client); - -documentsDB.deleteTransaction( - "", // transactionId - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/documentsdb/get-document.md b/docs/examples/java/documentsdb/get-document.md deleted file mode 100644 index 227052e8..00000000 --- a/docs/examples/java/documentsdb/get-document.md +++ /dev/null @@ -1,28 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.DocumentsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -DocumentsDB documentsDB = new DocumentsDB(client); - -documentsDB.getDocument( - "", // databaseId - "", // collectionId - "", // documentId - List.of(), // queries (optional) - "", // transactionId (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/documentsdb/get-transaction.md b/docs/examples/java/documentsdb/get-transaction.md deleted file mode 100644 index 4ea856d9..00000000 --- a/docs/examples/java/documentsdb/get-transaction.md +++ /dev/null @@ -1,24 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.DocumentsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -DocumentsDB documentsDB = new DocumentsDB(client); - -documentsDB.getTransaction( - "", // transactionId - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/documentsdb/increment-document-attribute.md b/docs/examples/java/documentsdb/increment-document-attribute.md deleted file mode 100644 index a88252b8..00000000 --- a/docs/examples/java/documentsdb/increment-document-attribute.md +++ /dev/null @@ -1,30 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.DocumentsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -DocumentsDB documentsDB = new DocumentsDB(client); - -documentsDB.incrementDocumentAttribute( - "", // databaseId - "", // collectionId - "", // documentId - "", // attribute - 0, // value (optional) - 0, // max (optional) - "", // transactionId (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/documentsdb/list-documents.md b/docs/examples/java/documentsdb/list-documents.md deleted file mode 100644 index 10af35fd..00000000 --- a/docs/examples/java/documentsdb/list-documents.md +++ /dev/null @@ -1,29 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.DocumentsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -DocumentsDB documentsDB = new DocumentsDB(client); - -documentsDB.listDocuments( - "", // databaseId - "", // collectionId - List.of(), // queries (optional) - "", // transactionId (optional) - false, // total (optional) - 0, // ttl (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/documentsdb/list-transactions.md b/docs/examples/java/documentsdb/list-transactions.md deleted file mode 100644 index 54506e0e..00000000 --- a/docs/examples/java/documentsdb/list-transactions.md +++ /dev/null @@ -1,24 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.DocumentsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -DocumentsDB documentsDB = new DocumentsDB(client); - -documentsDB.listTransactions( - List.of(), // queries (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/documentsdb/update-document.md b/docs/examples/java/documentsdb/update-document.md deleted file mode 100644 index 8fe84930..00000000 --- a/docs/examples/java/documentsdb/update-document.md +++ /dev/null @@ -1,31 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.Permission; -import io.appwrite.Role; -import io.appwrite.services.DocumentsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -DocumentsDB documentsDB = new DocumentsDB(client); - -documentsDB.updateDocument( - "", // databaseId - "", // collectionId - "", // documentId - Map.of("a", "b"), // data (optional) - List.of(Permission.read(Role.any())), // permissions (optional) - "", // transactionId (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/documentsdb/update-transaction.md b/docs/examples/java/documentsdb/update-transaction.md deleted file mode 100644 index dd15c62d..00000000 --- a/docs/examples/java/documentsdb/update-transaction.md +++ /dev/null @@ -1,26 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.DocumentsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -DocumentsDB documentsDB = new DocumentsDB(client); - -documentsDB.updateTransaction( - "", // transactionId - false, // commit (optional) - false, // rollback (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/documentsdb/upsert-document.md b/docs/examples/java/documentsdb/upsert-document.md deleted file mode 100644 index f949f286..00000000 --- a/docs/examples/java/documentsdb/upsert-document.md +++ /dev/null @@ -1,31 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.Permission; -import io.appwrite.Role; -import io.appwrite.services.DocumentsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -DocumentsDB documentsDB = new DocumentsDB(client); - -documentsDB.upsertDocument( - "", // databaseId - "", // collectionId - "", // documentId - Map.of("a", "b"), // data (optional) - List.of(Permission.read(Role.any())), // permissions (optional) - "", // transactionId (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/vectorsdb/create-document.md b/docs/examples/java/vectorsdb/create-document.md deleted file mode 100644 index dad4bd7f..00000000 --- a/docs/examples/java/vectorsdb/create-document.md +++ /dev/null @@ -1,35 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.Permission; -import io.appwrite.Role; -import io.appwrite.services.VectorsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -VectorsDB vectorsDB = new VectorsDB(client); - -vectorsDB.createDocument( - "", // databaseId - "", // collectionId - "", // documentId - Map.of( - "embeddings", List.of(0.12, -0.55, 0.88, 1.02), - "metadata", Map.of( - "key", "value" - ) - ), // data - List.of(Permission.read(Role.any())), // permissions (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/vectorsdb/create-operations.md b/docs/examples/java/vectorsdb/create-operations.md deleted file mode 100644 index acc51c84..00000000 --- a/docs/examples/java/vectorsdb/create-operations.md +++ /dev/null @@ -1,33 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.VectorsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -VectorsDB vectorsDB = new VectorsDB(client); - -vectorsDB.createOperations( - "", // transactionId - List.of(Map.of( - "action", "create", - "databaseId", "", - "collectionId", "", - "documentId", "", - "data", Map.of( - "name", "Walter O'Brien" - ) - )), // operations (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/vectorsdb/create-transaction.md b/docs/examples/java/vectorsdb/create-transaction.md deleted file mode 100644 index ffc21917..00000000 --- a/docs/examples/java/vectorsdb/create-transaction.md +++ /dev/null @@ -1,24 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.VectorsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -VectorsDB vectorsDB = new VectorsDB(client); - -vectorsDB.createTransaction( - 60, // ttl (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/vectorsdb/delete-document.md b/docs/examples/java/vectorsdb/delete-document.md deleted file mode 100644 index 6df52e88..00000000 --- a/docs/examples/java/vectorsdb/delete-document.md +++ /dev/null @@ -1,27 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.VectorsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -VectorsDB vectorsDB = new VectorsDB(client); - -vectorsDB.deleteDocument( - "", // databaseId - "", // collectionId - "", // documentId - "", // transactionId (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/vectorsdb/delete-transaction.md b/docs/examples/java/vectorsdb/delete-transaction.md deleted file mode 100644 index aef0ee27..00000000 --- a/docs/examples/java/vectorsdb/delete-transaction.md +++ /dev/null @@ -1,24 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.VectorsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -VectorsDB vectorsDB = new VectorsDB(client); - -vectorsDB.deleteTransaction( - "", // transactionId - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/vectorsdb/get-document.md b/docs/examples/java/vectorsdb/get-document.md deleted file mode 100644 index b9a00b17..00000000 --- a/docs/examples/java/vectorsdb/get-document.md +++ /dev/null @@ -1,28 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.VectorsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -VectorsDB vectorsDB = new VectorsDB(client); - -vectorsDB.getDocument( - "", // databaseId - "", // collectionId - "", // documentId - List.of(), // queries (optional) - "", // transactionId (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/vectorsdb/get-transaction.md b/docs/examples/java/vectorsdb/get-transaction.md deleted file mode 100644 index 13e6dca4..00000000 --- a/docs/examples/java/vectorsdb/get-transaction.md +++ /dev/null @@ -1,24 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.VectorsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -VectorsDB vectorsDB = new VectorsDB(client); - -vectorsDB.getTransaction( - "", // transactionId - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/vectorsdb/list-documents.md b/docs/examples/java/vectorsdb/list-documents.md deleted file mode 100644 index 183704c8..00000000 --- a/docs/examples/java/vectorsdb/list-documents.md +++ /dev/null @@ -1,29 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.VectorsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -VectorsDB vectorsDB = new VectorsDB(client); - -vectorsDB.listDocuments( - "", // databaseId - "", // collectionId - List.of(), // queries (optional) - "", // transactionId (optional) - false, // total (optional) - 0, // ttl (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/vectorsdb/list-transactions.md b/docs/examples/java/vectorsdb/list-transactions.md deleted file mode 100644 index 19d9cbaf..00000000 --- a/docs/examples/java/vectorsdb/list-transactions.md +++ /dev/null @@ -1,24 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.VectorsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -VectorsDB vectorsDB = new VectorsDB(client); - -vectorsDB.listTransactions( - List.of(), // queries (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/vectorsdb/update-document.md b/docs/examples/java/vectorsdb/update-document.md deleted file mode 100644 index 1ed8b639..00000000 --- a/docs/examples/java/vectorsdb/update-document.md +++ /dev/null @@ -1,31 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.Permission; -import io.appwrite.Role; -import io.appwrite.services.VectorsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -VectorsDB vectorsDB = new VectorsDB(client); - -vectorsDB.updateDocument( - "", // databaseId - "", // collectionId - "", // documentId - Map.of("a", "b"), // data (optional) - List.of(Permission.read(Role.any())), // permissions (optional) - "", // transactionId (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/vectorsdb/update-transaction.md b/docs/examples/java/vectorsdb/update-transaction.md deleted file mode 100644 index 6bea2a97..00000000 --- a/docs/examples/java/vectorsdb/update-transaction.md +++ /dev/null @@ -1,26 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.VectorsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -VectorsDB vectorsDB = new VectorsDB(client); - -vectorsDB.updateTransaction( - "", // transactionId - false, // commit (optional) - false, // rollback (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/vectorsdb/upsert-document.md b/docs/examples/java/vectorsdb/upsert-document.md deleted file mode 100644 index 199b0891..00000000 --- a/docs/examples/java/vectorsdb/upsert-document.md +++ /dev/null @@ -1,31 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.Permission; -import io.appwrite.Role; -import io.appwrite.services.VectorsDB; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -VectorsDB vectorsDB = new VectorsDB(client); - -vectorsDB.upsertDocument( - "", // databaseId - "", // collectionId - "", // documentId - Map.of("a", "b"), // data (optional) - List.of(Permission.read(Role.any())), // permissions (optional) - "", // transactionId (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/kotlin/documentsdb/create-document.md b/docs/examples/kotlin/documentsdb/create-document.md deleted file mode 100644 index 270dd1bf..00000000 --- a/docs/examples/kotlin/documentsdb/create-document.md +++ /dev/null @@ -1,27 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.DocumentsDB -import io.appwrite.Permission -import io.appwrite.Role - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val documentsDB = DocumentsDB(client) - -val result = documentsDB.createDocument( - databaseId = "", - collectionId = "", - documentId = "", - data = mapOf( - "username" to "walter.obrien", - "email" to "walter.obrien@example.com", - "fullName" to "Walter O'Brien", - "age" to 30, - "isAdmin" to false - ), - permissions = listOf(Permission.read(Role.any())), // (optional) -) -``` diff --git a/docs/examples/kotlin/documentsdb/create-documents.md b/docs/examples/kotlin/documentsdb/create-documents.md deleted file mode 100644 index 8f4d7c46..00000000 --- a/docs/examples/kotlin/documentsdb/create-documents.md +++ /dev/null @@ -1,17 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.DocumentsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val documentsDB = DocumentsDB(client) - -val result = documentsDB.createDocuments( - databaseId = "", - collectionId = "", - documents = listOf(), -) -``` diff --git a/docs/examples/kotlin/documentsdb/create-operations.md b/docs/examples/kotlin/documentsdb/create-operations.md deleted file mode 100644 index c6258095..00000000 --- a/docs/examples/kotlin/documentsdb/create-operations.md +++ /dev/null @@ -1,24 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.DocumentsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val documentsDB = DocumentsDB(client) - -val result = documentsDB.createOperations( - transactionId = "", - operations = listOf(mapOf( - "action" to "create", - "databaseId" to "", - "collectionId" to "", - "documentId" to "", - "data" to mapOf( - "name" to "Walter O'Brien" - ) - )), // (optional) -) -``` diff --git a/docs/examples/kotlin/documentsdb/create-transaction.md b/docs/examples/kotlin/documentsdb/create-transaction.md deleted file mode 100644 index ad1f0b21..00000000 --- a/docs/examples/kotlin/documentsdb/create-transaction.md +++ /dev/null @@ -1,15 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.DocumentsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val documentsDB = DocumentsDB(client) - -val result = documentsDB.createTransaction( - ttl = 60, // (optional) -) -``` diff --git a/docs/examples/kotlin/documentsdb/decrement-document-attribute.md b/docs/examples/kotlin/documentsdb/decrement-document-attribute.md deleted file mode 100644 index 50a17fb6..00000000 --- a/docs/examples/kotlin/documentsdb/decrement-document-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.DocumentsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val documentsDB = DocumentsDB(client) - -val result = documentsDB.decrementDocumentAttribute( - databaseId = "", - collectionId = "", - documentId = "", - attribute = "", - value = 0, // (optional) - min = 0, // (optional) - transactionId = "", // (optional) -) -``` diff --git a/docs/examples/kotlin/documentsdb/delete-document.md b/docs/examples/kotlin/documentsdb/delete-document.md deleted file mode 100644 index 648a83ca..00000000 --- a/docs/examples/kotlin/documentsdb/delete-document.md +++ /dev/null @@ -1,18 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.DocumentsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val documentsDB = DocumentsDB(client) - -val result = documentsDB.deleteDocument( - databaseId = "", - collectionId = "", - documentId = "", - transactionId = "", // (optional) -) -``` diff --git a/docs/examples/kotlin/documentsdb/delete-transaction.md b/docs/examples/kotlin/documentsdb/delete-transaction.md deleted file mode 100644 index d991466f..00000000 --- a/docs/examples/kotlin/documentsdb/delete-transaction.md +++ /dev/null @@ -1,15 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.DocumentsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val documentsDB = DocumentsDB(client) - -val result = documentsDB.deleteTransaction( - transactionId = "", -) -``` diff --git a/docs/examples/kotlin/documentsdb/get-document.md b/docs/examples/kotlin/documentsdb/get-document.md deleted file mode 100644 index 1988e002..00000000 --- a/docs/examples/kotlin/documentsdb/get-document.md +++ /dev/null @@ -1,19 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.DocumentsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val documentsDB = DocumentsDB(client) - -val result = documentsDB.getDocument( - databaseId = "", - collectionId = "", - documentId = "", - queries = listOf(), // (optional) - transactionId = "", // (optional) -) -``` diff --git a/docs/examples/kotlin/documentsdb/get-transaction.md b/docs/examples/kotlin/documentsdb/get-transaction.md deleted file mode 100644 index 695412e7..00000000 --- a/docs/examples/kotlin/documentsdb/get-transaction.md +++ /dev/null @@ -1,15 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.DocumentsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val documentsDB = DocumentsDB(client) - -val result = documentsDB.getTransaction( - transactionId = "", -) -``` diff --git a/docs/examples/kotlin/documentsdb/increment-document-attribute.md b/docs/examples/kotlin/documentsdb/increment-document-attribute.md deleted file mode 100644 index 3267a0d2..00000000 --- a/docs/examples/kotlin/documentsdb/increment-document-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.DocumentsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val documentsDB = DocumentsDB(client) - -val result = documentsDB.incrementDocumentAttribute( - databaseId = "", - collectionId = "", - documentId = "", - attribute = "", - value = 0, // (optional) - max = 0, // (optional) - transactionId = "", // (optional) -) -``` diff --git a/docs/examples/kotlin/documentsdb/list-documents.md b/docs/examples/kotlin/documentsdb/list-documents.md deleted file mode 100644 index a8c1b66b..00000000 --- a/docs/examples/kotlin/documentsdb/list-documents.md +++ /dev/null @@ -1,20 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.DocumentsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val documentsDB = DocumentsDB(client) - -val result = documentsDB.listDocuments( - databaseId = "", - collectionId = "", - queries = listOf(), // (optional) - transactionId = "", // (optional) - total = false, // (optional) - ttl = 0, // (optional) -) -``` diff --git a/docs/examples/kotlin/documentsdb/list-transactions.md b/docs/examples/kotlin/documentsdb/list-transactions.md deleted file mode 100644 index 46571468..00000000 --- a/docs/examples/kotlin/documentsdb/list-transactions.md +++ /dev/null @@ -1,15 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.DocumentsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val documentsDB = DocumentsDB(client) - -val result = documentsDB.listTransactions( - queries = listOf(), // (optional) -) -``` diff --git a/docs/examples/kotlin/documentsdb/update-document.md b/docs/examples/kotlin/documentsdb/update-document.md deleted file mode 100644 index 69668863..00000000 --- a/docs/examples/kotlin/documentsdb/update-document.md +++ /dev/null @@ -1,22 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.DocumentsDB -import io.appwrite.Permission -import io.appwrite.Role - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val documentsDB = DocumentsDB(client) - -val result = documentsDB.updateDocument( - databaseId = "", - collectionId = "", - documentId = "", - data = mapOf( "a" to "b" ), // (optional) - permissions = listOf(Permission.read(Role.any())), // (optional) - transactionId = "", // (optional) -) -``` diff --git a/docs/examples/kotlin/documentsdb/update-transaction.md b/docs/examples/kotlin/documentsdb/update-transaction.md deleted file mode 100644 index 78fb3e7b..00000000 --- a/docs/examples/kotlin/documentsdb/update-transaction.md +++ /dev/null @@ -1,17 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.DocumentsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val documentsDB = DocumentsDB(client) - -val result = documentsDB.updateTransaction( - transactionId = "", - commit = false, // (optional) - rollback = false, // (optional) -) -``` diff --git a/docs/examples/kotlin/documentsdb/upsert-document.md b/docs/examples/kotlin/documentsdb/upsert-document.md deleted file mode 100644 index defc50a2..00000000 --- a/docs/examples/kotlin/documentsdb/upsert-document.md +++ /dev/null @@ -1,22 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.DocumentsDB -import io.appwrite.Permission -import io.appwrite.Role - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val documentsDB = DocumentsDB(client) - -val result = documentsDB.upsertDocument( - databaseId = "", - collectionId = "", - documentId = "", - data = mapOf( "a" to "b" ), // (optional) - permissions = listOf(Permission.read(Role.any())), // (optional) - transactionId = "", // (optional) -) -``` diff --git a/docs/examples/kotlin/vectorsdb/create-document.md b/docs/examples/kotlin/vectorsdb/create-document.md deleted file mode 100644 index 57221ffc..00000000 --- a/docs/examples/kotlin/vectorsdb/create-document.md +++ /dev/null @@ -1,26 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.VectorsDB -import io.appwrite.Permission -import io.appwrite.Role - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val vectorsDB = VectorsDB(client) - -val result = vectorsDB.createDocument( - databaseId = "", - collectionId = "", - documentId = "", - data = mapOf( - "embeddings" to listOf(0.12, -0.55, 0.88, 1.02), - "metadata" to mapOf( - "key" to "value" - ) - ), - permissions = listOf(Permission.read(Role.any())), // (optional) -) -``` diff --git a/docs/examples/kotlin/vectorsdb/create-operations.md b/docs/examples/kotlin/vectorsdb/create-operations.md deleted file mode 100644 index 1a2908af..00000000 --- a/docs/examples/kotlin/vectorsdb/create-operations.md +++ /dev/null @@ -1,24 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.VectorsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val vectorsDB = VectorsDB(client) - -val result = vectorsDB.createOperations( - transactionId = "", - operations = listOf(mapOf( - "action" to "create", - "databaseId" to "", - "collectionId" to "", - "documentId" to "", - "data" to mapOf( - "name" to "Walter O'Brien" - ) - )), // (optional) -) -``` diff --git a/docs/examples/kotlin/vectorsdb/create-transaction.md b/docs/examples/kotlin/vectorsdb/create-transaction.md deleted file mode 100644 index 9ca3de5c..00000000 --- a/docs/examples/kotlin/vectorsdb/create-transaction.md +++ /dev/null @@ -1,15 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.VectorsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val vectorsDB = VectorsDB(client) - -val result = vectorsDB.createTransaction( - ttl = 60, // (optional) -) -``` diff --git a/docs/examples/kotlin/vectorsdb/delete-document.md b/docs/examples/kotlin/vectorsdb/delete-document.md deleted file mode 100644 index 9cc1856f..00000000 --- a/docs/examples/kotlin/vectorsdb/delete-document.md +++ /dev/null @@ -1,18 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.VectorsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val vectorsDB = VectorsDB(client) - -val result = vectorsDB.deleteDocument( - databaseId = "", - collectionId = "", - documentId = "", - transactionId = "", // (optional) -) -``` diff --git a/docs/examples/kotlin/vectorsdb/delete-transaction.md b/docs/examples/kotlin/vectorsdb/delete-transaction.md deleted file mode 100644 index e97ab53a..00000000 --- a/docs/examples/kotlin/vectorsdb/delete-transaction.md +++ /dev/null @@ -1,15 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.VectorsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val vectorsDB = VectorsDB(client) - -val result = vectorsDB.deleteTransaction( - transactionId = "", -) -``` diff --git a/docs/examples/kotlin/vectorsdb/get-document.md b/docs/examples/kotlin/vectorsdb/get-document.md deleted file mode 100644 index 22584ab1..00000000 --- a/docs/examples/kotlin/vectorsdb/get-document.md +++ /dev/null @@ -1,19 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.VectorsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val vectorsDB = VectorsDB(client) - -val result = vectorsDB.getDocument( - databaseId = "", - collectionId = "", - documentId = "", - queries = listOf(), // (optional) - transactionId = "", // (optional) -) -``` diff --git a/docs/examples/kotlin/vectorsdb/get-transaction.md b/docs/examples/kotlin/vectorsdb/get-transaction.md deleted file mode 100644 index 2a510ea8..00000000 --- a/docs/examples/kotlin/vectorsdb/get-transaction.md +++ /dev/null @@ -1,15 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.VectorsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val vectorsDB = VectorsDB(client) - -val result = vectorsDB.getTransaction( - transactionId = "", -) -``` diff --git a/docs/examples/kotlin/vectorsdb/list-documents.md b/docs/examples/kotlin/vectorsdb/list-documents.md deleted file mode 100644 index 90a7f04a..00000000 --- a/docs/examples/kotlin/vectorsdb/list-documents.md +++ /dev/null @@ -1,20 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.VectorsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val vectorsDB = VectorsDB(client) - -val result = vectorsDB.listDocuments( - databaseId = "", - collectionId = "", - queries = listOf(), // (optional) - transactionId = "", // (optional) - total = false, // (optional) - ttl = 0, // (optional) -) -``` diff --git a/docs/examples/kotlin/vectorsdb/list-transactions.md b/docs/examples/kotlin/vectorsdb/list-transactions.md deleted file mode 100644 index 97981c01..00000000 --- a/docs/examples/kotlin/vectorsdb/list-transactions.md +++ /dev/null @@ -1,15 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.VectorsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val vectorsDB = VectorsDB(client) - -val result = vectorsDB.listTransactions( - queries = listOf(), // (optional) -) -``` diff --git a/docs/examples/kotlin/vectorsdb/update-document.md b/docs/examples/kotlin/vectorsdb/update-document.md deleted file mode 100644 index 13422596..00000000 --- a/docs/examples/kotlin/vectorsdb/update-document.md +++ /dev/null @@ -1,22 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.VectorsDB -import io.appwrite.Permission -import io.appwrite.Role - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val vectorsDB = VectorsDB(client) - -val result = vectorsDB.updateDocument( - databaseId = "", - collectionId = "", - documentId = "", - data = mapOf( "a" to "b" ), // (optional) - permissions = listOf(Permission.read(Role.any())), // (optional) - transactionId = "", // (optional) -) -``` diff --git a/docs/examples/kotlin/vectorsdb/update-transaction.md b/docs/examples/kotlin/vectorsdb/update-transaction.md deleted file mode 100644 index c49da348..00000000 --- a/docs/examples/kotlin/vectorsdb/update-transaction.md +++ /dev/null @@ -1,17 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.VectorsDB - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val vectorsDB = VectorsDB(client) - -val result = vectorsDB.updateTransaction( - transactionId = "", - commit = false, // (optional) - rollback = false, // (optional) -) -``` diff --git a/docs/examples/kotlin/vectorsdb/upsert-document.md b/docs/examples/kotlin/vectorsdb/upsert-document.md deleted file mode 100644 index 111b61c6..00000000 --- a/docs/examples/kotlin/vectorsdb/upsert-document.md +++ /dev/null @@ -1,22 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.VectorsDB -import io.appwrite.Permission -import io.appwrite.Role - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val vectorsDB = VectorsDB(client) - -val result = vectorsDB.upsertDocument( - databaseId = "", - collectionId = "", - documentId = "", - data = mapOf( "a" to "b" ), // (optional) - permissions = listOf(Permission.read(Role.any())), // (optional) - transactionId = "", // (optional) -) -``` diff --git a/library/src/main/java/io/appwrite/services/DocumentsDB.kt b/library/src/main/java/io/appwrite/services/DocumentsDB.kt deleted file mode 100644 index 1523ffb9..00000000 --- a/library/src/main/java/io/appwrite/services/DocumentsDB.kt +++ /dev/null @@ -1,854 +0,0 @@ -package io.appwrite.services - -import android.net.Uri -import io.appwrite.Client -import io.appwrite.Service -import io.appwrite.models.* -import io.appwrite.exceptions.AppwriteException -import io.appwrite.extensions.classOf -import okhttp3.Cookie -import java.io.File - -/** - * - */ -class DocumentsDB(client: Client) : Service(client) { - - /** - * - * - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). - * @return [io.appwrite.models.TransactionList] - */ - @JvmOverloads - suspend fun listTransactions( - queries: List? = null, - ): io.appwrite.models.TransactionList { - val apiPath = "/documentsdb/transactions" - - val apiParams = mutableMapOf( - "queries" to queries, - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.TransactionList = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.TransactionList.from(map = it as Map) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.TransactionList::class.java, - converter, - ) - } - - - /** - * - * - * @param ttl Seconds before the transaction expires. - * @return [io.appwrite.models.Transaction] - */ - @JvmOverloads - suspend fun createTransaction( - ttl: Long? = null, - ): io.appwrite.models.Transaction { - val apiPath = "/documentsdb/transactions" - - val apiParams = mutableMapOf( - "ttl" to ttl, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Transaction = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Transaction.from(map = it as Map) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.Transaction::class.java, - converter, - ) - } - - - /** - * - * - * @param transactionId Transaction ID. - * @return [io.appwrite.models.Transaction] - */ - suspend fun getTransaction( - transactionId: String, - ): io.appwrite.models.Transaction { - val apiPath = "/documentsdb/transactions/{transactionId}" - .replace("{transactionId}", transactionId) - - val apiParams = mutableMapOf( - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.Transaction = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Transaction.from(map = it as Map) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.Transaction::class.java, - converter, - ) - } - - - /** - * - * - * @param transactionId Transaction ID. - * @param commit Commit transaction? - * @param rollback Rollback transaction? - * @return [io.appwrite.models.Transaction] - */ - @JvmOverloads - suspend fun updateTransaction( - transactionId: String, - commit: Boolean? = null, - rollback: Boolean? = null, - ): io.appwrite.models.Transaction { - val apiPath = "/documentsdb/transactions/{transactionId}" - .replace("{transactionId}", transactionId) - - val apiParams = mutableMapOf( - "commit" to commit, - "rollback" to rollback, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Transaction = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Transaction.from(map = it as Map) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.Transaction::class.java, - converter, - ) - } - - - /** - * - * - * @param transactionId Transaction ID. - * @return [Any] - */ - suspend fun deleteTransaction( - transactionId: String, - ): Any { - val apiPath = "/documentsdb/transactions/{transactionId}" - .replace("{transactionId}", transactionId) - - val apiParams = mutableMapOf( - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - return client.call( - "DELETE", - apiPath, - apiHeaders, - apiParams, - responseType = Any::class.java, - ) - } - - - /** - * - * - * @param transactionId Transaction ID. - * @param operations Array of staged operations. - * @return [io.appwrite.models.Transaction] - */ - @JvmOverloads - suspend fun createOperations( - transactionId: String, - operations: List? = null, - ): io.appwrite.models.Transaction { - val apiPath = "/documentsdb/transactions/{transactionId}/operations" - .replace("{transactionId}", transactionId) - - val apiParams = mutableMapOf( - "operations" to operations, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Transaction = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Transaction.from(map = it as Map) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.Transaction::class.java, - converter, - ) - } - - - /** - * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. - * - * @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). - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param transactionId Transaction ID to read uncommitted changes within the transaction. - * @param total When set to false, the total count returned will be 0 and will not be calculated. - * @param ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). - * @return [io.appwrite.models.DocumentList] - */ - @JvmOverloads - suspend fun listDocuments( - databaseId: String, - collectionId: String, - queries: List? = null, - transactionId: String? = null, - total: Boolean? = null, - ttl: Long? = null, - nestedType: Class, - ): io.appwrite.models.DocumentList { - val apiPath = "/documentsdb/{databaseId}/collections/{collectionId}/documents" - .replace("{databaseId}", databaseId) - .replace("{collectionId}", collectionId) - - val apiParams = mutableMapOf( - "queries" to queries, - "transactionId" to transactionId, - "total" to total, - "ttl" to ttl, - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.DocumentList = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.DocumentList.from(map = it as Map, nestedType) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. - * - * @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). - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param transactionId Transaction ID to read uncommitted changes within the transaction. - * @param total When set to false, the total count returned will be 0 and will not be calculated. - * @param ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). - * @return [io.appwrite.models.DocumentList] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun listDocuments( - databaseId: String, - collectionId: String, - queries: List? = null, - transactionId: String? = null, - total: Boolean? = null, - ttl: Long? = null, - ): io.appwrite.models.DocumentList> = listDocuments( - databaseId, - collectionId, - queries, - transactionId, - total, - ttl, - nestedType = classOf(), - ) - - /** - * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) 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 documentId Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param data Document data as JSON object. - * @param permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - suspend fun createDocument( - databaseId: String, - collectionId: String, - documentId: String, - data: Any, - permissions: List? = null, - nestedType: Class, - ): io.appwrite.models.Document { - val apiPath = "/documentsdb/{databaseId}/collections/{collectionId}/documents" - .replace("{databaseId}", databaseId) - .replace("{collectionId}", collectionId) - - val apiParams = mutableMapOf( - "documentId" to documentId, - "data" to data, - "permissions" to permissions, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Document = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Document.from(map = it as Map, nestedType) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) 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 documentId Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param data Document data as JSON object. - * @param permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun createDocument( - databaseId: String, - collectionId: String, - documentId: String, - data: Any, - permissions: List? = null, - ): io.appwrite.models.Document> = createDocument( - databaseId, - collectionId, - documentId, - data, - permissions, - 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#documentsDBCreateCollection) 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 = "/documentsdb/{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#documentsDBCreateCollection) 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. - * - * @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). - * @param documentId Document ID. - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param transactionId Transaction ID to read uncommitted changes within the transaction. - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - suspend fun getDocument( - databaseId: String, - collectionId: String, - documentId: String, - queries: List? = null, - transactionId: String? = null, - nestedType: Class, - ): io.appwrite.models.Document { - val apiPath = "/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}" - .replace("{databaseId}", databaseId) - .replace("{collectionId}", collectionId) - .replace("{documentId}", documentId) - - val apiParams = mutableMapOf( - "queries" to queries, - "transactionId" to transactionId, - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.Document = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Document.from(map = it as Map, nestedType) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. - * - * @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). - * @param documentId Document ID. - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param transactionId Transaction ID to read uncommitted changes within the transaction. - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun getDocument( - databaseId: String, - collectionId: String, - documentId: String, - queries: List? = null, - transactionId: String? = null, - ): io.appwrite.models.Document> = getDocument( - databaseId, - collectionId, - documentId, - queries, - transactionId, - nestedType = classOf(), - ) - - /** - * 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#documentsDBCreateCollection) API or directly from your database console. - * - * @param databaseId Database ID. - * @param collectionId Collection ID. - * @param documentId Document ID. - * @param data Document data as JSON object. Include all required fields of the document to be created or updated. - * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param transactionId Transaction ID for staging the operation. - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - suspend fun upsertDocument( - databaseId: String, - collectionId: String, - documentId: String, - data: Any? = null, - permissions: List? = null, - transactionId: String? = null, - nestedType: Class, - ): io.appwrite.models.Document { - val apiPath = "/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}" - .replace("{databaseId}", databaseId) - .replace("{collectionId}", collectionId) - .replace("{documentId}", documentId) - - val apiParams = mutableMapOf( - "data" to data, - "permissions" to permissions, - "transactionId" to transactionId, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Document = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Document.from(map = it as Map, nestedType) - } - return client.call( - "PUT", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * 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#documentsDBCreateCollection) API or directly from your database console. - * - * @param databaseId Database ID. - * @param collectionId Collection ID. - * @param documentId Document ID. - * @param data Document data as JSON object. Include all required fields of the document to be created or updated. - * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param transactionId Transaction ID for staging the operation. - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun upsertDocument( - databaseId: String, - collectionId: String, - documentId: String, - data: Any? = null, - permissions: List? = null, - transactionId: String? = null, - ): io.appwrite.models.Document> = upsertDocument( - databaseId, - collectionId, - documentId, - data, - permissions, - transactionId, - nestedType = classOf(), - ) - - /** - * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. - * - * @param databaseId Database ID. - * @param collectionId Collection ID. - * @param documentId Document ID. - * @param data Document data as JSON object. Include only fields and value pairs to be updated. - * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param transactionId Transaction ID for staging the operation. - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - suspend fun updateDocument( - databaseId: String, - collectionId: String, - documentId: String, - data: Any? = null, - permissions: List? = null, - transactionId: String? = null, - nestedType: Class, - ): io.appwrite.models.Document { - val apiPath = "/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}" - .replace("{databaseId}", databaseId) - .replace("{collectionId}", collectionId) - .replace("{documentId}", documentId) - - val apiParams = mutableMapOf( - "data" to data, - "permissions" to permissions, - "transactionId" to transactionId, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Document = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Document.from(map = it as Map, nestedType) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. - * - * @param databaseId Database ID. - * @param collectionId Collection ID. - * @param documentId Document ID. - * @param data Document data as JSON object. Include only fields and value pairs to be updated. - * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param transactionId Transaction ID for staging the operation. - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updateDocument( - databaseId: String, - collectionId: String, - documentId: String, - data: Any? = null, - permissions: List? = null, - transactionId: String? = null, - ): io.appwrite.models.Document> = updateDocument( - databaseId, - collectionId, - documentId, - data, - permissions, - transactionId, - nestedType = classOf(), - ) - - /** - * Delete a document by its unique ID. - * - * @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). - * @param documentId Document ID. - * @param transactionId Transaction ID for staging the operation. - * @return [Any] - */ - @JvmOverloads - suspend fun deleteDocument( - databaseId: String, - collectionId: String, - documentId: String, - transactionId: String? = null, - ): Any { - val apiPath = "/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}" - .replace("{databaseId}", databaseId) - .replace("{collectionId}", collectionId) - .replace("{documentId}", documentId) - - val apiParams = mutableMapOf( - "transactionId" to transactionId, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - return client.call( - "DELETE", - apiPath, - apiHeaders, - apiParams, - responseType = Any::class.java, - ) - } - - - /** - * Decrement a specific column of a row by a given value. - * - * @param databaseId Database ID. - * @param collectionId Collection ID. - * @param documentId Document ID. - * @param attribute Attribute key. - * @param value Value to decrement the attribute by. The value must be a number. - * @param min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. - * @param transactionId Transaction ID for staging the operation. - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - suspend fun decrementDocumentAttribute( - databaseId: String, - collectionId: String, - documentId: String, - attribute: String, - value: Double? = null, - min: Double? = null, - transactionId: String? = null, - nestedType: Class, - ): io.appwrite.models.Document { - val apiPath = "/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement" - .replace("{databaseId}", databaseId) - .replace("{collectionId}", collectionId) - .replace("{documentId}", documentId) - .replace("{attribute}", attribute) - - val apiParams = mutableMapOf( - "value" to value, - "min" to min, - "transactionId" to transactionId, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Document = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Document.from(map = it as Map, nestedType) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Decrement a specific column of a row by a given value. - * - * @param databaseId Database ID. - * @param collectionId Collection ID. - * @param documentId Document ID. - * @param attribute Attribute key. - * @param value Value to decrement the attribute by. The value must be a number. - * @param min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. - * @param transactionId Transaction ID for staging the operation. - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun decrementDocumentAttribute( - databaseId: String, - collectionId: String, - documentId: String, - attribute: String, - value: Double? = null, - min: Double? = null, - transactionId: String? = null, - ): io.appwrite.models.Document> = decrementDocumentAttribute( - databaseId, - collectionId, - documentId, - attribute, - value, - min, - transactionId, - nestedType = classOf(), - ) - - /** - * Increment a specific column of a row by a given value. - * - * @param databaseId Database ID. - * @param collectionId Collection ID. - * @param documentId Document ID. - * @param attribute Attribute key. - * @param value Value to increment the attribute by. The value must be a number. - * @param max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. - * @param transactionId Transaction ID for staging the operation. - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - suspend fun incrementDocumentAttribute( - databaseId: String, - collectionId: String, - documentId: String, - attribute: String, - value: Double? = null, - max: Double? = null, - transactionId: String? = null, - nestedType: Class, - ): io.appwrite.models.Document { - val apiPath = "/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment" - .replace("{databaseId}", databaseId) - .replace("{collectionId}", collectionId) - .replace("{documentId}", documentId) - .replace("{attribute}", attribute) - - val apiParams = mutableMapOf( - "value" to value, - "max" to max, - "transactionId" to transactionId, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Document = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Document.from(map = it as Map, nestedType) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Increment a specific column of a row by a given value. - * - * @param databaseId Database ID. - * @param collectionId Collection ID. - * @param documentId Document ID. - * @param attribute Attribute key. - * @param value Value to increment the attribute by. The value must be a number. - * @param max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. - * @param transactionId Transaction ID for staging the operation. - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun incrementDocumentAttribute( - databaseId: String, - collectionId: String, - documentId: String, - attribute: String, - value: Double? = null, - max: Double? = null, - transactionId: String? = null, - ): io.appwrite.models.Document> = incrementDocumentAttribute( - databaseId, - collectionId, - documentId, - attribute, - value, - max, - transactionId, - nestedType = classOf(), - ) - -} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/services/VectorsDB.kt b/library/src/main/java/io/appwrite/services/VectorsDB.kt deleted file mode 100644 index 3bdb74be..00000000 --- a/library/src/main/java/io/appwrite/services/VectorsDB.kt +++ /dev/null @@ -1,628 +0,0 @@ -package io.appwrite.services - -import android.net.Uri -import io.appwrite.Client -import io.appwrite.Service -import io.appwrite.models.* -import io.appwrite.exceptions.AppwriteException -import io.appwrite.extensions.classOf -import okhttp3.Cookie -import java.io.File - -/** - * - */ -class VectorsDB(client: Client) : Service(client) { - - /** - * - * - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). - * @return [io.appwrite.models.TransactionList] - */ - @JvmOverloads - suspend fun listTransactions( - queries: List? = null, - ): io.appwrite.models.TransactionList { - val apiPath = "/vectorsdb/transactions" - - val apiParams = mutableMapOf( - "queries" to queries, - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.TransactionList = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.TransactionList.from(map = it as Map) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.TransactionList::class.java, - converter, - ) - } - - - /** - * - * - * @param ttl Seconds before the transaction expires. - * @return [io.appwrite.models.Transaction] - */ - @JvmOverloads - suspend fun createTransaction( - ttl: Long? = null, - ): io.appwrite.models.Transaction { - val apiPath = "/vectorsdb/transactions" - - val apiParams = mutableMapOf( - "ttl" to ttl, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Transaction = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Transaction.from(map = it as Map) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.Transaction::class.java, - converter, - ) - } - - - /** - * - * - * @param transactionId Transaction ID. - * @return [io.appwrite.models.Transaction] - */ - suspend fun getTransaction( - transactionId: String, - ): io.appwrite.models.Transaction { - val apiPath = "/vectorsdb/transactions/{transactionId}" - .replace("{transactionId}", transactionId) - - val apiParams = mutableMapOf( - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.Transaction = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Transaction.from(map = it as Map) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.Transaction::class.java, - converter, - ) - } - - - /** - * - * - * @param transactionId Transaction ID. - * @param commit Commit transaction? - * @param rollback Rollback transaction? - * @return [io.appwrite.models.Transaction] - */ - @JvmOverloads - suspend fun updateTransaction( - transactionId: String, - commit: Boolean? = null, - rollback: Boolean? = null, - ): io.appwrite.models.Transaction { - val apiPath = "/vectorsdb/transactions/{transactionId}" - .replace("{transactionId}", transactionId) - - val apiParams = mutableMapOf( - "commit" to commit, - "rollback" to rollback, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Transaction = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Transaction.from(map = it as Map) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.Transaction::class.java, - converter, - ) - } - - - /** - * - * - * @param transactionId Transaction ID. - * @return [Any] - */ - suspend fun deleteTransaction( - transactionId: String, - ): Any { - val apiPath = "/vectorsdb/transactions/{transactionId}" - .replace("{transactionId}", transactionId) - - val apiParams = mutableMapOf( - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - return client.call( - "DELETE", - apiPath, - apiHeaders, - apiParams, - responseType = Any::class.java, - ) - } - - - /** - * - * - * @param transactionId Transaction ID. - * @param operations Array of staged operations. - * @return [io.appwrite.models.Transaction] - */ - @JvmOverloads - suspend fun createOperations( - transactionId: String, - operations: List? = null, - ): io.appwrite.models.Transaction { - val apiPath = "/vectorsdb/transactions/{transactionId}/operations" - .replace("{transactionId}", transactionId) - - val apiParams = mutableMapOf( - "operations" to operations, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Transaction = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Transaction.from(map = it as Map) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.Transaction::class.java, - converter, - ) - } - - - /** - * - * - * @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). - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param transactionId Transaction ID to read uncommitted changes within the transaction. - * @param total When set to false, the total count returned will be 0 and will not be calculated. - * @param ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). - * @return [io.appwrite.models.DocumentList] - */ - @JvmOverloads - suspend fun listDocuments( - databaseId: String, - collectionId: String, - queries: List? = null, - transactionId: String? = null, - total: Boolean? = null, - ttl: Long? = null, - nestedType: Class, - ): io.appwrite.models.DocumentList { - val apiPath = "/vectorsdb/{databaseId}/collections/{collectionId}/documents" - .replace("{databaseId}", databaseId) - .replace("{collectionId}", collectionId) - - val apiParams = mutableMapOf( - "queries" to queries, - "transactionId" to transactionId, - "total" to total, - "ttl" to ttl, - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.DocumentList = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.DocumentList.from(map = it as Map, nestedType) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * - * - * @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). - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param transactionId Transaction ID to read uncommitted changes within the transaction. - * @param total When set to false, the total count returned will be 0 and will not be calculated. - * @param ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). - * @return [io.appwrite.models.DocumentList] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun listDocuments( - databaseId: String, - collectionId: String, - queries: List? = null, - transactionId: String? = null, - total: Boolean? = null, - ttl: Long? = null, - ): io.appwrite.models.DocumentList> = listDocuments( - databaseId, - collectionId, - queries, - transactionId, - total, - ttl, - nestedType = classOf(), - ) - - /** - * - * - * @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 documentId Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param data Document data as JSON object. - * @param permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - suspend fun createDocument( - databaseId: String, - collectionId: String, - documentId: String, - data: Any, - permissions: List? = null, - nestedType: Class, - ): io.appwrite.models.Document { - val apiPath = "/vectorsdb/{databaseId}/collections/{collectionId}/documents" - .replace("{databaseId}", databaseId) - .replace("{collectionId}", collectionId) - - val apiParams = mutableMapOf( - "documentId" to documentId, - "data" to data, - "permissions" to permissions, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Document = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Document.from(map = it as Map, nestedType) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * - * - * @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 documentId Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param data Document data as JSON object. - * @param permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun createDocument( - databaseId: String, - collectionId: String, - documentId: String, - data: Any, - permissions: List? = null, - ): io.appwrite.models.Document> = createDocument( - databaseId, - collectionId, - documentId, - data, - permissions, - nestedType = classOf(), - ) - - /** - * - * - * @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). - * @param documentId Document ID. - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param transactionId Transaction ID to read uncommitted changes within the transaction. - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - suspend fun getDocument( - databaseId: String, - collectionId: String, - documentId: String, - queries: List? = null, - transactionId: String? = null, - nestedType: Class, - ): io.appwrite.models.Document { - val apiPath = "/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}" - .replace("{databaseId}", databaseId) - .replace("{collectionId}", collectionId) - .replace("{documentId}", documentId) - - val apiParams = mutableMapOf( - "queries" to queries, - "transactionId" to transactionId, - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.Document = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Document.from(map = it as Map, nestedType) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * - * - * @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). - * @param documentId Document ID. - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param transactionId Transaction ID to read uncommitted changes within the transaction. - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun getDocument( - databaseId: String, - collectionId: String, - documentId: String, - queries: List? = null, - transactionId: String? = null, - ): io.appwrite.models.Document> = getDocument( - databaseId, - collectionId, - documentId, - queries, - transactionId, - nestedType = classOf(), - ) - - /** - * - * - * @param databaseId Database ID. - * @param collectionId Collection ID. - * @param documentId Document ID. - * @param data Document data as JSON object. Include all required fields of the document to be created or updated. - * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param transactionId Transaction ID for staging the operation. - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - suspend fun upsertDocument( - databaseId: String, - collectionId: String, - documentId: String, - data: Any? = null, - permissions: List? = null, - transactionId: String? = null, - nestedType: Class, - ): io.appwrite.models.Document { - val apiPath = "/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}" - .replace("{databaseId}", databaseId) - .replace("{collectionId}", collectionId) - .replace("{documentId}", documentId) - - val apiParams = mutableMapOf( - "data" to data, - "permissions" to permissions, - "transactionId" to transactionId, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Document = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Document.from(map = it as Map, nestedType) - } - return client.call( - "PUT", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * - * - * @param databaseId Database ID. - * @param collectionId Collection ID. - * @param documentId Document ID. - * @param data Document data as JSON object. Include all required fields of the document to be created or updated. - * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param transactionId Transaction ID for staging the operation. - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun upsertDocument( - databaseId: String, - collectionId: String, - documentId: String, - data: Any? = null, - permissions: List? = null, - transactionId: String? = null, - ): io.appwrite.models.Document> = upsertDocument( - databaseId, - collectionId, - documentId, - data, - permissions, - transactionId, - nestedType = classOf(), - ) - - /** - * - * - * @param databaseId Database ID. - * @param collectionId Collection ID. - * @param documentId Document ID. - * @param data Document data as JSON object. Include only fields and value pairs to be updated. - * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param transactionId Transaction ID for staging the operation. - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - suspend fun updateDocument( - databaseId: String, - collectionId: String, - documentId: String, - data: Any? = null, - permissions: List? = null, - transactionId: String? = null, - nestedType: Class, - ): io.appwrite.models.Document { - val apiPath = "/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}" - .replace("{databaseId}", databaseId) - .replace("{collectionId}", collectionId) - .replace("{documentId}", documentId) - - val apiParams = mutableMapOf( - "data" to data, - "permissions" to permissions, - "transactionId" to transactionId, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Document = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Document.from(map = it as Map, nestedType) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * - * - * @param databaseId Database ID. - * @param collectionId Collection ID. - * @param documentId Document ID. - * @param data Document data as JSON object. Include only fields and value pairs to be updated. - * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param transactionId Transaction ID for staging the operation. - * @return [io.appwrite.models.Document] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updateDocument( - databaseId: String, - collectionId: String, - documentId: String, - data: Any? = null, - permissions: List? = null, - transactionId: String? = null, - ): io.appwrite.models.Document> = updateDocument( - databaseId, - collectionId, - documentId, - data, - permissions, - transactionId, - nestedType = classOf(), - ) - - /** - * - * - * @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). - * @param documentId Document ID. - * @param transactionId Transaction ID for staging the operation. - * @return [Any] - */ - @JvmOverloads - suspend fun deleteDocument( - databaseId: String, - collectionId: String, - documentId: String, - transactionId: String? = null, - ): Any { - val apiPath = "/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}" - .replace("{databaseId}", databaseId) - .replace("{collectionId}", collectionId) - .replace("{documentId}", documentId) - - val apiParams = mutableMapOf( - "transactionId" to transactionId, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - return client.call( - "DELETE", - apiPath, - apiHeaders, - apiParams, - responseType = Any::class.java, - ) - } - - -} \ No newline at end of file From 42f44f14274e3b245442d6278b9ff4d9ef47dfb0 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 26 Mar 2026 05:04:17 +0000 Subject: [PATCH 4/6] chore: update Android SDK to 13.0.0 --- .../java/databases/upsert-documents.md | 27 ------- .../kotlin/databases/upsert-documents.md | 18 ----- .../java/io/appwrite/services/Databases.kt | 76 ------------------- 3 files changed, 121 deletions(-) delete mode 100644 docs/examples/java/databases/upsert-documents.md delete mode 100644 docs/examples/kotlin/databases/upsert-documents.md diff --git a/docs/examples/java/databases/upsert-documents.md b/docs/examples/java/databases/upsert-documents.md deleted file mode 100644 index b3687f82..00000000 --- a/docs/examples/java/databases/upsert-documents.md +++ /dev/null @@ -1,27 +0,0 @@ -```java -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 - .setProject(""); // Your project ID - -Databases databases = new Databases(client); - -databases.upsertDocuments( - "", // databaseId - "", // collectionId - List.of(), // documents - "", // transactionId (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/kotlin/databases/upsert-documents.md b/docs/examples/kotlin/databases/upsert-documents.md deleted file mode 100644 index ac256884..00000000 --- a/docs/examples/kotlin/databases/upsert-documents.md +++ /dev/null @@ -1,18 +0,0 @@ -```kotlin -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 - .setProject("") // Your project ID - -val databases = Databases(client) - -val result = databases.upsertDocuments( - databaseId = "", - collectionId = "", - documents = listOf(), - transactionId = "", // (optional) -) -``` diff --git a/library/src/main/java/io/appwrite/services/Databases.kt b/library/src/main/java/io/appwrite/services/Databases.kt index f28fd177..dda11375 100644 --- a/library/src/main/java/io/appwrite/services/Databases.kt +++ b/library/src/main/java/io/appwrite/services/Databases.kt @@ -383,82 +383,6 @@ class Databases(client: Client) : Service(client) { nestedType = classOf(), ) - /** - * 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. - * - * - * @param databaseId Database ID. - * @param collectionId Collection ID. - * @param documents Array of document data as JSON objects. May contain partial documents. - * @param transactionId Transaction ID for staging the operation. - * @return [io.appwrite.models.DocumentList] - */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead.", - replaceWith = ReplaceWith("io.appwrite.services.TablesDB.upsertRows") - ) - @JvmOverloads - suspend fun upsertDocuments( - databaseId: String, - collectionId: String, - documents: List, - transactionId: String? = null, - 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, - "transactionId" to transactionId, - ) - 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( - "PUT", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * 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. - * - * - * @param databaseId Database ID. - * @param collectionId Collection ID. - * @param documents Array of document data as JSON objects. May contain partial documents. - * @param transactionId Transaction ID for staging the operation. - * @return [io.appwrite.models.DocumentList] - */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead.", - replaceWith = ReplaceWith("io.appwrite.services.TablesDB.upsertRows") - ) - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun upsertDocuments( - databaseId: String, - collectionId: String, - documents: List, - transactionId: String? = null, - ): io.appwrite.models.DocumentList> = upsertDocuments( - databaseId, - collectionId, - documents, - transactionId, - nestedType = classOf(), - ) - /** * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. * From df364dc846607be635ef10adb62a5bb5d22bed85 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 26 Mar 2026 05:16:05 +0000 Subject: [PATCH 5/6] chore: update Android SDK to 13.0.0 --- CHANGELOG.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e850f0f..a4483f07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,12 @@ ## 13.0.0 -* [BREAKING] Changed `$sequence` type from `int` to `string` for rows and documents -* Updated server compatibility note to Appwrite server version 1.8.x -* Updated Gradle/Maven dependencies to `12.1.0` -* Updated API version badge to `1.9.0` in README +* [BREAKING] Changed `$sequence` type from `Long` to `String` for `Row` and `Document` models +* Added impersonation support: `setImpersonateUserId()`, `setImpersonateUserEmail()`, `setImpersonateUserPhone()` on `Client` +* Added `impersonator` and `impersonatorUserId` optional fields to `User` model +* Updated `Log` model field descriptions to clarify impersonation behavior for `userId`, `userEmail`, `userName` +* Updated `X-Appwrite-Response-Format` header to `1.9.0` +* Updated API version badge to `1.9.0` and compatibility note to server version `1.9.x` in README ## 12.1.0 From e7e784c2e2057cb880fab0ca87c10960a3499ab1 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 26 Mar 2026 05:37:23 +0000 Subject: [PATCH 6/6] chore: update Android SDK to 14.0.0 --- CHANGELOG.md | 10 +++++++++- README.md | 4 ++-- library/src/main/java/io/appwrite/Client.kt | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4483f07..f31170b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## 13.0.0 +## 14.0.0 * [BREAKING] Changed `$sequence` type from `Long` to `String` for `Row` and `Document` models * Added impersonation support: `setImpersonateUserId()`, `setImpersonateUserEmail()`, `setImpersonateUserPhone()` on `Client` @@ -9,6 +9,14 @@ * Updated `X-Appwrite-Response-Format` header to `1.9.0` * Updated API version badge to `1.9.0` and compatibility note to server version `1.9.x` in README +## 13.0.0 + +* Breaking: Channel factory methods require explicit IDs (no wildcard defaults) +* Added ttl parameter to listDocuments and listRows for caching +* Updated x-sdk-version header to 12.2.1 in Client +* Updated docs and examples to show TTL usage and latest compatibility note +* Updated Document and Row sequence descriptions in models + ## 12.1.0 * Add `queries` parameter to Realtime subscriptions for filtering events diff --git a/README.md b/README.md index b9270d72..05d1ef38 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ repositories { Next, add the dependency to your project's `build.gradle(.kts)` file: ```groovy -implementation("io.appwrite:sdk-for-android:13.0.0") +implementation("io.appwrite:sdk-for-android:14.0.0") ``` ### Maven @@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-android - 13.0.0 + 14.0.0 ``` diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt index e5ed6080..c894033e 100644 --- a/library/src/main/java/io/appwrite/Client.kt +++ b/library/src/main/java/io/appwrite/Client.kt @@ -87,7 +87,7 @@ class Client @JvmOverloads constructor( "x-sdk-name" to "Android", "x-sdk-platform" to "client", "x-sdk-language" to "android", - "x-sdk-version" to "13.0.0", + "x-sdk-version" to "14.0.0", "x-appwrite-response-format" to "1.9.0" ) config = mutableMapOf()