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
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
# Change Log

## 8.2.0

* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Add `gif` support to `ImageFormat` enum
* Add `sequence` support to `Document` model

## 8.1.0

* Add `devKeys` support to `Client` service
* Add `upsertDocument` support to `Databases` service

## 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
* Remove `search` param from `listExecutions` method

## 7.0.1

* Fix requests failing by removing `Content-Type` header from `GET` and `HEAD` requests
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![Maven Central](https://img.shields.io/maven-central/v/io.appwrite/sdk-for-android.svg?color=green&style=flat-square)
![License](https://img.shields.io/github/license/appwrite/sdk-for-android.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.7.0-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![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)
Expand Down 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:8.1.0")
implementation("io.appwrite:sdk-for-android:8.2.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>8.1.0</version>
<version>8.2.0</version>
</dependency>
</dependencies>
```
Expand Down
4 changes: 1 addition & 3 deletions docs/examples/java/databases/create-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import io.appwrite.services.Databases;

Client client = new Client(context)
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setSession("") // The user session to authenticate with
.setKey("") //
.setJWT("<YOUR_JWT>"); // Your secret JSON Web Token
.setProject("<YOUR_PROJECT_ID>"); // Your project ID

Databases databases = new Databases(client);

Expand Down
27 changes: 27 additions & 0 deletions docs/examples/java/databases/decrement-document-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Databases;

Client client = new Client(context)
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>"); // Your project ID

Databases databases = new Databases(client);

databases.decrementDocumentAttribute(
"<DATABASE_ID>", // databaseId
"<COLLECTION_ID>", // collectionId
"<DOCUMENT_ID>", // documentId
"", // attribute
0, // value (optional)
0, // min (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}

Log.d("Appwrite", result.toString());
})
);

27 changes: 27 additions & 0 deletions docs/examples/java/databases/increment-document-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Databases;

Client client = new Client(context)
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>"); // Your project ID

Databases databases = new Databases(client);

databases.incrementDocumentAttribute(
"<DATABASE_ID>", // databaseId
"<COLLECTION_ID>", // collectionId
"<DOCUMENT_ID>", // documentId
"", // attribute
0, // value (optional)
0, // max (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}

Log.d("Appwrite", result.toString());
})
);

4 changes: 1 addition & 3 deletions docs/examples/kotlin/databases/create-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import io.appwrite.services.Databases

val client = Client(context)
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setSession("") // The user session to authenticate with
.setKey("") //
.setJWT("<YOUR_JWT>") // Your secret JSON Web Token
.setProject("<YOUR_PROJECT_ID>") // Your project ID

val databases = Databases(client)

Expand Down
18 changes: 18 additions & 0 deletions docs/examples/kotlin/databases/decrement-document-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Databases

val client = Client(context)
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

val databases = Databases(client)

val result = databases.decrementDocumentAttribute(
databaseId = "<DATABASE_ID>",
collectionId = "<COLLECTION_ID>",
documentId = "<DOCUMENT_ID>",
attribute = "",
value = 0, // (optional)
min = 0, // (optional)
)
18 changes: 18 additions & 0 deletions docs/examples/kotlin/databases/increment-document-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Databases

val client = Client(context)
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

val databases = Databases(client)

val result = databases.incrementDocumentAttribute(
databaseId = "<DATABASE_ID>",
collectionId = "<COLLECTION_ID>",
documentId = "<DOCUMENT_ID>",
attribute = "",
value = 0, // (optional)
max = 0, // (optional)
)
2 changes: 1 addition & 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 "8.1.0",
"x-sdk-version" to "8.2.0",
"x-appwrite-response-format" to "1.7.0"
)
config = mutableMapOf()
Expand Down
4 changes: 3 additions & 1 deletion library/src/main/java/io/appwrite/enums/ImageFormat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ enum class ImageFormat(val value: String) {
@SerializedName("heic")
HEIC("heic"),
@SerializedName("avif")
AVIF("avif");
AVIF("avif"),
@SerializedName("gif")
GIF("gif");

override fun toString() = value
}
10 changes: 10 additions & 0 deletions library/src/main/java/io/appwrite/models/Document.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ data class Document<T>(
@SerializedName("\$id")
val id: String,

/**
* Document automatically incrementing ID.
*/
@SerializedName("\$sequence")
val sequence: Long,

/**
* Collection ID.
*/
Expand Down Expand Up @@ -51,6 +57,7 @@ data class Document<T>(
) {
fun toMap(): Map<String, Any> = mapOf(
"\$id" to id as Any,
"\$sequence" to sequence as Any,
"\$collectionId" to collectionId as Any,
"\$databaseId" to databaseId as Any,
"\$createdAt" to createdAt as Any,
Expand All @@ -62,6 +69,7 @@ data class Document<T>(
companion object {
operator fun invoke(
id: String,
sequence: Long,
collectionId: String,
databaseId: String,
createdAt: String,
Expand All @@ -70,6 +78,7 @@ data class Document<T>(
data: Map<String, Any>
) = Document<Map<String, Any>>(
id,
sequence,
collectionId,
databaseId,
createdAt,
Expand All @@ -84,6 +93,7 @@ data class Document<T>(
nestedType: Class<T>
) = Document<T>(
id = map["\$id"] as String,
sequence = (map["\$sequence"] as Number).toLong(),
collectionId = map["\$collectionId"] as String,
databaseId = map["\$databaseId"] as String,
createdAt = map["\$createdAt"] as String,
Expand Down
Loading