Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 14.1.0

* Added `getHeaders()` method to `Client` for accessing current request headers
* Added `getCookies(url)` method to `Client` for retrieving cookies from the cookie store
* Added `getHttpClient()` method to `Client` for accessing the underlying OkHttpClient instance

## 14.0.0

* [BREAKING] Changed `$sequence` type from `Long` to `String` for `Row` and `Document` models
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ repositories {
Next, add the dependency to your project's `build.gradle(.kts)` file:

```groovy
implementation("io.appwrite:sdk-for-android:14.0.0")
implementation("io.appwrite:sdk-for-android:14.1.0")
```

### Maven
Expand All @@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file:
<dependency>
<groupId>io.appwrite</groupId>
<artifactId>sdk-for-android</artifactId>
<version>14.0.0</version>
<version>14.1.0</version>
</dependency>
</dependencies>
```
Expand Down
24 changes: 23 additions & 1 deletion library/src/main/java/io/appwrite/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "14.0.0",
"x-sdk-version" to "14.1.0",
"x-appwrite-response-format" to "1.9.0"
)
config = mutableMapOf()
Expand Down Expand Up @@ -314,6 +314,28 @@ class Client @JvmOverloads constructor(
return this
}

/**
* Get the current request headers used for Appwrite API calls.
*
* @return a copy of the current request headers
*/
fun getHeaders(): Map<String, String> = headers.toMap()

/**
* Get the cookies for a given URL from the SDK's cookie store.
*
* @param url the URL to retrieve cookies for
* @return a list of cookies for the given URL
*/
fun getCookies(url: String): List<Cookie> = cookieJar.loadForRequest(url.toHttpUrl())

/**
* Get the OkHttpClient instance used by this SDK.
*
* @return the OkHttpClient instance used by this client
*/
fun getHttpClient(): OkHttpClient = http

/**
* Sends a "ping" request to Appwrite to verify connectivity.
*
Expand Down