diff --git a/CHANGELOG.md b/CHANGELOG.md
index fa4d35e..8406e63 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1 +1,8 @@
-# Change Log
\ No newline at end of file
+# Change Log
+
+## 8.0.0
+
+* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage
+* Update default `quality` for `getFilePreview` from 0 to -1
+* Remove `Gif` from ImageFormat enum
+* Remove `search` param from `listExecutions` method
\ No newline at end of file
diff --git a/README.md b/README.md
index f00352f..6bfc46c 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:8.0.0")
+implementation("io.appwrite:sdk-for-android:8.1.0")
```
### Maven
@@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file:
io.appwrite
sdk-for-android
- 8.0.0
+ 8.1.0
```
diff --git a/docs/examples/java/databases/upsert-document.md b/docs/examples/java/databases/upsert-document.md
new file mode 100644
index 0000000..868576b
--- /dev/null
+++ b/docs/examples/java/databases/upsert-document.md
@@ -0,0 +1,26 @@
+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.upsertDocument(
+ "", // databaseId
+ "", // collectionId
+ "", // documentId
+ mapOf( "a" to "b" ), // data
+ listOf("read("any")"), // permissions (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/kotlin/databases/upsert-document.md b/docs/examples/kotlin/databases/upsert-document.md
new file mode 100644
index 0000000..a31dfc8
--- /dev/null
+++ b/docs/examples/kotlin/databases/upsert-document.md
@@ -0,0 +1,17 @@
+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.upsertDocument(
+ databaseId = "",
+ collectionId = "",
+ documentId = "",
+ data = mapOf( "a" to "b" ),
+ permissions = listOf("read("any")"), // (optional)
+)
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt
index 7905e40..5f12d7f 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 "8.0.0",
+ "x-sdk-version" to "8.1.0",
"x-appwrite-response-format" to "1.7.0"
)
config = mutableMapOf()
@@ -153,6 +153,21 @@ class Client @JvmOverloads constructor(
return this
}
+ /**
+ * Set DevKey
+ *
+ * Your secret dev API key
+ *
+ * @param {string} devkey
+ *
+ * @return this
+ */
+ fun setDevKey(value: String): Client {
+ config["devKey"] = value
+ addHeader("x-appwrite-dev-key", value)
+ return this
+ }
+
/**
* Set self Signed
*
diff --git a/library/src/main/java/io/appwrite/services/Databases.kt b/library/src/main/java/io/appwrite/services/Databases.kt
index b6559a9..2601af2 100644
--- a/library/src/main/java/io/appwrite/services/Databases.kt
+++ b/library/src/main/java/io/appwrite/services/Databases.kt
@@ -211,6 +211,78 @@ class Databases(client: Client) : Service(client) {
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#databasesCreateCollection) 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 attributes 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).
+ * @return [io.appwrite.models.Document]
+ */
+ @JvmOverloads
+ suspend fun upsertDocument(
+ databaseId: String,
+ collectionId: String,
+ documentId: String,
+ data: Any,
+ permissions: List? = null,
+ nestedType: Class,
+ ): io.appwrite.models.Document {
+ val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}"
+ .replace("{databaseId}", databaseId)
+ .replace("{collectionId}", collectionId)
+ .replace("{documentId}", documentId)
+
+ val apiParams = mutableMapOf(
+ "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(
+ "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#databasesCreateCollection) 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 attributes 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).
+ * @return [io.appwrite.models.Document]
+ */
+ @JvmOverloads
+ @Throws(AppwriteException::class)
+ suspend fun upsertDocument(
+ databaseId: String,
+ collectionId: String,
+ documentId: String,
+ data: Any,
+ permissions: List? = null,
+ ): io.appwrite.models.Document