diff --git a/LICENSE.md b/LICENSE.md
index 5479bb8..c1602fc 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,4 +1,4 @@
-Copyright (c) 2024 Appwrite (https://appwrite.io) and individual contributors.
+Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
diff --git a/README.md b/README.md
index bddbe28..579a046 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
![Maven Central](https://img.shields.io/maven-central/v/io.appwrite/sdk-for-kotlin.svg?color=green&style=flat-square)
![License](https://img.shields.io/github/license/appwrite/sdk-for-kotlin.svg?style=flat-square)
-![Version](https://img.shields.io/badge/api%20version-1.6.0-blue.svg?style=flat-square)
+![Version](https://img.shields.io/badge/api%20version-1.6.1-blue.svg?style=flat-square)
[![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)
@@ -39,7 +39,7 @@ repositories {
Next, add the dependency to your project's `build.gradle(.kts)` file:
```groovy
-implementation("io.appwrite:sdk-for-kotlin:6.1.0")
+implementation("io.appwrite:sdk-for-kotlin:6.2.1")
```
### Maven
@@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file:
io.appwrite
sdk-for-kotlin
- 6.1.0
+ 6.2.1
```
diff --git a/docs/examples/java/databases/update-string-attribute.md b/docs/examples/java/databases/update-string-attribute.md
index 75be9e0..2d69006 100644
--- a/docs/examples/java/databases/update-string-attribute.md
+++ b/docs/examples/java/databases/update-string-attribute.md
@@ -15,7 +15,7 @@ databases.updateStringAttribute(
"", // key
false, // required
"", // default
- 0, // size (optional)
+ 1, // size (optional)
"", // newKey (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
diff --git a/docs/examples/java/messaging/create-push.md b/docs/examples/java/messaging/create-push.md
index 934f1fa..56c7a60 100644
--- a/docs/examples/java/messaging/create-push.md
+++ b/docs/examples/java/messaging/create-push.md
@@ -11,8 +11,8 @@ Messaging messaging = new Messaging(client);
messaging.createPush(
"", // messageId
- "", // title
- "", // body
+ "", // title (optional)
+ "", // body (optional)
listOf(), // topics (optional)
listOf(), // users (optional)
listOf(), // targets (optional)
@@ -23,9 +23,12 @@ messaging.createPush(
"", // sound (optional)
"", // color (optional)
"", // tag (optional)
- "", // badge (optional)
+ 0, // badge (optional)
false, // draft (optional)
"", // scheduledAt (optional)
+ false, // contentAvailable (optional)
+ false, // critical (optional)
+ MessagePriority.NORMAL, // priority (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/messaging/update-push.md b/docs/examples/java/messaging/update-push.md
index ef04203..bb8c3c8 100644
--- a/docs/examples/java/messaging/update-push.md
+++ b/docs/examples/java/messaging/update-push.md
@@ -26,6 +26,9 @@ messaging.updatePush(
0, // badge (optional)
false, // draft (optional)
"", // scheduledAt (optional)
+ false, // contentAvailable (optional)
+ false, // critical (optional)
+ MessagePriority.NORMAL, // priority (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/kotlin/databases/update-string-attribute.md b/docs/examples/kotlin/databases/update-string-attribute.md
index a37d456..32e17be 100644
--- a/docs/examples/kotlin/databases/update-string-attribute.md
+++ b/docs/examples/kotlin/databases/update-string-attribute.md
@@ -15,6 +15,6 @@ val response = databases.updateStringAttribute(
key = "",
required = false,
default = "",
- size = 0, // optional
+ size = 1, // optional
newKey = "" // optional
)
diff --git a/docs/examples/kotlin/messaging/create-push.md b/docs/examples/kotlin/messaging/create-push.md
index 6a95f63..f92a49d 100644
--- a/docs/examples/kotlin/messaging/create-push.md
+++ b/docs/examples/kotlin/messaging/create-push.md
@@ -11,8 +11,8 @@ val messaging = Messaging(client)
val response = messaging.createPush(
messageId = "",
- title = "",
- body = "",
+ title = "", // optional
+ body = "", // optional
topics = listOf(), // optional
users = listOf(), // optional
targets = listOf(), // optional
@@ -23,7 +23,10 @@ val response = messaging.createPush(
sound = "", // optional
color = "", // optional
tag = "", // optional
- badge = "", // optional
+ badge = 0, // optional
draft = false, // optional
- scheduledAt = "" // optional
+ scheduledAt = "", // optional
+ contentAvailable = false, // optional
+ critical = false, // optional
+ priority = "normal" // optional
)
diff --git a/docs/examples/kotlin/messaging/update-push.md b/docs/examples/kotlin/messaging/update-push.md
index d91694e..0ba72c4 100644
--- a/docs/examples/kotlin/messaging/update-push.md
+++ b/docs/examples/kotlin/messaging/update-push.md
@@ -25,5 +25,8 @@ val response = messaging.updatePush(
tag = "", // optional
badge = 0, // optional
draft = false, // optional
- scheduledAt = "" // optional
+ scheduledAt = "", // optional
+ contentAvailable = false, // optional
+ critical = false, // optional
+ priority = "normal" // optional
)
diff --git a/src/main/kotlin/io/appwrite/Client.kt b/src/main/kotlin/io/appwrite/Client.kt
index 8c18320..8c790ff 100644
--- a/src/main/kotlin/io/appwrite/Client.kt
+++ b/src/main/kotlin/io/appwrite/Client.kt
@@ -57,11 +57,11 @@ class Client @JvmOverloads constructor(
init {
headers = mutableMapOf(
"content-type" to "application/json",
- "user-agent" to "AppwriteKotlinSDK/6.1.0 ${System.getProperty("http.agent")}",
+ "user-agent" to "AppwriteKotlinSDK/6.2.1 ${System.getProperty("http.agent")}",
"x-sdk-name" to "Kotlin",
"x-sdk-platform" to "server",
"x-sdk-language" to "kotlin",
- "x-sdk-version" to "6.1.0",
+ "x-sdk-version" to "6.2.1",
"x-appwrite-response-format" to "1.6.0",
)
@@ -235,9 +235,28 @@ class Client @JvmOverloads constructor(
return this
}
+ /**
+ * Sends a "ping" request to Appwrite to verify connectivity.
+ *
+ * @return String
+ */
+ suspend fun ping(): String {
+ val apiPath = "/ping"
+ val apiParams = mutableMapOf()
+ val apiHeaders = mutableMapOf("content-type" to "application/json")
+
+ return call(
+ "GET",
+ apiPath,
+ apiHeaders,
+ apiParams,
+ responseType = String::class.java
+ )
+ }
+
/**
* Prepare the HTTP request
- *
+ *
* @param method
* @param path
* @param headers
@@ -332,7 +351,7 @@ class Client @JvmOverloads constructor(
* @param headers
* @param params
*
- * @return [T]
+ * @return [T]
*/
@Throws(AppwriteException::class)
suspend fun call(
@@ -355,7 +374,7 @@ class Client @JvmOverloads constructor(
* @param headers
* @param params
*
- * @return [T]
+ * @return [T]
*/
@Throws(AppwriteException::class)
suspend fun redirect(
@@ -427,7 +446,7 @@ class Client @JvmOverloads constructor(
var offset = 0L
var result: Map<*, *>? = null
- if (idParamName?.isNotEmpty() == true && params[idParamName] != "unique()") {
+ if (idParamName?.isNotEmpty() == true) {
// Make a request to check if a file already exists
val current = call(
method = "GET",
@@ -494,7 +513,7 @@ class Client @JvmOverloads constructor(
return converter(result as Map)
}
- /**
+ /**
* Await Redirect
*
* @param request
@@ -521,14 +540,14 @@ class Client @JvmOverloads constructor(
.charStream()
.buffered()
.use(BufferedReader::readText)
-
+
val error = if (response.headers["content-type"]?.contains("application/json") == true) {
val map = body.fromJson