Skip to content

Dev #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 18, 2025
Merged

Dev #76

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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

![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.6.2-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.7.0-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)

**This SDK is compatible with Appwrite server version 1.6.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-android/releases).**
**This SDK is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-android/releases).**

Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Android SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)

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:7.0.1")
implementation("io.appwrite:sdk-for-android:8.0.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>7.0.1</version>
<version>8.0.0</version>
</dependency>
</dependencies>
```
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/java/avatars/get-browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ avatars.getBrowser(
Browser.AVANT_BROWSER, // code
0, // width (optional)
0, // height (optional)
0, // quality (optional)
-1, // quality (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/java/avatars/get-credit-card.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ avatars.getCreditCard(
CreditCard.AMERICAN_EXPRESS, // code
0, // width (optional)
0, // height (optional)
0, // quality (optional)
-1, // quality (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/java/avatars/get-flag.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ avatars.getFlag(
Flag.AFGHANISTAN, // code
0, // width (optional)
0, // height (optional)
0, // quality (optional)
-1, // quality (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
Expand Down
4 changes: 3 additions & 1 deletion docs/examples/java/databases/create-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ 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
.setSession("") // The user session to authenticate with
.setKey("") //
.setJWT("<YOUR_JWT>"); // Your secret JSON Web Token

Databases databases = new Databases(client);

Expand Down
1 change: 0 additions & 1 deletion docs/examples/java/functions/list-executions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Functions functions = new Functions(client);
functions.listExecutions(
"<FUNCTION_ID>", // functionId
listOf(), // queries (optional)
"<SEARCH>", // search (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
Expand Down
1 change: 1 addition & 0 deletions docs/examples/java/storage/get-file-download.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Storage storage = new Storage(client);
storage.getFileDownload(
"<BUCKET_ID>", // bucketId
"<FILE_ID>", // fileId
"<TOKEN>", // token (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/java/storage/get-file-preview.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ storage.getFilePreview(
0, // width (optional)
0, // height (optional)
ImageGravity.CENTER, // gravity (optional)
0, // quality (optional)
-1, // quality (optional)
0, // borderWidth (optional)
"", // borderColor (optional)
0, // borderRadius (optional)
0, // opacity (optional)
-360, // rotation (optional)
"", // background (optional)
ImageFormat.JPG, // output (optional)
"<TOKEN>", // token (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
Expand Down
1 change: 1 addition & 0 deletions docs/examples/java/storage/get-file-view.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Storage storage = new Storage(client);
storage.getFileView(
"<BUCKET_ID>", // bucketId
"<FILE_ID>", // fileId
"<TOKEN>", // token (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/kotlin/avatars/get-browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ val result = avatars.getBrowser(
code = Browser.AVANT_BROWSER,
width = 0, // (optional)
height = 0, // (optional)
quality = 0, // (optional)
quality = -1, // (optional)
)
2 changes: 1 addition & 1 deletion docs/examples/kotlin/avatars/get-credit-card.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ val result = avatars.getCreditCard(
code = CreditCard.AMERICAN_EXPRESS,
width = 0, // (optional)
height = 0, // (optional)
quality = 0, // (optional)
quality = -1, // (optional)
)
2 changes: 1 addition & 1 deletion docs/examples/kotlin/avatars/get-flag.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ val result = avatars.getFlag(
code = Flag.AFGHANISTAN,
width = 0, // (optional)
height = 0, // (optional)
quality = 0, // (optional)
quality = -1, // (optional)
)
4 changes: 3 additions & 1 deletion docs/examples/kotlin/databases/create-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ 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
.setSession("") // The user session to authenticate with
.setKey("") //
.setJWT("<YOUR_JWT>") // Your secret JSON Web Token

val databases = Databases(client)

Expand Down
1 change: 0 additions & 1 deletion docs/examples/kotlin/functions/list-executions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ val functions = Functions(client)
val result = functions.listExecutions(
functionId = "<FUNCTION_ID>",
queries = listOf(), // (optional)
search = "<SEARCH>", // (optional)
)
1 change: 1 addition & 0 deletions docs/examples/kotlin/storage/get-file-download.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ val storage = Storage(client)
val result = storage.getFileDownload(
bucketId = "<BUCKET_ID>",
fileId = "<FILE_ID>",
token = "<TOKEN>", // (optional)
)
3 changes: 2 additions & 1 deletion docs/examples/kotlin/storage/get-file-preview.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ val result = storage.getFilePreview(
width = 0, // (optional)
height = 0, // (optional)
gravity = ImageGravity.CENTER, // (optional)
quality = 0, // (optional)
quality = -1, // (optional)
borderWidth = 0, // (optional)
borderColor = "", // (optional)
borderRadius = 0, // (optional)
opacity = 0, // (optional)
rotation = -360, // (optional)
background = "", // (optional)
output = ImageFormat.JPG, // (optional)
token = "<TOKEN>", // (optional)
)
1 change: 1 addition & 0 deletions docs/examples/kotlin/storage/get-file-view.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ val storage = Storage(client)
val result = storage.getFileView(
bucketId = "<BUCKET_ID>",
fileId = "<FILE_ID>",
token = "<TOKEN>", // (optional)
)
4 changes: 2 additions & 2 deletions library/src/main/java/io/appwrite/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class Client @JvmOverloads constructor(
"x-sdk-name" to "Android",
"x-sdk-platform" to "client",
"x-sdk-language" to "android",
"x-sdk-version" to "7.0.1",
"x-appwrite-response-format" to "1.6.0"
"x-sdk-version" to "8.0.0",
"x-appwrite-response-format" to "1.7.0"
)
config = mutableMapOf()

Expand Down
2 changes: 0 additions & 2 deletions library/src/main/java/io/appwrite/enums/ImageFormat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ enum class ImageFormat(val value: String) {
JPG("jpg"),
@SerializedName("jpeg")
JPEG("jpeg"),
@SerializedName("gif")
GIF("gif"),
@SerializedName("png")
PNG("png"),
@SerializedName("webp")
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/java/io/appwrite/models/Execution.kt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ data class Execution(
val errors: String,

/**
* Function execution duration in seconds.
* Resource(function/site) execution duration in seconds.
*/
@SerializedName("duration")
val duration: Double,
Expand Down
6 changes: 3 additions & 3 deletions library/src/main/java/io/appwrite/services/Avatars.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Avatars(client: Client) : Service(client) {
* @param code Browser Code.
* @param width Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param height Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
* @param quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @return [ByteArray]
*/
@JvmOverloads
Expand Down Expand Up @@ -57,7 +57,7 @@ class Avatars(client: Client) : Service(client) {
* @param code Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro, rupay.
* @param width Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param height Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
* @param quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @return [ByteArray]
*/
@JvmOverloads
Expand Down Expand Up @@ -115,7 +115,7 @@ class Avatars(client: Client) : Service(client) {
* @param code Country Code. ISO Alpha-2 country code format.
* @param width Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param height Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
* @param quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @return [ByteArray]
*/
@JvmOverloads
Expand Down
3 changes: 0 additions & 3 deletions library/src/main/java/io/appwrite/services/Functions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,18 @@ class Functions(client: Client) : Service(client) {
*
* @param functionId Function ID.
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
* @param search Search term to filter your list results. Max length: 256 chars.
* @return [io.appwrite.models.ExecutionList]
*/
@JvmOverloads
suspend fun listExecutions(
functionId: String,
queries: List<String>? = null,
search: String? = null,
): io.appwrite.models.ExecutionList {
val apiPath = "/functions/{functionId}/executions"
.replace("{functionId}", functionId)

val apiParams = mutableMapOf<String, Any?>(
"queries" to queries,
"search" to search,
)
val apiHeaders = mutableMapOf<String, String>(
)
Expand Down
13 changes: 12 additions & 1 deletion library/src/main/java/io/appwrite/services/Storage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,21 @@ class Storage(client: Client) : Service(client) {
*
* @param bucketId Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param fileId File ID.
* @param token File token for accessing this file.
* @return [ByteArray]
*/
@JvmOverloads
suspend fun getFileDownload(
bucketId: String,
fileId: String,
token: String? = null,
): ByteArray {
val apiPath = "/storage/buckets/{bucketId}/files/{fileId}/download"
.replace("{bucketId}", bucketId)
.replace("{fileId}", fileId)

val apiParams = mutableMapOf<String, Any?>(
"token" to token,
"project" to client.config["project"],
)
return client.call(
Expand All @@ -243,14 +247,15 @@ class Storage(client: Client) : Service(client) {
* @param width Resize preview image width, Pass an integer between 0 to 4000.
* @param height Resize preview image height, Pass an integer between 0 to 4000.
* @param gravity Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
* @param quality Preview image quality. Pass an integer between 0 to 100. Defaults to 100.
* @param quality Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @param borderWidth Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.
* @param borderColor Preview image border color. Use a valid HEX color, no # is needed for prefix.
* @param borderRadius Preview image border radius in pixels. Pass an integer between 0 to 4000.
* @param opacity Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.
* @param rotation Preview image rotation in degrees. Pass an integer between -360 and 360.
* @param background Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.
* @param output Output format type (jpeg, jpg, png, gif and webp).
* @param token File token for accessing this file.
* @return [ByteArray]
*/
@JvmOverloads
Expand All @@ -268,6 +273,7 @@ class Storage(client: Client) : Service(client) {
rotation: Long? = null,
background: String? = null,
output: io.appwrite.enums.ImageFormat? = null,
token: String? = null,
): ByteArray {
val apiPath = "/storage/buckets/{bucketId}/files/{fileId}/preview"
.replace("{bucketId}", bucketId)
Expand All @@ -285,6 +291,7 @@ class Storage(client: Client) : Service(client) {
"rotation" to rotation,
"background" to background,
"output" to output,
"token" to token,
"project" to client.config["project"],
)
return client.call(
Expand All @@ -301,17 +308,21 @@ class Storage(client: Client) : Service(client) {
*
* @param bucketId Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param fileId File ID.
* @param token File token for accessing this file.
* @return [ByteArray]
*/
@JvmOverloads
suspend fun getFileView(
bucketId: String,
fileId: String,
token: String? = null,
): ByteArray {
val apiPath = "/storage/buckets/{bucketId}/files/{fileId}/view"
.replace("{bucketId}", bucketId)
.replace("{fileId}", fileId)

val apiParams = mutableMapOf<String, Any?>(
"token" to token,
"project" to client.config["project"],
)
return client.call(
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/java/io/appwrite/services/Teams.kt
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class Teams(client: Client) : Service(client) {
* Use this endpoint to list a team&#039;s members using the team&#039;s ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console.
*
* @param teamId Team ID.
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles
* @param search Search term to filter your list results. Max length: 256 chars.
* @return [io.appwrite.models.MembershipList]
*/
Expand Down