From 2de03f06f3bde8c3dede29ddc7bae008470ffbd3 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 5 Sep 2025 01:29:00 +1200 Subject: [PATCH 1/5] Add time between queries --- README.md | 4 ++-- library/src/main/java/io/appwrite/Client.kt | 2 +- library/src/main/java/io/appwrite/Query.kt | 18 ++++++++++++++++++ .../main/java/io/appwrite/enums/CreditCard.kt | 4 ++-- .../java/io/appwrite/enums/ExecutionMethod.kt | 4 +++- .../main/java/io/appwrite/services/Account.kt | 6 ++++-- .../main/java/io/appwrite/services/Avatars.kt | 2 +- .../java/io/appwrite/services/Functions.kt | 2 +- 8 files changed, 32 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index a0c4c6d..10986d1 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ repositories { Next, add the dependency to your project's `build.gradle(.kts)` file: ```groovy -implementation("io.appwrite:sdk-for-android:9.0.0") +implementation("io.appwrite:sdk-for-android:9.1.0") ``` ### Maven @@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-android - 9.0.0 + 9.1.0 ``` diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt index 10f9255..8b496ef 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 "9.0.0", + "x-sdk-version" to "9.1.0", "x-appwrite-response-format" to "1.8.0" ) config = mutableMapOf() diff --git a/library/src/main/java/io/appwrite/Query.kt b/library/src/main/java/io/appwrite/Query.kt index 39798f3..46e1968 100644 --- a/library/src/main/java/io/appwrite/Query.kt +++ b/library/src/main/java/io/appwrite/Query.kt @@ -254,6 +254,15 @@ class Query( */ fun createdAfter(value: String) = Query("createdAfter", null, listOf(value)).toJson() + /** + * Filter resources where document was created between start and end dates (inclusive). + * + * @param start The start date value. + * @param end The end date value. + * @returns The query string. + */ + fun createdBetween(start: String, end: String) = Query("createdBetween", null, listOf(start, end)).toJson() + /** * Filter resources where document was updated before date. * @@ -270,6 +279,15 @@ class Query( */ fun updatedAfter(value: String) = Query("updatedAfter", null, listOf(value)).toJson() + /** + * Filter resources where document was updated between start and end dates (inclusive). + * + * @param start The start date value. + * @param end The end date value. + * @returns The query string. + */ + fun updatedBetween(start: String, end: String) = Query("updatedBetween", null, listOf(start, end)).toJson() + /** * Combine multiple queries using logical OR operator. * diff --git a/library/src/main/java/io/appwrite/enums/CreditCard.kt b/library/src/main/java/io/appwrite/enums/CreditCard.kt index 1826304..ab9b215 100644 --- a/library/src/main/java/io/appwrite/enums/CreditCard.kt +++ b/library/src/main/java/io/appwrite/enums/CreditCard.kt @@ -27,8 +27,8 @@ enum class CreditCard(val value: String) { NARANJA("naranja"), @SerializedName("targeta-shopping") TARJETA_SHOPPING("targeta-shopping"), - @SerializedName("union-china-pay") - UNION_CHINA_PAY("union-china-pay"), + @SerializedName("unionpay") + UNION_PAY("unionpay"), @SerializedName("visa") VISA("visa"), @SerializedName("mir") diff --git a/library/src/main/java/io/appwrite/enums/ExecutionMethod.kt b/library/src/main/java/io/appwrite/enums/ExecutionMethod.kt index 946fdb3..1595981 100644 --- a/library/src/main/java/io/appwrite/enums/ExecutionMethod.kt +++ b/library/src/main/java/io/appwrite/enums/ExecutionMethod.kt @@ -14,7 +14,9 @@ enum class ExecutionMethod(val value: String) { @SerializedName("DELETE") DELETE("DELETE"), @SerializedName("OPTIONS") - OPTIONS("OPTIONS"); + OPTIONS("OPTIONS"), + @SerializedName("HEAD") + HEAD("HEAD"); override fun toString() = value } \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/services/Account.kt b/library/src/main/java/io/appwrite/services/Account.kt index d5ed63a..3dfd654 100644 --- a/library/src/main/java/io/appwrite/services/Account.kt +++ b/library/src/main/java/io/appwrite/services/Account.kt @@ -1408,7 +1408,8 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.Session] */ @Deprecated( - message = "This API has been deprecated." + message = "This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Account.createSession") ) suspend fun updateMagicURLSession( userId: String, @@ -1523,7 +1524,8 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.Session] */ @Deprecated( - message = "This API has been deprecated." + message = "This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Account.createSession") ) suspend fun updatePhoneSession( userId: String, diff --git a/library/src/main/java/io/appwrite/services/Avatars.kt b/library/src/main/java/io/appwrite/services/Avatars.kt index ed7e7fa..63b436d 100644 --- a/library/src/main/java/io/appwrite/services/Avatars.kt +++ b/library/src/main/java/io/appwrite/services/Avatars.kt @@ -59,7 +59,7 @@ class Avatars(client: Client) : Service(client) { * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. * * - * @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 code Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, 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 keep existing image quality. diff --git a/library/src/main/java/io/appwrite/services/Functions.kt b/library/src/main/java/io/appwrite/services/Functions.kt index b938581..45fd87e 100644 --- a/library/src/main/java/io/appwrite/services/Functions.kt +++ b/library/src/main/java/io/appwrite/services/Functions.kt @@ -57,7 +57,7 @@ class Functions(client: Client) : Service(client) { * @param body HTTP body of execution. Default value is empty string. * @param async Execute code in the background. Default value is false. * @param path HTTP path of execution. Path can include query params. Default value is / - * @param method HTTP method of execution. Default value is GET. + * @param method HTTP method of execution. Default value is POST. * @param headers HTTP headers of execution. Defaults to empty. * @param scheduledAt Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. * @return [io.appwrite.models.Execution] From b7760d1d40154770a2a16391881e8eda0186742b Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 5 Sep 2025 02:13:07 +1200 Subject: [PATCH 2/5] Update version --- README.md | 4 ++-- library/src/main/java/io/appwrite/Client.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 10986d1..129c3f6 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ repositories { Next, add the dependency to your project's `build.gradle(.kts)` file: ```groovy -implementation("io.appwrite:sdk-for-android:9.1.0") +implementation("io.appwrite:sdk-for-android:10.0.0") ``` ### Maven @@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-android - 9.1.0 + 10.0.0 ``` diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt index 8b496ef..e52b98a 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 "9.1.0", + "x-sdk-version" to "10.0.0", "x-appwrite-response-format" to "1.8.0" ) config = mutableMapOf() From 445bb61e7d9812f4dfe4e66e5893cf9538526022 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 5 Sep 2025 21:39:40 +1200 Subject: [PATCH 3/5] Add spatial queries --- library/src/main/java/io/appwrite/Query.kt | 116 +++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/library/src/main/java/io/appwrite/Query.kt b/library/src/main/java/io/appwrite/Query.kt index 46e1968..2b5c3c8 100644 --- a/library/src/main/java/io/appwrite/Query.kt +++ b/library/src/main/java/io/appwrite/Query.kt @@ -304,6 +304,122 @@ class Query( */ fun and(queries: List) = Query("and", null, queries.map { it.fromJson() }).toJson() + /** + * Filter resources where attribute is at a specific distance from the given coordinates. + * + * @param attribute The attribute to filter on. + * @param values The coordinate values. + * @param distance The distance value. + * @param meters Whether the distance is in meters. + * @returns The query string. + */ + fun distanceEqual(attribute: String, values: List, distance: Number, meters: Boolean = true) = Query("distanceEqual", attribute, listOf(values, distance, meters)).toJson() + + /** + * Filter resources where attribute is not at a specific distance from the given coordinates. + * + * @param attribute The attribute to filter on. + * @param values The coordinate values. + * @param distance The distance value. + * @param meters Whether the distance is in meters. + * @returns The query string. + */ + fun distanceNotEqual(attribute: String, values: List, distance: Number, meters: Boolean = true) = Query("distanceNotEqual", attribute, listOf(values, distance, meters)).toJson() + + /** + * Filter resources where attribute is at a distance greater than the specified value from the given coordinates. + * + * @param attribute The attribute to filter on. + * @param values The coordinate values. + * @param distance The distance value. + * @param meters Whether the distance is in meters. + * @returns The query string. + */ + fun distanceGreaterThan(attribute: String, values: List, distance: Number, meters: Boolean = true) = Query("distanceGreaterThan", attribute, listOf(values, distance, meters)).toJson() + + /** + * Filter resources where attribute is at a distance less than the specified value from the given coordinates. + * + * @param attribute The attribute to filter on. + * @param values The coordinate values. + * @param distance The distance value. + * @param meters Whether the distance is in meters. + * @returns The query string. + */ + fun distanceLessThan(attribute: String, values: List, distance: Number, meters: Boolean = true) = Query("distanceLessThan", attribute, listOf(values, distance, meters)).toJson() + + /** + * Filter resources where attribute intersects with the given geometry. + * + * @param attribute The attribute to filter on. + * @param values The coordinate values. + * @returns The query string. + */ + fun intersects(attribute: String, values: List) = Query("intersects", attribute, values).toJson() + + /** + * Filter resources where attribute does not intersect with the given geometry. + * + * @param attribute The attribute to filter on. + * @param values The coordinate values. + * @returns The query string. + */ + fun notIntersects(attribute: String, values: List) = Query("notIntersects", attribute, values).toJson() + + /** + * Filter resources where attribute crosses the given geometry. + * + * @param attribute The attribute to filter on. + * @param values The coordinate values. + * @returns The query string. + */ + fun crosses(attribute: String, values: List) = Query("crosses", attribute, values).toJson() + + /** + * Filter resources where attribute does not cross the given geometry. + * + * @param attribute The attribute to filter on. + * @param values The coordinate values. + * @returns The query string. + */ + fun notCrosses(attribute: String, values: List) = Query("notCrosses", attribute, values).toJson() + + /** + * Filter resources where attribute overlaps with the given geometry. + * + * @param attribute The attribute to filter on. + * @param values The coordinate values. + * @returns The query string. + */ + fun overlaps(attribute: String, values: List) = Query("overlaps", attribute, values).toJson() + + /** + * Filter resources where attribute does not overlap with the given geometry. + * + * @param attribute The attribute to filter on. + * @param values The coordinate values. + * @returns The query string. + */ + fun notOverlaps(attribute: String, values: List) = Query("notOverlaps", attribute, values).toJson() + + /** + * Filter resources where attribute touches the given geometry. + * + * @param attribute The attribute to filter on. + * @param values The coordinate values. + * @returns The query string. + */ + fun touches(attribute: String, values: List) = Query("touches", attribute, values).toJson() + + /** + * Filter resources where attribute does not touch the given geometry. + * + * @param attribute The attribute to filter on. + * @param values The coordinate values. + * @returns The query string. + */ + fun notTouches(attribute: String, values: List) = Query("notTouches", attribute, values).toJson() + /** * Parse the value to a list of values. * From 937db035f08740be62f615d80bf11980f96272ad Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Sat, 6 Sep 2025 04:55:59 +1200 Subject: [PATCH 4/5] Fix spatial default --- docs/examples/java/account/update-prefs.md | 6 +++++- docs/examples/java/databases/create-document.md | 8 +++++++- docs/examples/java/tablesdb/create-row.md | 8 +++++++- docs/examples/kotlin/account/update-prefs.md | 6 +++++- docs/examples/kotlin/databases/create-document.md | 8 +++++++- docs/examples/kotlin/tablesdb/create-row.md | 8 +++++++- 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/docs/examples/java/account/update-prefs.md b/docs/examples/java/account/update-prefs.md index f1a16c7..4bd6940 100644 --- a/docs/examples/java/account/update-prefs.md +++ b/docs/examples/java/account/update-prefs.md @@ -9,7 +9,11 @@ Client client = new Client(context) Account account = new Account(client); account.updatePrefs( - mapOf( "a" to "b" ), // prefs + mapOf( + "language" to "en", + "timezone" to "UTC", + "darkTheme" to true + ), // prefs 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 4804d75..bd0b57a 100644 --- a/docs/examples/java/databases/create-document.md +++ b/docs/examples/java/databases/create-document.md @@ -12,7 +12,13 @@ databases.createDocument( "", // databaseId "", // collectionId "", // documentId - mapOf( "a" to "b" ), // data + mapOf( + "username" to "walter.obrien", + "email" to "walter.obrien@example.com", + "fullName" to "Walter O'Brien", + "age" to 30, + "isAdmin" to false + ), // data listOf("read("any")"), // permissions (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/tablesdb/create-row.md b/docs/examples/java/tablesdb/create-row.md index 12d1680..8273573 100644 --- a/docs/examples/java/tablesdb/create-row.md +++ b/docs/examples/java/tablesdb/create-row.md @@ -12,7 +12,13 @@ tablesDB.createRow( "", // databaseId "", // tableId "", // rowId - mapOf( "a" to "b" ), // data + mapOf( + "username" to "walter.obrien", + "email" to "walter.obrien@example.com", + "fullName" to "Walter O'Brien", + "age" to 30, + "isAdmin" to false + ), // data listOf("read("any")"), // permissions (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/kotlin/account/update-prefs.md b/docs/examples/kotlin/account/update-prefs.md index fdfed57..ded80e9 100644 --- a/docs/examples/kotlin/account/update-prefs.md +++ b/docs/examples/kotlin/account/update-prefs.md @@ -9,5 +9,9 @@ val client = Client(context) val account = Account(client) val result = account.updatePrefs( - prefs = mapOf( "a" to "b" ), + prefs = mapOf( + "language" to "en", + "timezone" to "UTC", + "darkTheme" to true + ), ) \ 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 849a636..7f0aaf8 100644 --- a/docs/examples/kotlin/databases/create-document.md +++ b/docs/examples/kotlin/databases/create-document.md @@ -12,6 +12,12 @@ val result = databases.createDocument( databaseId = "", collectionId = "", documentId = "", - data = mapOf( "a" to "b" ), + data = mapOf( + "username" to "walter.obrien", + "email" to "walter.obrien@example.com", + "fullName" to "Walter O'Brien", + "age" to 30, + "isAdmin" to false + ), permissions = listOf("read("any")"), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/tablesdb/create-row.md b/docs/examples/kotlin/tablesdb/create-row.md index 1a9cbdb..eb44cc4 100644 --- a/docs/examples/kotlin/tablesdb/create-row.md +++ b/docs/examples/kotlin/tablesdb/create-row.md @@ -12,6 +12,12 @@ val result = tablesDB.createRow( databaseId = "", tableId = "", rowId = "", - data = mapOf( "a" to "b" ), + data = mapOf( + "username" to "walter.obrien", + "email" to "walter.obrien@example.com", + "fullName" to "Walter O'Brien", + "age" to 30, + "isAdmin" to false + ), permissions = listOf("read("any")"), // (optional) ) \ No newline at end of file From 9a8a71a75f7d65b6a9b17baf54e9838278a68d8a Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 8 Sep 2025 21:39:05 +1200 Subject: [PATCH 5/5] Update spatial queries --- library/src/main/java/io/appwrite/Query.kt | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/library/src/main/java/io/appwrite/Query.kt b/library/src/main/java/io/appwrite/Query.kt index 2b5c3c8..6d5db56 100644 --- a/library/src/main/java/io/appwrite/Query.kt +++ b/library/src/main/java/io/appwrite/Query.kt @@ -313,7 +313,7 @@ class Query( * @param meters Whether the distance is in meters. * @returns The query string. */ - fun distanceEqual(attribute: String, values: List, distance: Number, meters: Boolean = true) = Query("distanceEqual", attribute, listOf(values, distance, meters)).toJson() + fun distanceEqual(attribute: String, values: List, distance: Number, meters: Boolean = true) = Query("distanceEqual", attribute, listOf(listOf(values, distance, meters))).toJson() /** * Filter resources where attribute is not at a specific distance from the given coordinates. @@ -324,7 +324,7 @@ class Query( * @param meters Whether the distance is in meters. * @returns The query string. */ - fun distanceNotEqual(attribute: String, values: List, distance: Number, meters: Boolean = true) = Query("distanceNotEqual", attribute, listOf(values, distance, meters)).toJson() + fun distanceNotEqual(attribute: String, values: List, distance: Number, meters: Boolean = true) = Query("distanceNotEqual", attribute, listOf(listOf(values, distance, meters))).toJson() /** * Filter resources where attribute is at a distance greater than the specified value from the given coordinates. @@ -335,7 +335,7 @@ class Query( * @param meters Whether the distance is in meters. * @returns The query string. */ - fun distanceGreaterThan(attribute: String, values: List, distance: Number, meters: Boolean = true) = Query("distanceGreaterThan", attribute, listOf(values, distance, meters)).toJson() + fun distanceGreaterThan(attribute: String, values: List, distance: Number, meters: Boolean = true) = Query("distanceGreaterThan", attribute, listOf(listOf(values, distance, meters))).toJson() /** * Filter resources where attribute is at a distance less than the specified value from the given coordinates. @@ -346,7 +346,7 @@ class Query( * @param meters Whether the distance is in meters. * @returns The query string. */ - fun distanceLessThan(attribute: String, values: List, distance: Number, meters: Boolean = true) = Query("distanceLessThan", attribute, listOf(values, distance, meters)).toJson() + fun distanceLessThan(attribute: String, values: List, distance: Number, meters: Boolean = true) = Query("distanceLessThan", attribute, listOf(listOf(values, distance, meters))).toJson() /** * Filter resources where attribute intersects with the given geometry. @@ -355,7 +355,7 @@ class Query( * @param values The coordinate values. * @returns The query string. */ - fun intersects(attribute: String, values: List) = Query("intersects", attribute, values).toJson() + fun intersects(attribute: String, values: List) = Query("intersects", attribute, listOf(values)).toJson() /** * Filter resources where attribute does not intersect with the given geometry. @@ -364,7 +364,7 @@ class Query( * @param values The coordinate values. * @returns The query string. */ - fun notIntersects(attribute: String, values: List) = Query("notIntersects", attribute, values).toJson() + fun notIntersects(attribute: String, values: List) = Query("notIntersects", attribute, listOf(values)).toJson() /** * Filter resources where attribute crosses the given geometry. @@ -373,7 +373,7 @@ class Query( * @param values The coordinate values. * @returns The query string. */ - fun crosses(attribute: String, values: List) = Query("crosses", attribute, values).toJson() + fun crosses(attribute: String, values: List) = Query("crosses", attribute, listOf(values)).toJson() /** * Filter resources where attribute does not cross the given geometry. @@ -382,7 +382,7 @@ class Query( * @param values The coordinate values. * @returns The query string. */ - fun notCrosses(attribute: String, values: List) = Query("notCrosses", attribute, values).toJson() + fun notCrosses(attribute: String, values: List) = Query("notCrosses", attribute, listOf(values)).toJson() /** * Filter resources where attribute overlaps with the given geometry. @@ -391,7 +391,7 @@ class Query( * @param values The coordinate values. * @returns The query string. */ - fun overlaps(attribute: String, values: List) = Query("overlaps", attribute, values).toJson() + fun overlaps(attribute: String, values: List) = Query("overlaps", attribute, listOf(values)).toJson() /** * Filter resources where attribute does not overlap with the given geometry. @@ -400,7 +400,7 @@ class Query( * @param values The coordinate values. * @returns The query string. */ - fun notOverlaps(attribute: String, values: List) = Query("notOverlaps", attribute, values).toJson() + fun notOverlaps(attribute: String, values: List) = Query("notOverlaps", attribute, listOf(values)).toJson() /** * Filter resources where attribute touches the given geometry. @@ -409,7 +409,7 @@ class Query( * @param values The coordinate values. * @returns The query string. */ - fun touches(attribute: String, values: List) = Query("touches", attribute, values).toJson() + fun touches(attribute: String, values: List) = Query("touches", attribute, listOf(values)).toJson() /** * Filter resources where attribute does not touch the given geometry. @@ -418,7 +418,7 @@ class Query( * @param values The coordinate values. * @returns The query string. */ - fun notTouches(attribute: String, values: List) = Query("notTouches", attribute, values).toJson() + fun notTouches(attribute: String, values: List) = Query("notTouches", attribute, listOf(values)).toJson() /** * Parse the value to a list of values.