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 f8dab1a..957018d 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@


-
+
[](https://travis-ci.com/appwrite/sdk-generator)
[](https://twitter.com/appwrite)
[](https://appwrite.io/discord)
@@ -38,7 +38,7 @@ repositories {
Next, add the dependency to your project's `build.gradle(.kts)` file:
```groovy
-implementation("io.appwrite:sdk-for-android:6.0.0")
+implementation("io.appwrite:sdk-for-android:6.1.1")
```
### Maven
@@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file:
io.appwrite
sdk-for-android
- 6.0.0
+ 6.1.1
```
diff --git a/example/src/main/java/io/appwrite/android/ui/accounts/AccountsViewModel.kt b/example/src/main/java/io/appwrite/android/ui/accounts/AccountsViewModel.kt
index f53113d..4302327 100644
--- a/example/src/main/java/io/appwrite/android/ui/accounts/AccountsViewModel.kt
+++ b/example/src/main/java/io/appwrite/android/ui/accounts/AccountsViewModel.kt
@@ -81,8 +81,8 @@ class AccountsViewModel : ViewModel() {
account.createOAuth2Session(
activity,
OAuthProvider.FACEBOOK,
- "appwrite-callback-6070749e6acd4://demo.appwrite.io/auth/oauth2/success",
- "appwrite-callback-6070749e6acd4://demo.appwrite.io/auth/oauth2/failure"
+ "appwrite-callback-6070749e6acd4://cloud.appwrite.io/auth/oauth2/success",
+ "appwrite-callback-6070749e6acd4://cloud.appwrite.io/auth/oauth2/failure"
)
} catch (e: Exception) {
_error.postValue(Event(e))
diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt
index 93a3e06..b7d698e 100644
--- a/library/src/main/java/io/appwrite/Client.kt
+++ b/library/src/main/java/io/appwrite/Client.kt
@@ -60,7 +60,7 @@ class Client @JvmOverloads constructor(
internal lateinit var http: OkHttpClient
internal val headers: MutableMap
-
+
val config: MutableMap
internal val cookieJar = ListenableCookieJar(CookieManager(
@@ -86,11 +86,11 @@ class Client @JvmOverloads constructor(
"x-sdk-name" to "Android",
"x-sdk-platform" to "client",
"x-sdk-language" to "android",
- "x-sdk-version" to "6.0.0",
+ "x-sdk-version" to "6.1.1",
"x-appwrite-response-format" to "1.6.0"
)
config = mutableMapOf()
-
+
setSelfSigned(selfSigned)
}
@@ -154,10 +154,10 @@ class Client @JvmOverloads constructor(
/**
* Set self Signed
- *
+ *
* @param status
*
- * @return this
+ * @return this
*/
fun setSelfSigned(status: Boolean): Client {
selfSigned = status
@@ -206,10 +206,10 @@ class Client @JvmOverloads constructor(
/**
* Set endpoint and realtime endpoint.
- *
+ *
* @param endpoint
*
- * @return this
+ * @return this
*/
fun setEndpoint(endpoint: String): Client {
this.endpoint = endpoint
@@ -235,32 +235,51 @@ class Client @JvmOverloads constructor(
/**
* Add Header
- *
+ *
* @param key
* @param value
*
- * @return this
+ * @return this
*/
fun addHeader(key: String, value: String): Client {
headers[key] = value
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
+ )
+ }
+
/**
* Send the HTTP request
- *
+ *
* @param method
* @param path
* @param headers
* @param params
*
- * @return [T]
+ * @return [T]
*/
@Throws(AppwriteException::class)
suspend fun call(
- method: String,
- path: String,
- headers: Map = mapOf(),
+ method: String,
+ path: String,
+ headers: Map = mapOf(),
params: Map = mapOf(),
responseType: Class,
converter: ((Any) -> T)? = null
@@ -398,7 +417,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",
@@ -495,14 +514,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