diff --git a/README.md b/README.md index 9edac189..f00352f0 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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 @@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-android - 7.0.1 + 8.0.0 ``` diff --git a/docs/examples/java/avatars/get-browser.md b/docs/examples/java/avatars/get-browser.md index 4c857964..1b6632f3 100644 --- a/docs/examples/java/avatars/get-browser.md +++ b/docs/examples/java/avatars/get-browser.md @@ -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(); diff --git a/docs/examples/java/avatars/get-credit-card.md b/docs/examples/java/avatars/get-credit-card.md index a8bc3030..e2ac2c26 100644 --- a/docs/examples/java/avatars/get-credit-card.md +++ b/docs/examples/java/avatars/get-credit-card.md @@ -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(); diff --git a/docs/examples/java/avatars/get-flag.md b/docs/examples/java/avatars/get-flag.md index 61ced3b6..689e27fe 100644 --- a/docs/examples/java/avatars/get-flag.md +++ b/docs/examples/java/avatars/get-flag.md @@ -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(); diff --git a/docs/examples/java/databases/create-document.md b/docs/examples/java/databases/create-document.md index 4804d751..7fb129bb 100644 --- a/docs/examples/java/databases/create-document.md +++ b/docs/examples/java/databases/create-document.md @@ -4,7 +4,9 @@ import io.appwrite.services.Databases; Client client = new Client(context) .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID + .setSession("") // The user session to authenticate with + .setKey("") // + .setJWT(""); // Your secret JSON Web Token Databases databases = new Databases(client); diff --git a/docs/examples/java/functions/list-executions.md b/docs/examples/java/functions/list-executions.md index f23e5fb9..0270cf0e 100644 --- a/docs/examples/java/functions/list-executions.md +++ b/docs/examples/java/functions/list-executions.md @@ -11,7 +11,6 @@ Functions functions = new Functions(client); functions.listExecutions( "", // functionId listOf(), // queries (optional) - "", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/storage/get-file-download.md b/docs/examples/java/storage/get-file-download.md index ce2b846c..73a8617f 100644 --- a/docs/examples/java/storage/get-file-download.md +++ b/docs/examples/java/storage/get-file-download.md @@ -11,6 +11,7 @@ Storage storage = new Storage(client); storage.getFileDownload( "", // bucketId "", // fileId + "", // token (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/storage/get-file-preview.md b/docs/examples/java/storage/get-file-preview.md index 1f5e3653..67b92ebf 100644 --- a/docs/examples/java/storage/get-file-preview.md +++ b/docs/examples/java/storage/get-file-preview.md @@ -14,7 +14,7 @@ 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) @@ -22,6 +22,7 @@ storage.getFilePreview( -360, // rotation (optional) "", // background (optional) ImageFormat.JPG, // output (optional) + "", // token (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/storage/get-file-view.md b/docs/examples/java/storage/get-file-view.md index cda3545b..b042b1f4 100644 --- a/docs/examples/java/storage/get-file-view.md +++ b/docs/examples/java/storage/get-file-view.md @@ -11,6 +11,7 @@ Storage storage = new Storage(client); storage.getFileView( "", // bucketId "", // fileId + "", // token (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/kotlin/avatars/get-browser.md b/docs/examples/kotlin/avatars/get-browser.md index 4e2f5e09..d04adfbb 100644 --- a/docs/examples/kotlin/avatars/get-browser.md +++ b/docs/examples/kotlin/avatars/get-browser.md @@ -13,5 +13,5 @@ val result = avatars.getBrowser( code = Browser.AVANT_BROWSER, width = 0, // (optional) height = 0, // (optional) - quality = 0, // (optional) + quality = -1, // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/avatars/get-credit-card.md b/docs/examples/kotlin/avatars/get-credit-card.md index 91aae456..91c88da5 100644 --- a/docs/examples/kotlin/avatars/get-credit-card.md +++ b/docs/examples/kotlin/avatars/get-credit-card.md @@ -13,5 +13,5 @@ val result = avatars.getCreditCard( code = CreditCard.AMERICAN_EXPRESS, width = 0, // (optional) height = 0, // (optional) - quality = 0, // (optional) + quality = -1, // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/avatars/get-flag.md b/docs/examples/kotlin/avatars/get-flag.md index 1d8f5f63..1dbc1cdf 100644 --- a/docs/examples/kotlin/avatars/get-flag.md +++ b/docs/examples/kotlin/avatars/get-flag.md @@ -13,5 +13,5 @@ val result = avatars.getFlag( code = Flag.AFGHANISTAN, width = 0, // (optional) height = 0, // (optional) - quality = 0, // (optional) + quality = -1, // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/databases/create-document.md b/docs/examples/kotlin/databases/create-document.md index 849a636a..0bafb315 100644 --- a/docs/examples/kotlin/databases/create-document.md +++ b/docs/examples/kotlin/databases/create-document.md @@ -4,7 +4,9 @@ import io.appwrite.services.Databases val client = Client(context) .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + .setKey("") // + .setJWT("") // Your secret JSON Web Token val databases = Databases(client) diff --git a/docs/examples/kotlin/functions/list-executions.md b/docs/examples/kotlin/functions/list-executions.md index a56993fd..37ea8b82 100644 --- a/docs/examples/kotlin/functions/list-executions.md +++ b/docs/examples/kotlin/functions/list-executions.md @@ -11,5 +11,4 @@ val functions = Functions(client) val result = functions.listExecutions( functionId = "", queries = listOf(), // (optional) - search = "", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/get-file-download.md b/docs/examples/kotlin/storage/get-file-download.md index b4d33868..89c6e8a9 100644 --- a/docs/examples/kotlin/storage/get-file-download.md +++ b/docs/examples/kotlin/storage/get-file-download.md @@ -11,4 +11,5 @@ val storage = Storage(client) val result = storage.getFileDownload( bucketId = "", fileId = "", + token = "", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/get-file-preview.md b/docs/examples/kotlin/storage/get-file-preview.md index 31aa6e2c..d766dc71 100644 --- a/docs/examples/kotlin/storage/get-file-preview.md +++ b/docs/examples/kotlin/storage/get-file-preview.md @@ -14,7 +14,7 @@ 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) @@ -22,4 +22,5 @@ val result = storage.getFilePreview( rotation = -360, // (optional) background = "", // (optional) output = ImageFormat.JPG, // (optional) + token = "", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/get-file-view.md b/docs/examples/kotlin/storage/get-file-view.md index 7a5b31de..513e1f9a 100644 --- a/docs/examples/kotlin/storage/get-file-view.md +++ b/docs/examples/kotlin/storage/get-file-view.md @@ -11,4 +11,5 @@ val storage = Storage(client) val result = storage.getFileView( bucketId = "", fileId = "", + token = "", // (optional) ) \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt index 909e62f3..7905e403 100644 --- a/library/src/main/java/io/appwrite/Client.kt +++ b/library/src/main/java/io/appwrite/Client.kt @@ -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() diff --git a/library/src/main/java/io/appwrite/enums/ImageFormat.kt b/library/src/main/java/io/appwrite/enums/ImageFormat.kt index 7249f2a5..c3dea067 100644 --- a/library/src/main/java/io/appwrite/enums/ImageFormat.kt +++ b/library/src/main/java/io/appwrite/enums/ImageFormat.kt @@ -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") diff --git a/library/src/main/java/io/appwrite/models/Execution.kt b/library/src/main/java/io/appwrite/models/Execution.kt index 1b6226ae..216e1460 100644 --- a/library/src/main/java/io/appwrite/models/Execution.kt +++ b/library/src/main/java/io/appwrite/models/Execution.kt @@ -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, diff --git a/library/src/main/java/io/appwrite/services/Avatars.kt b/library/src/main/java/io/appwrite/services/Avatars.kt index 2900bf4c..55406cc6 100644 --- a/library/src/main/java/io/appwrite/services/Avatars.kt +++ b/library/src/main/java/io/appwrite/services/Avatars.kt @@ -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 @@ -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 @@ -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 diff --git a/library/src/main/java/io/appwrite/services/Functions.kt b/library/src/main/java/io/appwrite/services/Functions.kt index a3644f27..b3704486 100644 --- a/library/src/main/java/io/appwrite/services/Functions.kt +++ b/library/src/main/java/io/appwrite/services/Functions.kt @@ -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? = null, - search: String? = null, ): io.appwrite.models.ExecutionList { val apiPath = "/functions/{functionId}/executions" .replace("{functionId}", functionId) val apiParams = mutableMapOf( "queries" to queries, - "search" to search, ) val apiHeaders = mutableMapOf( ) diff --git a/library/src/main/java/io/appwrite/services/Storage.kt b/library/src/main/java/io/appwrite/services/Storage.kt index 391dedb7..3b0323a1 100644 --- a/library/src/main/java/io/appwrite/services/Storage.kt +++ b/library/src/main/java/io/appwrite/services/Storage.kt @@ -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( + "token" to token, "project" to client.config["project"], ) return client.call( @@ -243,7 +247,7 @@ 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. @@ -251,6 +255,7 @@ class Storage(client: Client) : Service(client) { * @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 @@ -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) @@ -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( @@ -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( + "token" to token, "project" to client.config["project"], ) return client.call( diff --git a/library/src/main/java/io/appwrite/services/Teams.kt b/library/src/main/java/io/appwrite/services/Teams.kt index 6810ce18..2756a5a1 100644 --- a/library/src/main/java/io/appwrite/services/Teams.kt +++ b/library/src/main/java/io/appwrite/services/Teams.kt @@ -256,7 +256,7 @@ class Teams(client: Client) : Service(client) { * Use this endpoint to list a team's members using the team'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] */