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 5786e19..be83985 100644
--- a/README.md
+++ b/README.md
@@ -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.2.0")
+implementation("io.appwrite:sdk-for-kotlin:7.0.0")
```
### Maven
@@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file:
io.appwrite
sdk-for-kotlin
- 6.2.0
+ 7.0.0
```
diff --git a/src/main/kotlin/io/appwrite/Client.kt b/src/main/kotlin/io/appwrite/Client.kt
index c8ff8d9..cf5e7c4 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.2.0 ${System.getProperty("http.agent")}",
+ "user-agent" to "AppwriteKotlinSDK/7.0.0 ${System.getProperty("http.agent")}",
"x-sdk-name" to "Kotlin",
"x-sdk-platform" to "server",
"x-sdk-language" to "kotlin",
- "x-sdk-version" to "6.2.0",
+ "x-sdk-version" to "7.0.0",
"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