From b6b3323d75942f4412cad61fd5dc6388bac2f762 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 3 Mar 2026 08:26:56 +0000 Subject: [PATCH] sdk update --- README.md | 6 ++--- .../examples/java/databases/list-documents.md | 1 + docs/examples/java/tablesdb/list-rows.md | 1 + .../kotlin/databases/list-documents.md | 1 + docs/examples/kotlin/tablesdb/list-rows.md | 1 + library/src/main/java/io/appwrite/Channel.kt | 25 ++++++++++--------- library/src/main/java/io/appwrite/Client.kt | 2 +- .../main/java/io/appwrite/models/Document.kt | 2 +- .../src/main/java/io/appwrite/models/Row.kt | 2 +- .../java/io/appwrite/services/Databases.kt | 6 +++++ .../java/io/appwrite/services/TablesDB.kt | 6 +++++ .../main/java/io/appwrite/services/Teams.kt | 4 +-- 12 files changed, 37 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index efa6c11..c06e46c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![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.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-android/releases).** +**This SDK is compatible with Appwrite server version latest. 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 abstracts and simplifies 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:12.2.0") +implementation("io.appwrite:sdk-for-android:12.2.1") ``` ### Maven @@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-android - 12.2.0 + 12.2.1 ``` diff --git a/docs/examples/java/databases/list-documents.md b/docs/examples/java/databases/list-documents.md index 26e7a52..7edbec3 100644 --- a/docs/examples/java/databases/list-documents.md +++ b/docs/examples/java/databases/list-documents.md @@ -15,6 +15,7 @@ databases.listDocuments( List.of(), // queries (optional) "", // transactionId (optional) false, // total (optional) + 0, // ttl (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/tablesdb/list-rows.md b/docs/examples/java/tablesdb/list-rows.md index 48caad9..6ab5489 100644 --- a/docs/examples/java/tablesdb/list-rows.md +++ b/docs/examples/java/tablesdb/list-rows.md @@ -15,6 +15,7 @@ tablesDB.listRows( List.of(), // queries (optional) "", // transactionId (optional) false, // total (optional) + 0, // ttl (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/kotlin/databases/list-documents.md b/docs/examples/kotlin/databases/list-documents.md index 485ce79..b42b7dd 100644 --- a/docs/examples/kotlin/databases/list-documents.md +++ b/docs/examples/kotlin/databases/list-documents.md @@ -15,5 +15,6 @@ val result = databases.listDocuments( queries = listOf(), // (optional) transactionId = "", // (optional) total = false, // (optional) + ttl = 0, // (optional) ) ``` diff --git a/docs/examples/kotlin/tablesdb/list-rows.md b/docs/examples/kotlin/tablesdb/list-rows.md index 9957a86..a428290 100644 --- a/docs/examples/kotlin/tablesdb/list-rows.md +++ b/docs/examples/kotlin/tablesdb/list-rows.md @@ -15,5 +15,6 @@ val result = tablesDB.listRows( queries = listOf(), // (optional) transactionId = "", // (optional) total = false, // (optional) + ttl = 0, // (optional) ) ``` diff --git a/library/src/main/java/io/appwrite/Channel.kt b/library/src/main/java/io/appwrite/Channel.kt index fc7cfb4..5c06701 100644 --- a/library/src/main/java/io/appwrite/Channel.kt +++ b/library/src/main/java/io/appwrite/Channel.kt @@ -24,7 +24,8 @@ typealias Actionable = _Document */ private fun normalize(id: String): String { val trimmed = id.trim() - return if (trimmed.isEmpty()) "*" else trimmed + require(trimmed.isNotEmpty()) { "Channel ID is required." } + return trimmed } /** @@ -59,25 +60,25 @@ class Channel private constructor( override fun toString(): String = segments.joinToString(".") companion object { - fun database(id: String = "*"): Channel<_Database> = + fun database(id: String): Channel<_Database> = Channel(listOf("databases", normalize(id))) - fun tablesdb(id: String = "*"): Channel<_TablesDB> = + fun tablesdb(id: String): Channel<_TablesDB> = Channel(listOf("tablesdb", normalize(id))) - fun bucket(id: String = "*"): Channel<_Bucket> = + fun bucket(id: String): Channel<_Bucket> = Channel(listOf("buckets", normalize(id))) - fun execution(id: String = "*"): Channel<_Execution> = + fun execution(id: String): Channel<_Execution> = Channel(listOf("executions", normalize(id))) - fun function(id: String = "*"): Channel<_Func> = + fun function(id: String): Channel<_Func> = Channel(listOf("functions", normalize(id))) - fun team(id: String = "*"): Channel<_Team> = + fun team(id: String): Channel<_Team> = Channel(listOf("teams", normalize(id))) - fun membership(id: String = "*"): Channel<_Membership> = + fun membership(id: String): Channel<_Membership> = Channel(listOf("memberships", normalize(id))) fun account(): String = "account" @@ -98,8 +99,8 @@ class Channel private constructor( /** * Only available on Channel<_Database> */ -fun Channel<_Database>.collection(id: String? = null): Channel<_Collection> = - this.next("collections", id ?: "*") +fun Channel<_Database>.collection(id: String): Channel<_Collection> = + this.next("collections", id) /** * Only available on Channel<_Collection> @@ -112,8 +113,8 @@ fun Channel<_Collection>.document(id: String? = null): Channel<_Document> = /** * Only available on Channel<_TablesDB> */ -fun Channel<_TablesDB>.table(id: String? = null): Channel<_Table> = - this.next("tables", id ?: "*") +fun Channel<_TablesDB>.table(id: String): Channel<_Table> = + this.next("tables", id) /** * Only available on Channel<_Table> diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt index 2e7475c..c0d7b1e 100644 --- a/library/src/main/java/io/appwrite/Client.kt +++ b/library/src/main/java/io/appwrite/Client.kt @@ -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 "12.2.0", + "x-sdk-version" to "12.2.1", "x-appwrite-response-format" to "1.8.0" ) config = mutableMapOf() diff --git a/library/src/main/java/io/appwrite/models/Document.kt b/library/src/main/java/io/appwrite/models/Document.kt index 6a2fd9c..830fe38 100644 --- a/library/src/main/java/io/appwrite/models/Document.kt +++ b/library/src/main/java/io/appwrite/models/Document.kt @@ -14,7 +14,7 @@ data class Document( val id: String, /** - * Document automatically incrementing ID. + * Document sequence ID. */ @SerializedName("\$sequence") val sequence: Long, diff --git a/library/src/main/java/io/appwrite/models/Row.kt b/library/src/main/java/io/appwrite/models/Row.kt index 3621fc5..793d278 100644 --- a/library/src/main/java/io/appwrite/models/Row.kt +++ b/library/src/main/java/io/appwrite/models/Row.kt @@ -14,7 +14,7 @@ data class Row( val id: String, /** - * Row automatically incrementing ID. + * Row sequence ID. */ @SerializedName("\$sequence") val sequence: Long, diff --git a/library/src/main/java/io/appwrite/services/Databases.kt b/library/src/main/java/io/appwrite/services/Databases.kt index 57f2274..dda1137 100644 --- a/library/src/main/java/io/appwrite/services/Databases.kt +++ b/library/src/main/java/io/appwrite/services/Databases.kt @@ -220,6 +220,7 @@ class Databases(client: Client) : Service(client) { * @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. * @param transactionId Transaction ID to read uncommitted changes within the transaction. * @param total When set to false, the total count returned will be 0 and will not be calculated. + * @param ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). * @return [io.appwrite.models.DocumentList] */ @Deprecated( @@ -233,6 +234,7 @@ class Databases(client: Client) : Service(client) { queries: List? = null, transactionId: String? = null, total: Boolean? = null, + ttl: Long? = null, nestedType: Class, ): io.appwrite.models.DocumentList { val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents" @@ -243,6 +245,7 @@ class Databases(client: Client) : Service(client) { "queries" to queries, "transactionId" to transactionId, "total" to total, + "ttl" to ttl, ) val apiHeaders = mutableMapOf( ) @@ -268,6 +271,7 @@ class Databases(client: Client) : Service(client) { * @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. * @param transactionId Transaction ID to read uncommitted changes within the transaction. * @param total When set to false, the total count returned will be 0 and will not be calculated. + * @param ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). * @return [io.appwrite.models.DocumentList] */ @Deprecated( @@ -282,12 +286,14 @@ class Databases(client: Client) : Service(client) { queries: List? = null, transactionId: String? = null, total: Boolean? = null, + ttl: Long? = null, ): io.appwrite.models.DocumentList> = listDocuments( databaseId, collectionId, queries, transactionId, total, + ttl, nestedType = classOf(), ) diff --git a/library/src/main/java/io/appwrite/services/TablesDB.kt b/library/src/main/java/io/appwrite/services/TablesDB.kt index 033d3be..4b87b21 100644 --- a/library/src/main/java/io/appwrite/services/TablesDB.kt +++ b/library/src/main/java/io/appwrite/services/TablesDB.kt @@ -220,6 +220,7 @@ class TablesDB(client: Client) : Service(client) { * @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. * @param transactionId Transaction ID to read uncommitted changes within the transaction. * @param total When set to false, the total count returned will be 0 and will not be calculated. + * @param ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). * @return [io.appwrite.models.RowList] */ @JvmOverloads @@ -229,6 +230,7 @@ class TablesDB(client: Client) : Service(client) { queries: List? = null, transactionId: String? = null, total: Boolean? = null, + ttl: Long? = null, nestedType: Class, ): io.appwrite.models.RowList { val apiPath = "/tablesdb/{databaseId}/tables/{tableId}/rows" @@ -239,6 +241,7 @@ class TablesDB(client: Client) : Service(client) { "queries" to queries, "transactionId" to transactionId, "total" to total, + "ttl" to ttl, ) val apiHeaders = mutableMapOf( ) @@ -264,6 +267,7 @@ class TablesDB(client: Client) : Service(client) { * @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. * @param transactionId Transaction ID to read uncommitted changes within the transaction. * @param total When set to false, the total count returned will be 0 and will not be calculated. + * @param ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). * @return [io.appwrite.models.RowList] */ @JvmOverloads @@ -274,12 +278,14 @@ class TablesDB(client: Client) : Service(client) { queries: List? = null, transactionId: String? = null, total: Boolean? = null, + ttl: Long? = null, ): io.appwrite.models.RowList> = listRows( databaseId, tableId, queries, transactionId, total, + ttl, nestedType = classOf(), ) diff --git a/library/src/main/java/io/appwrite/services/Teams.kt b/library/src/main/java/io/appwrite/services/Teams.kt index 5d48f28..56fc955 100644 --- a/library/src/main/java/io/appwrite/services/Teams.kt +++ b/library/src/main/java/io/appwrite/services/Teams.kt @@ -309,7 +309,7 @@ class Teams(client: Client) : Service(client) { * * * @param teamId Team ID. - * @param roles Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param roles Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. * @param email Email of the new team member. * @param userId ID of the user to be added to a team. * @param phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. @@ -396,7 +396,7 @@ class Teams(client: Client) : Service(client) { * * @param teamId Team ID. * @param membershipId Membership ID. - * @param roles An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param roles An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. * @return [io.appwrite.models.Membership] */ suspend fun updateMembership(