From fb6f407eb1fb72a95be7cb5b3c71e91873216023 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 5 Sep 2025 01:32:23 +1200 Subject: [PATCH 1/6] Add time between queries --- README.md | 4 +- .../java/databases/create-line-attribute.md | 27 ++ .../java/databases/create-point-attribute.md | 27 ++ .../databases/create-polygon-attribute.md | 27 ++ .../java/databases/update-line-attribute.md | 28 ++ .../java/databases/update-point-attribute.md | 28 ++ .../databases/update-polygon-attribute.md | 28 ++ .../java/tablesdb/create-line-column.md | 27 ++ .../java/tablesdb/create-point-column.md | 27 ++ .../java/tablesdb/create-polygon-column.md | 27 ++ .../java/tablesdb/update-line-column.md | 28 ++ .../java/tablesdb/update-point-column.md | 28 ++ .../java/tablesdb/update-polygon-column.md | 28 ++ .../kotlin/databases/create-line-attribute.md | 18 ++ .../databases/create-point-attribute.md | 18 ++ .../databases/create-polygon-attribute.md | 18 ++ .../kotlin/databases/update-line-attribute.md | 19 ++ .../databases/update-point-attribute.md | 19 ++ .../databases/update-polygon-attribute.md | 19 ++ .../kotlin/tablesdb/create-line-column.md | 18 ++ .../kotlin/tablesdb/create-point-column.md | 18 ++ .../kotlin/tablesdb/create-polygon-column.md | 18 ++ .../kotlin/tablesdb/update-line-column.md | 19 ++ .../kotlin/tablesdb/update-point-column.md | 19 ++ .../kotlin/tablesdb/update-polygon-column.md | 19 ++ src/main/kotlin/io/appwrite/Client.kt | 4 +- src/main/kotlin/io/appwrite/Query.kt | 4 + .../kotlin/io/appwrite/enums/CreditCard.kt | 4 +- .../io/appwrite/enums/ExecutionMethod.kt | 4 +- .../kotlin/io/appwrite/enums/IndexType.kt | 4 +- .../io/appwrite/models/AttributeLine.kt | 94 ++++++ .../io/appwrite/models/AttributePoint.kt | 94 ++++++ .../io/appwrite/models/AttributePolygon.kt | 94 ++++++ .../kotlin/io/appwrite/models/ColumnLine.kt | 94 ++++++ .../kotlin/io/appwrite/models/ColumnPoint.kt | 94 ++++++ .../io/appwrite/models/ColumnPolygon.kt | 94 ++++++ .../kotlin/io/appwrite/services/Account.kt | 6 +- .../kotlin/io/appwrite/services/Avatars.kt | 2 +- .../kotlin/io/appwrite/services/Databases.kt | 301 +++++++++++++++++- .../kotlin/io/appwrite/services/Functions.kt | 2 +- .../kotlin/io/appwrite/services/TablesDb.kt | 273 ++++++++++++++++ 41 files changed, 1710 insertions(+), 14 deletions(-) create mode 100644 docs/examples/java/databases/create-line-attribute.md create mode 100644 docs/examples/java/databases/create-point-attribute.md create mode 100644 docs/examples/java/databases/create-polygon-attribute.md create mode 100644 docs/examples/java/databases/update-line-attribute.md create mode 100644 docs/examples/java/databases/update-point-attribute.md create mode 100644 docs/examples/java/databases/update-polygon-attribute.md create mode 100644 docs/examples/java/tablesdb/create-line-column.md create mode 100644 docs/examples/java/tablesdb/create-point-column.md create mode 100644 docs/examples/java/tablesdb/create-polygon-column.md create mode 100644 docs/examples/java/tablesdb/update-line-column.md create mode 100644 docs/examples/java/tablesdb/update-point-column.md create mode 100644 docs/examples/java/tablesdb/update-polygon-column.md create mode 100644 docs/examples/kotlin/databases/create-line-attribute.md create mode 100644 docs/examples/kotlin/databases/create-point-attribute.md create mode 100644 docs/examples/kotlin/databases/create-polygon-attribute.md create mode 100644 docs/examples/kotlin/databases/update-line-attribute.md create mode 100644 docs/examples/kotlin/databases/update-point-attribute.md create mode 100644 docs/examples/kotlin/databases/update-polygon-attribute.md create mode 100644 docs/examples/kotlin/tablesdb/create-line-column.md create mode 100644 docs/examples/kotlin/tablesdb/create-point-column.md create mode 100644 docs/examples/kotlin/tablesdb/create-polygon-column.md create mode 100644 docs/examples/kotlin/tablesdb/update-line-column.md create mode 100644 docs/examples/kotlin/tablesdb/update-point-column.md create mode 100644 docs/examples/kotlin/tablesdb/update-polygon-column.md create mode 100644 src/main/kotlin/io/appwrite/models/AttributeLine.kt create mode 100644 src/main/kotlin/io/appwrite/models/AttributePoint.kt create mode 100644 src/main/kotlin/io/appwrite/models/AttributePolygon.kt create mode 100644 src/main/kotlin/io/appwrite/models/ColumnLine.kt create mode 100644 src/main/kotlin/io/appwrite/models/ColumnPoint.kt create mode 100644 src/main/kotlin/io/appwrite/models/ColumnPolygon.kt diff --git a/README.md b/README.md index 8469be2e..6cbe65ff 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ repositories { Next, add the dependency to your project's `build.gradle(.kts)` file: ```groovy -implementation("io.appwrite:sdk-for-kotlin:10.0.0") +implementation("io.appwrite:sdk-for-kotlin:10.1.0") ``` ### Maven @@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-kotlin - 10.0.0 + 10.1.0 ``` diff --git a/docs/examples/java/databases/create-line-attribute.md b/docs/examples/java/databases/create-line-attribute.md new file mode 100644 index 00000000..36f79b94 --- /dev/null +++ b/docs/examples/java/databases/create-line-attribute.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Databases databases = new Databases(client); + +databases.createLineAttribute( + "", // databaseId + "", // collectionId + "", // key + false, // required + "", // default (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/databases/create-point-attribute.md b/docs/examples/java/databases/create-point-attribute.md new file mode 100644 index 00000000..5a8a39b0 --- /dev/null +++ b/docs/examples/java/databases/create-point-attribute.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Databases databases = new Databases(client); + +databases.createPointAttribute( + "", // databaseId + "", // collectionId + "", // key + false, // required + "", // default (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/databases/create-polygon-attribute.md b/docs/examples/java/databases/create-polygon-attribute.md new file mode 100644 index 00000000..22ee4d5c --- /dev/null +++ b/docs/examples/java/databases/create-polygon-attribute.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Databases databases = new Databases(client); + +databases.createPolygonAttribute( + "", // databaseId + "", // collectionId + "", // key + false, // required + "", // default (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/databases/update-line-attribute.md b/docs/examples/java/databases/update-line-attribute.md new file mode 100644 index 00000000..7c834761 --- /dev/null +++ b/docs/examples/java/databases/update-line-attribute.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Databases databases = new Databases(client); + +databases.updateLineAttribute( + "", // databaseId + "", // collectionId + "", // key + false, // required + "", // default (optional) + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/databases/update-point-attribute.md b/docs/examples/java/databases/update-point-attribute.md new file mode 100644 index 00000000..b0a233f6 --- /dev/null +++ b/docs/examples/java/databases/update-point-attribute.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Databases databases = new Databases(client); + +databases.updatePointAttribute( + "", // databaseId + "", // collectionId + "", // key + false, // required + "", // default (optional) + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/databases/update-polygon-attribute.md b/docs/examples/java/databases/update-polygon-attribute.md new file mode 100644 index 00000000..1d365896 --- /dev/null +++ b/docs/examples/java/databases/update-polygon-attribute.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Databases databases = new Databases(client); + +databases.updatePolygonAttribute( + "", // databaseId + "", // collectionId + "", // key + false, // required + "", // default (optional) + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/create-line-column.md b/docs/examples/java/tablesdb/create-line-column.md new file mode 100644 index 00000000..64952912 --- /dev/null +++ b/docs/examples/java/tablesdb/create-line-column.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.createLineColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + "", // default (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/create-point-column.md b/docs/examples/java/tablesdb/create-point-column.md new file mode 100644 index 00000000..d0ddef98 --- /dev/null +++ b/docs/examples/java/tablesdb/create-point-column.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.createPointColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + "", // default (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/create-polygon-column.md b/docs/examples/java/tablesdb/create-polygon-column.md new file mode 100644 index 00000000..3aa5487c --- /dev/null +++ b/docs/examples/java/tablesdb/create-polygon-column.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.createPolygonColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + "", // default (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/update-line-column.md b/docs/examples/java/tablesdb/update-line-column.md new file mode 100644 index 00000000..a1a0c67f --- /dev/null +++ b/docs/examples/java/tablesdb/update-line-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.updateLineColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + "", // default (optional) + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/update-point-column.md b/docs/examples/java/tablesdb/update-point-column.md new file mode 100644 index 00000000..45565063 --- /dev/null +++ b/docs/examples/java/tablesdb/update-point-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.updatePointColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + "", // default (optional) + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/update-polygon-column.md b/docs/examples/java/tablesdb/update-polygon-column.md new file mode 100644 index 00000000..d7757bd5 --- /dev/null +++ b/docs/examples/java/tablesdb/update-polygon-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.updatePolygonColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + "", // default (optional) + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/kotlin/databases/create-line-attribute.md b/docs/examples/kotlin/databases/create-line-attribute.md new file mode 100644 index 00000000..187f875c --- /dev/null +++ b/docs/examples/kotlin/databases/create-line-attribute.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val databases = Databases(client) + +val response = databases.createLineAttribute( + databaseId = "", + collectionId = "", + key = "", + required = false, + default = "" // optional +) diff --git a/docs/examples/kotlin/databases/create-point-attribute.md b/docs/examples/kotlin/databases/create-point-attribute.md new file mode 100644 index 00000000..d6915c1f --- /dev/null +++ b/docs/examples/kotlin/databases/create-point-attribute.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val databases = Databases(client) + +val response = databases.createPointAttribute( + databaseId = "", + collectionId = "", + key = "", + required = false, + default = "" // optional +) diff --git a/docs/examples/kotlin/databases/create-polygon-attribute.md b/docs/examples/kotlin/databases/create-polygon-attribute.md new file mode 100644 index 00000000..0a229625 --- /dev/null +++ b/docs/examples/kotlin/databases/create-polygon-attribute.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val databases = Databases(client) + +val response = databases.createPolygonAttribute( + databaseId = "", + collectionId = "", + key = "", + required = false, + default = "" // optional +) diff --git a/docs/examples/kotlin/databases/update-line-attribute.md b/docs/examples/kotlin/databases/update-line-attribute.md new file mode 100644 index 00000000..c4b515ad --- /dev/null +++ b/docs/examples/kotlin/databases/update-line-attribute.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val databases = Databases(client) + +val response = databases.updateLineAttribute( + databaseId = "", + collectionId = "", + key = "", + required = false, + default = "", // optional + newKey = "" // optional +) diff --git a/docs/examples/kotlin/databases/update-point-attribute.md b/docs/examples/kotlin/databases/update-point-attribute.md new file mode 100644 index 00000000..02bca873 --- /dev/null +++ b/docs/examples/kotlin/databases/update-point-attribute.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val databases = Databases(client) + +val response = databases.updatePointAttribute( + databaseId = "", + collectionId = "", + key = "", + required = false, + default = "", // optional + newKey = "" // optional +) diff --git a/docs/examples/kotlin/databases/update-polygon-attribute.md b/docs/examples/kotlin/databases/update-polygon-attribute.md new file mode 100644 index 00000000..b8c0fc94 --- /dev/null +++ b/docs/examples/kotlin/databases/update-polygon-attribute.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val databases = Databases(client) + +val response = databases.updatePolygonAttribute( + databaseId = "", + collectionId = "", + key = "", + required = false, + default = "", // optional + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/create-line-column.md b/docs/examples/kotlin/tablesdb/create-line-column.md new file mode 100644 index 00000000..0993eed9 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-line-column.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.createLineColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/create-point-column.md b/docs/examples/kotlin/tablesdb/create-point-column.md new file mode 100644 index 00000000..e18bfc34 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-point-column.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.createPointColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/create-polygon-column.md b/docs/examples/kotlin/tablesdb/create-polygon-column.md new file mode 100644 index 00000000..2f8ffd81 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-polygon-column.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.createPolygonColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/update-line-column.md b/docs/examples/kotlin/tablesdb/update-line-column.md new file mode 100644 index 00000000..05781dd6 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update-line-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.updateLineColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "", // optional + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/update-point-column.md b/docs/examples/kotlin/tablesdb/update-point-column.md new file mode 100644 index 00000000..947b4410 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update-point-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.updatePointColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "", // optional + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/update-polygon-column.md b/docs/examples/kotlin/tablesdb/update-polygon-column.md new file mode 100644 index 00000000..b9da6350 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update-polygon-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.updatePolygonColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "", // optional + newKey = "" // optional +) diff --git a/src/main/kotlin/io/appwrite/Client.kt b/src/main/kotlin/io/appwrite/Client.kt index 41a68787..a4952b81 100644 --- a/src/main/kotlin/io/appwrite/Client.kt +++ b/src/main/kotlin/io/appwrite/Client.kt @@ -58,11 +58,11 @@ class Client @JvmOverloads constructor( init { headers = mutableMapOf( "content-type" to "application/json", - "user-agent" to "AppwriteKotlinSDK/10.0.0 ${System.getProperty("http.agent")}", + "user-agent" to "AppwriteKotlinSDK/10.1.0 ${System.getProperty("http.agent")}", "x-sdk-name" to "Kotlin", "x-sdk-platform" to "server", "x-sdk-language" to "kotlin", - "x-sdk-version" to "10.0.0", + "x-sdk-version" to "10.1.0", "x-appwrite-response-format" to "1.8.0", ) diff --git a/src/main/kotlin/io/appwrite/Query.kt b/src/main/kotlin/io/appwrite/Query.kt index bb344529..99e865c9 100644 --- a/src/main/kotlin/io/appwrite/Query.kt +++ b/src/main/kotlin/io/appwrite/Query.kt @@ -65,10 +65,14 @@ class Query( fun createdAfter(value: String) = Query("createdAfter", null, listOf(value)).toJson() + fun createdBetween(start: String, end: String) = Query("createdBetween", null, listOf(start, end)).toJson() + fun updatedBefore(value: String) = Query("updatedBefore", null, listOf(value)).toJson() fun updatedAfter(value: String) = Query("updatedAfter", null, listOf(value)).toJson() + fun updatedBetween(start: String, end: String) = Query("updatedBetween", null, listOf(start, end)).toJson() + fun or(queries: List) = Query("or", null, queries.map { it.fromJson() }).toJson() fun and(queries: List) = Query("and", null, queries.map { it.fromJson() }).toJson() diff --git a/src/main/kotlin/io/appwrite/enums/CreditCard.kt b/src/main/kotlin/io/appwrite/enums/CreditCard.kt index 18263045..ab9b2151 100644 --- a/src/main/kotlin/io/appwrite/enums/CreditCard.kt +++ b/src/main/kotlin/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/src/main/kotlin/io/appwrite/enums/ExecutionMethod.kt b/src/main/kotlin/io/appwrite/enums/ExecutionMethod.kt index 946fdb31..1595981c 100644 --- a/src/main/kotlin/io/appwrite/enums/ExecutionMethod.kt +++ b/src/main/kotlin/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/src/main/kotlin/io/appwrite/enums/IndexType.kt b/src/main/kotlin/io/appwrite/enums/IndexType.kt index 050f076c..eeebc06a 100644 --- a/src/main/kotlin/io/appwrite/enums/IndexType.kt +++ b/src/main/kotlin/io/appwrite/enums/IndexType.kt @@ -8,7 +8,9 @@ enum class IndexType(val value: String) { @SerializedName("fulltext") FULLTEXT("fulltext"), @SerializedName("unique") - UNIQUE("unique"); + UNIQUE("unique"), + @SerializedName("spatial") + SPATIAL("spatial"); override fun toString() = value } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/AttributeLine.kt b/src/main/kotlin/io/appwrite/models/AttributeLine.kt new file mode 100644 index 00000000..60098ac1 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/AttributeLine.kt @@ -0,0 +1,94 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * AttributeLine + */ +data class AttributeLine( + /** + * Attribute Key. + */ + @SerializedName("key") + val key: String, + + /** + * Attribute type. + */ + @SerializedName("type") + val type: String, + + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + @SerializedName("status") + val status: String, + + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + @SerializedName("error") + val error: String, + + /** + * Is attribute required? + */ + @SerializedName("required") + val required: Boolean, + + /** + * Is attribute an array? + */ + @SerializedName("array") + var array: Boolean?, + + /** + * Attribute creation date in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Attribute update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + @SerializedName("default") + var default: Any?, + +) { + fun toMap(): Map = mapOf( + "key" to key as Any, + "type" to type as Any, + "status" to status as Any, + "error" to error as Any, + "required" to required as Any, + "array" to array as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, + "default" to default as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = AttributeLine( + key = map["key"] as String, + type = map["type"] as String, + status = map["status"] as String, + error = map["error"] as String, + required = map["required"] as Boolean, + array = map["array"] as? Boolean?, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, + default = map["default"] as? Any?, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/AttributePoint.kt b/src/main/kotlin/io/appwrite/models/AttributePoint.kt new file mode 100644 index 00000000..24a67a7e --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/AttributePoint.kt @@ -0,0 +1,94 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * AttributePoint + */ +data class AttributePoint( + /** + * Attribute Key. + */ + @SerializedName("key") + val key: String, + + /** + * Attribute type. + */ + @SerializedName("type") + val type: String, + + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + @SerializedName("status") + val status: String, + + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + @SerializedName("error") + val error: String, + + /** + * Is attribute required? + */ + @SerializedName("required") + val required: Boolean, + + /** + * Is attribute an array? + */ + @SerializedName("array") + var array: Boolean?, + + /** + * Attribute creation date in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Attribute update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + @SerializedName("default") + var default: Any?, + +) { + fun toMap(): Map = mapOf( + "key" to key as Any, + "type" to type as Any, + "status" to status as Any, + "error" to error as Any, + "required" to required as Any, + "array" to array as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, + "default" to default as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = AttributePoint( + key = map["key"] as String, + type = map["type"] as String, + status = map["status"] as String, + error = map["error"] as String, + required = map["required"] as Boolean, + array = map["array"] as? Boolean?, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, + default = map["default"] as? Any?, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/AttributePolygon.kt b/src/main/kotlin/io/appwrite/models/AttributePolygon.kt new file mode 100644 index 00000000..f5fc9faf --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/AttributePolygon.kt @@ -0,0 +1,94 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * AttributePolygon + */ +data class AttributePolygon( + /** + * Attribute Key. + */ + @SerializedName("key") + val key: String, + + /** + * Attribute type. + */ + @SerializedName("type") + val type: String, + + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + @SerializedName("status") + val status: String, + + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + @SerializedName("error") + val error: String, + + /** + * Is attribute required? + */ + @SerializedName("required") + val required: Boolean, + + /** + * Is attribute an array? + */ + @SerializedName("array") + var array: Boolean?, + + /** + * Attribute creation date in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Attribute update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + @SerializedName("default") + var default: Any?, + +) { + fun toMap(): Map = mapOf( + "key" to key as Any, + "type" to type as Any, + "status" to status as Any, + "error" to error as Any, + "required" to required as Any, + "array" to array as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, + "default" to default as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = AttributePolygon( + key = map["key"] as String, + type = map["type"] as String, + status = map["status"] as String, + error = map["error"] as String, + required = map["required"] as Boolean, + array = map["array"] as? Boolean?, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, + default = map["default"] as? Any?, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnLine.kt b/src/main/kotlin/io/appwrite/models/ColumnLine.kt new file mode 100644 index 00000000..0311b125 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnLine.kt @@ -0,0 +1,94 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * ColumnLine + */ +data class ColumnLine( + /** + * Column Key. + */ + @SerializedName("key") + val key: String, + + /** + * Column type. + */ + @SerializedName("type") + val type: String, + + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + @SerializedName("status") + val status: String, + + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + @SerializedName("error") + val error: String, + + /** + * Is column required? + */ + @SerializedName("required") + val required: Boolean, + + /** + * Is column an array? + */ + @SerializedName("array") + var array: Boolean?, + + /** + * Column creation date in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Column update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + @SerializedName("default") + var default: Any?, + +) { + fun toMap(): Map = mapOf( + "key" to key as Any, + "type" to type as Any, + "status" to status as Any, + "error" to error as Any, + "required" to required as Any, + "array" to array as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, + "default" to default as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ColumnLine( + key = map["key"] as String, + type = map["type"] as String, + status = map["status"] as String, + error = map["error"] as String, + required = map["required"] as Boolean, + array = map["array"] as? Boolean?, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, + default = map["default"] as? Any?, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnPoint.kt b/src/main/kotlin/io/appwrite/models/ColumnPoint.kt new file mode 100644 index 00000000..0f5945ca --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnPoint.kt @@ -0,0 +1,94 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * ColumnPoint + */ +data class ColumnPoint( + /** + * Column Key. + */ + @SerializedName("key") + val key: String, + + /** + * Column type. + */ + @SerializedName("type") + val type: String, + + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + @SerializedName("status") + val status: String, + + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + @SerializedName("error") + val error: String, + + /** + * Is column required? + */ + @SerializedName("required") + val required: Boolean, + + /** + * Is column an array? + */ + @SerializedName("array") + var array: Boolean?, + + /** + * Column creation date in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Column update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + @SerializedName("default") + var default: Any?, + +) { + fun toMap(): Map = mapOf( + "key" to key as Any, + "type" to type as Any, + "status" to status as Any, + "error" to error as Any, + "required" to required as Any, + "array" to array as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, + "default" to default as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ColumnPoint( + key = map["key"] as String, + type = map["type"] as String, + status = map["status"] as String, + error = map["error"] as String, + required = map["required"] as Boolean, + array = map["array"] as? Boolean?, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, + default = map["default"] as? Any?, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnPolygon.kt b/src/main/kotlin/io/appwrite/models/ColumnPolygon.kt new file mode 100644 index 00000000..93ff49fd --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnPolygon.kt @@ -0,0 +1,94 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * ColumnPolygon + */ +data class ColumnPolygon( + /** + * Column Key. + */ + @SerializedName("key") + val key: String, + + /** + * Column type. + */ + @SerializedName("type") + val type: String, + + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + @SerializedName("status") + val status: String, + + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + @SerializedName("error") + val error: String, + + /** + * Is column required? + */ + @SerializedName("required") + val required: Boolean, + + /** + * Is column an array? + */ + @SerializedName("array") + var array: Boolean?, + + /** + * Column creation date in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Column update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + @SerializedName("default") + var default: Any?, + +) { + fun toMap(): Map = mapOf( + "key" to key as Any, + "type" to type as Any, + "status" to status as Any, + "error" to error as Any, + "required" to required as Any, + "array" to array as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, + "default" to default as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ColumnPolygon( + key = map["key"] as String, + type = map["type"] as String, + status = map["status"] as String, + error = map["error"] as String, + required = map["required"] as Boolean, + array = map["array"] as? Boolean?, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, + default = map["default"] as? Any?, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/services/Account.kt b/src/main/kotlin/io/appwrite/services/Account.kt index 46b5cf36..0b701320 100644 --- a/src/main/kotlin/io/appwrite/services/Account.kt +++ b/src/main/kotlin/io/appwrite/services/Account.kt @@ -1380,7 +1380,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") ) @Throws(AppwriteException::class) suspend fun updateMagicURLSession( @@ -1417,7 +1418,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") ) @Throws(AppwriteException::class) suspend fun updatePhoneSession( diff --git a/src/main/kotlin/io/appwrite/services/Avatars.kt b/src/main/kotlin/io/appwrite/services/Avatars.kt index ee1ead30..ed85e1ad 100644 --- a/src/main/kotlin/io/appwrite/services/Avatars.kt +++ b/src/main/kotlin/io/appwrite/services/Avatars.kt @@ -58,7 +58,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/src/main/kotlin/io/appwrite/services/Databases.kt b/src/main/kotlin/io/appwrite/services/Databases.kt index b9c75a11..d5963e87 100644 --- a/src/main/kotlin/io/appwrite/services/Databases.kt +++ b/src/main/kotlin/io/appwrite/services/Databases.kt @@ -61,8 +61,8 @@ class Databases(client: Client) : Service(client) { * @return [io.appwrite.models.Database] */ @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `TablesDB.createDatabase` instead.", - replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createDatabase") + message = "This API has been deprecated since 1.8.0. Please use `TablesDB.create` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.create") ) @JvmOverloads @Throws(AppwriteException::class) @@ -1211,6 +1211,303 @@ class Databases(client: Client) : Service(client) { ) } + /** + * Create a geometric line attribute. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param key Attribute Key. + * @param required Is attribute required? + * @param default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @return [io.appwrite.models.AttributeLine] + */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `TablesDB.createLineColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createLineColumn") + ) + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createLineAttribute( + databaseId: String, + collectionId: String, + key: String, + required: Boolean, + default: String? = null, + ): io.appwrite.models.AttributeLine { + val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/line" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + + val apiParams = mutableMapOf( + "key" to key, + "required" to required, + "default" to default, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.AttributeLine = { + io.appwrite.models.AttributeLine.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.AttributeLine::class.java, + converter, + ) + } + + /** + * Update a line attribute. Changing the `default` value will not update already existing documents. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param key Attribute Key. + * @param required Is attribute required? + * @param default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param newKey New attribute key. + * @return [io.appwrite.models.AttributeLine] + */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `TablesDB.updateLineColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updateLineColumn") + ) + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateLineAttribute( + databaseId: String, + collectionId: String, + key: String, + required: Boolean, + default: String? = null, + newKey: String? = null, + ): io.appwrite.models.AttributeLine { + val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + .replace("{key}", key) + + val apiParams = mutableMapOf( + "required" to required, + "default" to default, + "newKey" to newKey, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.AttributeLine = { + io.appwrite.models.AttributeLine.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.AttributeLine::class.java, + converter, + ) + } + + /** + * Create a geometric 2d point attribute. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param key Attribute Key. + * @param required Is attribute required? + * @param default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @return [io.appwrite.models.AttributePoint] + */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createPointColumn") + ) + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createPointAttribute( + databaseId: String, + collectionId: String, + key: String, + required: Boolean, + default: String? = null, + ): io.appwrite.models.AttributePoint { + val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/point" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + + val apiParams = mutableMapOf( + "key" to key, + "required" to required, + "default" to default, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.AttributePoint = { + io.appwrite.models.AttributePoint.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.AttributePoint::class.java, + converter, + ) + } + + /** + * Update a point attribute. Changing the `default` value will not update already existing documents. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param key Attribute Key. + * @param required Is attribute required? + * @param default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param newKey New attribute key. + * @return [io.appwrite.models.AttributePoint] + */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updatePointColumn") + ) + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updatePointAttribute( + databaseId: String, + collectionId: String, + key: String, + required: Boolean, + default: String? = null, + newKey: String? = null, + ): io.appwrite.models.AttributePoint { + val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + .replace("{key}", key) + + val apiParams = mutableMapOf( + "required" to required, + "default" to default, + "newKey" to newKey, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.AttributePoint = { + io.appwrite.models.AttributePoint.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.AttributePoint::class.java, + converter, + ) + } + + /** + * Create a geometric polygon attribute. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param key Attribute Key. + * @param required Is attribute required? + * @param default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @return [io.appwrite.models.AttributePolygon] + */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createPolygonColumn") + ) + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createPolygonAttribute( + databaseId: String, + collectionId: String, + key: String, + required: Boolean, + default: String? = null, + ): io.appwrite.models.AttributePolygon { + val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/polygon" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + + val apiParams = mutableMapOf( + "key" to key, + "required" to required, + "default" to default, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.AttributePolygon = { + io.appwrite.models.AttributePolygon.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.AttributePolygon::class.java, + converter, + ) + } + + /** + * Update a polygon attribute. Changing the `default` value will not update already existing documents. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param key Attribute Key. + * @param required Is attribute required? + * @param default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param newKey New attribute key. + * @return [io.appwrite.models.AttributePolygon] + */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updatePolygonColumn") + ) + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updatePolygonAttribute( + databaseId: String, + collectionId: String, + key: String, + required: Boolean, + default: String? = null, + newKey: String? = null, + ): io.appwrite.models.AttributePolygon { + val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + .replace("{key}", key) + + val apiParams = mutableMapOf( + "required" to required, + "default" to default, + "newKey" to newKey, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.AttributePolygon = { + io.appwrite.models.AttributePolygon.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.AttributePolygon::class.java, + converter, + ) + } + /** * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). * diff --git a/src/main/kotlin/io/appwrite/services/Functions.kt b/src/main/kotlin/io/appwrite/services/Functions.kt index 354a07b4..c139d78f 100644 --- a/src/main/kotlin/io/appwrite/services/Functions.kt +++ b/src/main/kotlin/io/appwrite/services/Functions.kt @@ -750,7 +750,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] diff --git a/src/main/kotlin/io/appwrite/services/TablesDb.kt b/src/main/kotlin/io/appwrite/services/TablesDb.kt index a8229df1..ec367b41 100644 --- a/src/main/kotlin/io/appwrite/services/TablesDb.kt +++ b/src/main/kotlin/io/appwrite/services/TablesDb.kt @@ -1110,6 +1110,279 @@ class TablesDB(client: Client) : Service(client) { ) } + /** + * Create a geometric line attribute. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + * @param key Column Key. + * @param required Is column required? + * @param default Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @return [io.appwrite.models.ColumnLine] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createLineColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: String? = null, + ): io.appwrite.models.ColumnLine { + val apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/line" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "key" to key, + "required" to required, + "default" to default, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnLine = { + io.appwrite.models.ColumnLine.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnLine::class.java, + converter, + ) + } + + /** + * Update a line column. Changing the `default` value will not update already existing documents. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + * @param key Column Key. + * @param required Is column required? + * @param default Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param newKey New Column Key. + * @return [io.appwrite.models.ColumnLine] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateLineColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: String? = null, + newKey: String? = null, + ): io.appwrite.models.ColumnLine { + val apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{key}", key) + + val apiParams = mutableMapOf( + "required" to required, + "default" to default, + "newKey" to newKey, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnLine = { + io.appwrite.models.ColumnLine.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnLine::class.java, + converter, + ) + } + + /** + * Create a geometric point attribute. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + * @param key Column Key. + * @param required Is column required? + * @param default Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @return [io.appwrite.models.ColumnPoint] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createPointColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: String? = null, + ): io.appwrite.models.ColumnPoint { + val apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/point" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "key" to key, + "required" to required, + "default" to default, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnPoint = { + io.appwrite.models.ColumnPoint.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnPoint::class.java, + converter, + ) + } + + /** + * Update a point column. Changing the `default` value will not update already existing documents. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + * @param key Column Key. + * @param required Is column required? + * @param default Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param newKey New Column Key. + * @return [io.appwrite.models.ColumnPoint] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updatePointColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: String? = null, + newKey: String? = null, + ): io.appwrite.models.ColumnPoint { + val apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{key}", key) + + val apiParams = mutableMapOf( + "required" to required, + "default" to default, + "newKey" to newKey, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnPoint = { + io.appwrite.models.ColumnPoint.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnPoint::class.java, + converter, + ) + } + + /** + * Create a geometric polygon attribute. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + * @param key Column Key. + * @param required Is column required? + * @param default Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @return [io.appwrite.models.ColumnPolygon] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createPolygonColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: String? = null, + ): io.appwrite.models.ColumnPolygon { + val apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/polygon" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "key" to key, + "required" to required, + "default" to default, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnPolygon = { + io.appwrite.models.ColumnPolygon.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnPolygon::class.java, + converter, + ) + } + + /** + * Update a polygon column. Changing the `default` value will not update already existing documents. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). + * @param key Column Key. + * @param required Is column required? + * @param default Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param newKey New Column Key. + * @return [io.appwrite.models.ColumnPolygon] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updatePolygonColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: String? = null, + newKey: String? = null, + ): io.appwrite.models.ColumnPolygon { + val apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{key}", key) + + val apiParams = mutableMapOf( + "required" to required, + "default" to default, + "newKey" to newKey, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnPolygon = { + io.appwrite.models.ColumnPolygon.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnPolygon::class.java, + converter, + ) + } + /** * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). * From 84b4dacb2879017dc8c18aab210c1c57495b9338 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 5 Sep 2025 02:16:21 +1200 Subject: [PATCH 2/6] Update version --- README.md | 4 ++-- src/main/kotlin/io/appwrite/Client.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6cbe65ff..0aa839d9 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ repositories { Next, add the dependency to your project's `build.gradle(.kts)` file: ```groovy -implementation("io.appwrite:sdk-for-kotlin:10.1.0") +implementation("io.appwrite:sdk-for-kotlin:11.0.0") ``` ### Maven @@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-kotlin - 10.1.0 + 11.0.0 ``` diff --git a/src/main/kotlin/io/appwrite/Client.kt b/src/main/kotlin/io/appwrite/Client.kt index a4952b81..f5d1c6f0 100644 --- a/src/main/kotlin/io/appwrite/Client.kt +++ b/src/main/kotlin/io/appwrite/Client.kt @@ -58,11 +58,11 @@ class Client @JvmOverloads constructor( init { headers = mutableMapOf( "content-type" to "application/json", - "user-agent" to "AppwriteKotlinSDK/10.1.0 ${System.getProperty("http.agent")}", + "user-agent" to "AppwriteKotlinSDK/11.0.0 ${System.getProperty("http.agent")}", "x-sdk-name" to "Kotlin", "x-sdk-platform" to "server", "x-sdk-language" to "kotlin", - "x-sdk-version" to "10.1.0", + "x-sdk-version" to "11.0.0", "x-appwrite-response-format" to "1.8.0", ) From a2ccc8630cf1c823f6364a82c8ced19147ce34be Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 5 Sep 2025 21:42:52 +1200 Subject: [PATCH 3/6] Add spatial queries --- src/main/kotlin/io/appwrite/Query.kt | 60 ++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/main/kotlin/io/appwrite/Query.kt b/src/main/kotlin/io/appwrite/Query.kt index 99e865c9..57ea731a 100644 --- a/src/main/kotlin/io/appwrite/Query.kt +++ b/src/main/kotlin/io/appwrite/Query.kt @@ -77,6 +77,66 @@ 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() + + fun intersects(attribute: String, values: List) = Query("intersects", attribute, values).toJson() + + fun notIntersects(attribute: String, values: List) = Query("notIntersects", attribute, values).toJson() + + fun crosses(attribute: String, values: List) = Query("crosses", attribute, values).toJson() + + fun notCrosses(attribute: String, values: List) = Query("notCrosses", attribute, values).toJson() + + fun overlaps(attribute: String, values: List) = Query("overlaps", attribute, values).toJson() + + fun notOverlaps(attribute: String, values: List) = Query("notOverlaps", attribute, values).toJson() + + fun touches(attribute: String, values: List) = Query("touches", attribute, values).toJson() + + fun notTouches(attribute: String, values: List) = Query("notTouches", attribute, values).toJson() + private fun parseValue(value: Any): List { return when (value) { is List<*> -> value as List From 35ac40ce0532c92bf54ab2f926c68a8cdf032f25 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 5 Sep 2025 22:02:56 +1200 Subject: [PATCH 4/6] Fix refs --- src/main/kotlin/io/appwrite/services/Databases.kt | 2 +- src/main/kotlin/io/appwrite/services/TablesDb.kt | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/io/appwrite/services/Databases.kt b/src/main/kotlin/io/appwrite/services/Databases.kt index d5963e87..45b86c19 100644 --- a/src/main/kotlin/io/appwrite/services/Databases.kt +++ b/src/main/kotlin/io/appwrite/services/Databases.kt @@ -1311,7 +1311,7 @@ class Databases(client: Client) : Service(client) { } /** - * Create a geometric 2d point attribute. + * Create a geometric point attribute. * * @param databaseId Database ID. * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). diff --git a/src/main/kotlin/io/appwrite/services/TablesDb.kt b/src/main/kotlin/io/appwrite/services/TablesDb.kt index ec367b41..36d5b887 100644 --- a/src/main/kotlin/io/appwrite/services/TablesDb.kt +++ b/src/main/kotlin/io/appwrite/services/TablesDb.kt @@ -1111,7 +1111,7 @@ class TablesDB(client: Client) : Service(client) { } /** - * Create a geometric line attribute. + * Create a geometric line column. * * @param databaseId Database ID. * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -1155,7 +1155,7 @@ class TablesDB(client: Client) : Service(client) { } /** - * Update a line column. Changing the `default` value will not update already existing documents. + * Update a line column. Changing the `default` value will not update already existing rows. * * @param databaseId Database ID. * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -1202,7 +1202,7 @@ class TablesDB(client: Client) : Service(client) { } /** - * Create a geometric point attribute. + * Create a geometric point column. * * @param databaseId Database ID. * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -1246,7 +1246,7 @@ class TablesDB(client: Client) : Service(client) { } /** - * Update a point column. Changing the `default` value will not update already existing documents. + * Update a point column. Changing the `default` value will not update already existing rows. * * @param databaseId Database ID. * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -1293,7 +1293,7 @@ class TablesDB(client: Client) : Service(client) { } /** - * Create a geometric polygon attribute. + * Create a geometric polygon column. * * @param databaseId Database ID. * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). @@ -1337,7 +1337,7 @@ class TablesDB(client: Client) : Service(client) { } /** - * Update a polygon column. Changing the `default` value will not update already existing documents. + * Update a polygon column. Changing the `default` value will not update already existing rows. * * @param databaseId Database ID. * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). From 59e570081821faa05af43c01a76aabab690c111f Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Sat, 6 Sep 2025 04:59:14 +1200 Subject: [PATCH 5/6] Fix spatial default --- docs/examples/java/account/update-prefs.md | 6 ++++- .../java/databases/create-document.md | 8 ++++++- .../java/databases/create-line-attribute.md | 2 +- .../java/databases/create-point-attribute.md | 2 +- .../databases/create-polygon-attribute.md | 2 +- .../java/databases/update-line-attribute.md | 2 +- .../java/databases/update-point-attribute.md | 2 +- .../databases/update-polygon-attribute.md | 2 +- .../java/tablesdb/create-line-column.md | 2 +- .../java/tablesdb/create-point-column.md | 2 +- .../java/tablesdb/create-polygon-column.md | 2 +- docs/examples/java/tablesdb/create-row.md | 8 ++++++- .../java/tablesdb/update-line-column.md | 2 +- .../java/tablesdb/update-point-column.md | 2 +- .../java/tablesdb/update-polygon-column.md | 2 +- docs/examples/kotlin/account/update-prefs.md | 6 ++++- .../kotlin/databases/create-document.md | 8 ++++++- .../kotlin/databases/create-line-attribute.md | 2 +- .../databases/create-point-attribute.md | 2 +- .../databases/create-polygon-attribute.md | 2 +- .../kotlin/databases/update-line-attribute.md | 2 +- .../databases/update-point-attribute.md | 2 +- .../databases/update-polygon-attribute.md | 2 +- .../kotlin/tablesdb/create-line-column.md | 2 +- .../kotlin/tablesdb/create-point-column.md | 2 +- .../kotlin/tablesdb/create-polygon-column.md | 2 +- docs/examples/kotlin/tablesdb/create-row.md | 8 ++++++- .../kotlin/tablesdb/update-line-column.md | 2 +- .../kotlin/tablesdb/update-point-column.md | 2 +- .../kotlin/tablesdb/update-polygon-column.md | 2 +- .../io/appwrite/models/AttributeLine.kt | 4 ++-- .../io/appwrite/models/AttributePoint.kt | 4 ++-- .../io/appwrite/models/AttributePolygon.kt | 4 ++-- .../kotlin/io/appwrite/models/ColumnLine.kt | 4 ++-- .../kotlin/io/appwrite/models/ColumnPoint.kt | 4 ++-- .../io/appwrite/models/ColumnPolygon.kt | 4 ++-- .../kotlin/io/appwrite/services/Databases.kt | 24 +++++++++---------- .../kotlin/io/appwrite/services/TablesDb.kt | 24 +++++++++---------- 38 files changed, 98 insertions(+), 66 deletions(-) diff --git a/docs/examples/java/account/update-prefs.md b/docs/examples/java/account/update-prefs.md index 0e900d0a..0b689391 100644 --- a/docs/examples/java/account/update-prefs.md +++ b/docs/examples/java/account/update-prefs.md @@ -10,7 +10,11 @@ Client client = new Client() 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 5231be33..d5e777d1 100644 --- a/docs/examples/java/databases/create-document.md +++ b/docs/examples/java/databases/create-document.md @@ -13,7 +13,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/databases/create-line-attribute.md b/docs/examples/java/databases/create-line-attribute.md index 36f79b94..b8ff15a3 100644 --- a/docs/examples/java/databases/create-line-attribute.md +++ b/docs/examples/java/databases/create-line-attribute.md @@ -14,7 +14,7 @@ databases.createLineAttribute( "", // collectionId "", // key false, // required - "", // default (optional) + listOf([1,2], [3, 4]), // default (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/databases/create-point-attribute.md b/docs/examples/java/databases/create-point-attribute.md index 5a8a39b0..f4064619 100644 --- a/docs/examples/java/databases/create-point-attribute.md +++ b/docs/examples/java/databases/create-point-attribute.md @@ -14,7 +14,7 @@ databases.createPointAttribute( "", // collectionId "", // key false, // required - "", // default (optional) + listOf([1,2], [3, 4]), // default (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/databases/create-polygon-attribute.md b/docs/examples/java/databases/create-polygon-attribute.md index 22ee4d5c..2fc5e8b4 100644 --- a/docs/examples/java/databases/create-polygon-attribute.md +++ b/docs/examples/java/databases/create-polygon-attribute.md @@ -14,7 +14,7 @@ databases.createPolygonAttribute( "", // collectionId "", // key false, // required - "", // default (optional) + listOf([1,2], [3, 4]), // default (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/databases/update-line-attribute.md b/docs/examples/java/databases/update-line-attribute.md index 7c834761..3f410481 100644 --- a/docs/examples/java/databases/update-line-attribute.md +++ b/docs/examples/java/databases/update-line-attribute.md @@ -14,7 +14,7 @@ databases.updateLineAttribute( "", // collectionId "", // key false, // required - "", // default (optional) + listOf([1,2], [3, 4]), // default (optional) "", // newKey (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/databases/update-point-attribute.md b/docs/examples/java/databases/update-point-attribute.md index b0a233f6..7a8cb2a8 100644 --- a/docs/examples/java/databases/update-point-attribute.md +++ b/docs/examples/java/databases/update-point-attribute.md @@ -14,7 +14,7 @@ databases.updatePointAttribute( "", // collectionId "", // key false, // required - "", // default (optional) + listOf([1,2], [3, 4]), // default (optional) "", // newKey (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/databases/update-polygon-attribute.md b/docs/examples/java/databases/update-polygon-attribute.md index 1d365896..682e21d7 100644 --- a/docs/examples/java/databases/update-polygon-attribute.md +++ b/docs/examples/java/databases/update-polygon-attribute.md @@ -14,7 +14,7 @@ databases.updatePolygonAttribute( "", // collectionId "", // key false, // required - "", // default (optional) + listOf([1,2], [3, 4]), // default (optional) "", // newKey (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/tablesdb/create-line-column.md b/docs/examples/java/tablesdb/create-line-column.md index 64952912..96a0381b 100644 --- a/docs/examples/java/tablesdb/create-line-column.md +++ b/docs/examples/java/tablesdb/create-line-column.md @@ -14,7 +14,7 @@ tablesDB.createLineColumn( "", // tableId "", // key false, // required - "", // default (optional) + listOf([1,2], [3, 4]), // default (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/tablesdb/create-point-column.md b/docs/examples/java/tablesdb/create-point-column.md index d0ddef98..51c0e64d 100644 --- a/docs/examples/java/tablesdb/create-point-column.md +++ b/docs/examples/java/tablesdb/create-point-column.md @@ -14,7 +14,7 @@ tablesDB.createPointColumn( "", // tableId "", // key false, // required - "", // default (optional) + listOf([1,2], [3, 4]), // default (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/tablesdb/create-polygon-column.md b/docs/examples/java/tablesdb/create-polygon-column.md index 3aa5487c..e5a65026 100644 --- a/docs/examples/java/tablesdb/create-polygon-column.md +++ b/docs/examples/java/tablesdb/create-polygon-column.md @@ -14,7 +14,7 @@ tablesDB.createPolygonColumn( "", // tableId "", // key false, // required - "", // default (optional) + listOf([1,2], [3, 4]), // default (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/tablesdb/create-row.md b/docs/examples/java/tablesdb/create-row.md index 41450220..6c7d8470 100644 --- a/docs/examples/java/tablesdb/create-row.md +++ b/docs/examples/java/tablesdb/create-row.md @@ -13,7 +13,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/java/tablesdb/update-line-column.md b/docs/examples/java/tablesdb/update-line-column.md index a1a0c67f..fbf151dd 100644 --- a/docs/examples/java/tablesdb/update-line-column.md +++ b/docs/examples/java/tablesdb/update-line-column.md @@ -14,7 +14,7 @@ tablesDB.updateLineColumn( "", // tableId "", // key false, // required - "", // default (optional) + listOf([1,2], [3, 4]), // default (optional) "", // newKey (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/tablesdb/update-point-column.md b/docs/examples/java/tablesdb/update-point-column.md index 45565063..f506e719 100644 --- a/docs/examples/java/tablesdb/update-point-column.md +++ b/docs/examples/java/tablesdb/update-point-column.md @@ -14,7 +14,7 @@ tablesDB.updatePointColumn( "", // tableId "", // key false, // required - "", // default (optional) + listOf([1,2], [3, 4]), // default (optional) "", // newKey (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/tablesdb/update-polygon-column.md b/docs/examples/java/tablesdb/update-polygon-column.md index d7757bd5..e391aed8 100644 --- a/docs/examples/java/tablesdb/update-polygon-column.md +++ b/docs/examples/java/tablesdb/update-polygon-column.md @@ -14,7 +14,7 @@ tablesDB.updatePolygonColumn( "", // tableId "", // key false, // required - "", // default (optional) + listOf([1,2], [3, 4]), // default (optional) "", // newKey (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 dafee7c0..63e66ca4 100644 --- a/docs/examples/kotlin/account/update-prefs.md +++ b/docs/examples/kotlin/account/update-prefs.md @@ -10,5 +10,9 @@ val client = Client() val account = Account(client) val response = account.updatePrefs( - prefs = mapOf( "a" to "b" ) + prefs = mapOf( + "language" to "en", + "timezone" to "UTC", + "darkTheme" to true + ) ) diff --git a/docs/examples/kotlin/databases/create-document.md b/docs/examples/kotlin/databases/create-document.md index 695fdbdf..1c1d6287 100644 --- a/docs/examples/kotlin/databases/create-document.md +++ b/docs/examples/kotlin/databases/create-document.md @@ -13,6 +13,12 @@ val response = 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 ) diff --git a/docs/examples/kotlin/databases/create-line-attribute.md b/docs/examples/kotlin/databases/create-line-attribute.md index 187f875c..1b196374 100644 --- a/docs/examples/kotlin/databases/create-line-attribute.md +++ b/docs/examples/kotlin/databases/create-line-attribute.md @@ -14,5 +14,5 @@ val response = databases.createLineAttribute( collectionId = "", key = "", required = false, - default = "" // optional + default = listOf([1,2], [3, 4]) // optional ) diff --git a/docs/examples/kotlin/databases/create-point-attribute.md b/docs/examples/kotlin/databases/create-point-attribute.md index d6915c1f..ed279445 100644 --- a/docs/examples/kotlin/databases/create-point-attribute.md +++ b/docs/examples/kotlin/databases/create-point-attribute.md @@ -14,5 +14,5 @@ val response = databases.createPointAttribute( collectionId = "", key = "", required = false, - default = "" // optional + default = listOf([1,2], [3, 4]) // optional ) diff --git a/docs/examples/kotlin/databases/create-polygon-attribute.md b/docs/examples/kotlin/databases/create-polygon-attribute.md index 0a229625..006c8e3c 100644 --- a/docs/examples/kotlin/databases/create-polygon-attribute.md +++ b/docs/examples/kotlin/databases/create-polygon-attribute.md @@ -14,5 +14,5 @@ val response = databases.createPolygonAttribute( collectionId = "", key = "", required = false, - default = "" // optional + default = listOf([1,2], [3, 4]) // optional ) diff --git a/docs/examples/kotlin/databases/update-line-attribute.md b/docs/examples/kotlin/databases/update-line-attribute.md index c4b515ad..3b5b78b5 100644 --- a/docs/examples/kotlin/databases/update-line-attribute.md +++ b/docs/examples/kotlin/databases/update-line-attribute.md @@ -14,6 +14,6 @@ val response = databases.updateLineAttribute( collectionId = "", key = "", required = false, - default = "", // optional + default = listOf([1,2], [3, 4]), // optional newKey = "" // optional ) diff --git a/docs/examples/kotlin/databases/update-point-attribute.md b/docs/examples/kotlin/databases/update-point-attribute.md index 02bca873..2738fdbf 100644 --- a/docs/examples/kotlin/databases/update-point-attribute.md +++ b/docs/examples/kotlin/databases/update-point-attribute.md @@ -14,6 +14,6 @@ val response = databases.updatePointAttribute( collectionId = "", key = "", required = false, - default = "", // optional + default = listOf([1,2], [3, 4]), // optional newKey = "" // optional ) diff --git a/docs/examples/kotlin/databases/update-polygon-attribute.md b/docs/examples/kotlin/databases/update-polygon-attribute.md index b8c0fc94..e2d97d8e 100644 --- a/docs/examples/kotlin/databases/update-polygon-attribute.md +++ b/docs/examples/kotlin/databases/update-polygon-attribute.md @@ -14,6 +14,6 @@ val response = databases.updatePolygonAttribute( collectionId = "", key = "", required = false, - default = "", // optional + default = listOf([1,2], [3, 4]), // optional newKey = "" // optional ) diff --git a/docs/examples/kotlin/tablesdb/create-line-column.md b/docs/examples/kotlin/tablesdb/create-line-column.md index 0993eed9..e867887d 100644 --- a/docs/examples/kotlin/tablesdb/create-line-column.md +++ b/docs/examples/kotlin/tablesdb/create-line-column.md @@ -14,5 +14,5 @@ val response = tablesDB.createLineColumn( tableId = "", key = "", required = false, - default = "" // optional + default = listOf([1,2], [3, 4]) // optional ) diff --git a/docs/examples/kotlin/tablesdb/create-point-column.md b/docs/examples/kotlin/tablesdb/create-point-column.md index e18bfc34..6340b375 100644 --- a/docs/examples/kotlin/tablesdb/create-point-column.md +++ b/docs/examples/kotlin/tablesdb/create-point-column.md @@ -14,5 +14,5 @@ val response = tablesDB.createPointColumn( tableId = "", key = "", required = false, - default = "" // optional + default = listOf([1,2], [3, 4]) // optional ) diff --git a/docs/examples/kotlin/tablesdb/create-polygon-column.md b/docs/examples/kotlin/tablesdb/create-polygon-column.md index 2f8ffd81..d11c9549 100644 --- a/docs/examples/kotlin/tablesdb/create-polygon-column.md +++ b/docs/examples/kotlin/tablesdb/create-polygon-column.md @@ -14,5 +14,5 @@ val response = tablesDB.createPolygonColumn( tableId = "", key = "", required = false, - default = "" // optional + default = listOf([1,2], [3, 4]) // optional ) diff --git a/docs/examples/kotlin/tablesdb/create-row.md b/docs/examples/kotlin/tablesdb/create-row.md index 6a5b1881..774800d8 100644 --- a/docs/examples/kotlin/tablesdb/create-row.md +++ b/docs/examples/kotlin/tablesdb/create-row.md @@ -13,6 +13,12 @@ val response = 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 ) diff --git a/docs/examples/kotlin/tablesdb/update-line-column.md b/docs/examples/kotlin/tablesdb/update-line-column.md index 05781dd6..9f6d976a 100644 --- a/docs/examples/kotlin/tablesdb/update-line-column.md +++ b/docs/examples/kotlin/tablesdb/update-line-column.md @@ -14,6 +14,6 @@ val response = tablesDB.updateLineColumn( tableId = "", key = "", required = false, - default = "", // optional + default = listOf([1,2], [3, 4]), // optional newKey = "" // optional ) diff --git a/docs/examples/kotlin/tablesdb/update-point-column.md b/docs/examples/kotlin/tablesdb/update-point-column.md index 947b4410..4d28299b 100644 --- a/docs/examples/kotlin/tablesdb/update-point-column.md +++ b/docs/examples/kotlin/tablesdb/update-point-column.md @@ -14,6 +14,6 @@ val response = tablesDB.updatePointColumn( tableId = "", key = "", required = false, - default = "", // optional + default = listOf([1,2], [3, 4]), // optional newKey = "" // optional ) diff --git a/docs/examples/kotlin/tablesdb/update-polygon-column.md b/docs/examples/kotlin/tablesdb/update-polygon-column.md index b9da6350..0599559b 100644 --- a/docs/examples/kotlin/tablesdb/update-polygon-column.md +++ b/docs/examples/kotlin/tablesdb/update-polygon-column.md @@ -14,6 +14,6 @@ val response = tablesDB.updatePolygonColumn( tableId = "", key = "", required = false, - default = "", // optional + default = listOf([1,2], [3, 4]), // optional newKey = "" // optional ) diff --git a/src/main/kotlin/io/appwrite/models/AttributeLine.kt b/src/main/kotlin/io/appwrite/models/AttributeLine.kt index 60098ac1..cd1e9773 100644 --- a/src/main/kotlin/io/appwrite/models/AttributeLine.kt +++ b/src/main/kotlin/io/appwrite/models/AttributeLine.kt @@ -59,7 +59,7 @@ data class AttributeLine( * Default value for attribute when not provided. Cannot be set when attribute is required. */ @SerializedName("default") - var default: Any?, + var default: List?, ) { fun toMap(): Map = mapOf( @@ -88,7 +88,7 @@ data class AttributeLine( array = map["array"] as? Boolean?, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - default = map["default"] as? Any?, + default = map["default"] as? List?, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/AttributePoint.kt b/src/main/kotlin/io/appwrite/models/AttributePoint.kt index 24a67a7e..b32c1c0a 100644 --- a/src/main/kotlin/io/appwrite/models/AttributePoint.kt +++ b/src/main/kotlin/io/appwrite/models/AttributePoint.kt @@ -59,7 +59,7 @@ data class AttributePoint( * Default value for attribute when not provided. Cannot be set when attribute is required. */ @SerializedName("default") - var default: Any?, + var default: List?, ) { fun toMap(): Map = mapOf( @@ -88,7 +88,7 @@ data class AttributePoint( array = map["array"] as? Boolean?, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - default = map["default"] as? Any?, + default = map["default"] as? List?, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/AttributePolygon.kt b/src/main/kotlin/io/appwrite/models/AttributePolygon.kt index f5fc9faf..bcccce1c 100644 --- a/src/main/kotlin/io/appwrite/models/AttributePolygon.kt +++ b/src/main/kotlin/io/appwrite/models/AttributePolygon.kt @@ -59,7 +59,7 @@ data class AttributePolygon( * Default value for attribute when not provided. Cannot be set when attribute is required. */ @SerializedName("default") - var default: Any?, + var default: List?, ) { fun toMap(): Map = mapOf( @@ -88,7 +88,7 @@ data class AttributePolygon( array = map["array"] as? Boolean?, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - default = map["default"] as? Any?, + default = map["default"] as? List?, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnLine.kt b/src/main/kotlin/io/appwrite/models/ColumnLine.kt index 0311b125..65918218 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnLine.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnLine.kt @@ -59,7 +59,7 @@ data class ColumnLine( * Default value for column when not provided. Cannot be set when column is required. */ @SerializedName("default") - var default: Any?, + var default: List?, ) { fun toMap(): Map = mapOf( @@ -88,7 +88,7 @@ data class ColumnLine( array = map["array"] as? Boolean?, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - default = map["default"] as? Any?, + default = map["default"] as? List?, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnPoint.kt b/src/main/kotlin/io/appwrite/models/ColumnPoint.kt index 0f5945ca..fd842b19 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnPoint.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnPoint.kt @@ -59,7 +59,7 @@ data class ColumnPoint( * Default value for column when not provided. Cannot be set when column is required. */ @SerializedName("default") - var default: Any?, + var default: List?, ) { fun toMap(): Map = mapOf( @@ -88,7 +88,7 @@ data class ColumnPoint( array = map["array"] as? Boolean?, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - default = map["default"] as? Any?, + default = map["default"] as? List?, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnPolygon.kt b/src/main/kotlin/io/appwrite/models/ColumnPolygon.kt index 93ff49fd..e1c4268b 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnPolygon.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnPolygon.kt @@ -59,7 +59,7 @@ data class ColumnPolygon( * Default value for column when not provided. Cannot be set when column is required. */ @SerializedName("default") - var default: Any?, + var default: List?, ) { fun toMap(): Map = mapOf( @@ -88,7 +88,7 @@ data class ColumnPolygon( array = map["array"] as? Boolean?, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - default = map["default"] as? Any?, + default = map["default"] as? List?, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/services/Databases.kt b/src/main/kotlin/io/appwrite/services/Databases.kt index 45b86c19..59dd7699 100644 --- a/src/main/kotlin/io/appwrite/services/Databases.kt +++ b/src/main/kotlin/io/appwrite/services/Databases.kt @@ -1218,7 +1218,7 @@ class Databases(client: Client) : Service(client) { * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param key Attribute Key. * @param required Is attribute required? - * @param default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param default Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. * @return [io.appwrite.models.AttributeLine] */ @Deprecated( @@ -1232,7 +1232,7 @@ class Databases(client: Client) : Service(client) { collectionId: String, key: String, required: Boolean, - default: String? = null, + default: List? = null, ): io.appwrite.models.AttributeLine { val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/line" .replace("{databaseId}", databaseId) @@ -1266,7 +1266,7 @@ class Databases(client: Client) : Service(client) { * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). * @param key Attribute Key. * @param required Is attribute required? - * @param default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param default Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. * @param newKey New attribute key. * @return [io.appwrite.models.AttributeLine] */ @@ -1281,7 +1281,7 @@ class Databases(client: Client) : Service(client) { collectionId: String, key: String, required: Boolean, - default: String? = null, + default: List? = null, newKey: String? = null, ): io.appwrite.models.AttributeLine { val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}" @@ -1317,7 +1317,7 @@ class Databases(client: Client) : Service(client) { * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param key Attribute Key. * @param required Is attribute required? - * @param default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param default Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. * @return [io.appwrite.models.AttributePoint] */ @Deprecated( @@ -1331,7 +1331,7 @@ class Databases(client: Client) : Service(client) { collectionId: String, key: String, required: Boolean, - default: String? = null, + default: List? = null, ): io.appwrite.models.AttributePoint { val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/point" .replace("{databaseId}", databaseId) @@ -1365,7 +1365,7 @@ class Databases(client: Client) : Service(client) { * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). * @param key Attribute Key. * @param required Is attribute required? - * @param default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param default Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. * @param newKey New attribute key. * @return [io.appwrite.models.AttributePoint] */ @@ -1380,7 +1380,7 @@ class Databases(client: Client) : Service(client) { collectionId: String, key: String, required: Boolean, - default: String? = null, + default: List? = null, newKey: String? = null, ): io.appwrite.models.AttributePoint { val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}" @@ -1416,7 +1416,7 @@ class Databases(client: Client) : Service(client) { * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param key Attribute Key. * @param required Is attribute required? - * @param default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param default Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. * @return [io.appwrite.models.AttributePolygon] */ @Deprecated( @@ -1430,7 +1430,7 @@ class Databases(client: Client) : Service(client) { collectionId: String, key: String, required: Boolean, - default: String? = null, + default: List? = null, ): io.appwrite.models.AttributePolygon { val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/polygon" .replace("{databaseId}", databaseId) @@ -1464,7 +1464,7 @@ class Databases(client: Client) : Service(client) { * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). * @param key Attribute Key. * @param required Is attribute required? - * @param default Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @param default Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. * @param newKey New attribute key. * @return [io.appwrite.models.AttributePolygon] */ @@ -1479,7 +1479,7 @@ class Databases(client: Client) : Service(client) { collectionId: String, key: String, required: Boolean, - default: String? = null, + default: List? = null, newKey: String? = null, ): io.appwrite.models.AttributePolygon { val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}" diff --git a/src/main/kotlin/io/appwrite/services/TablesDb.kt b/src/main/kotlin/io/appwrite/services/TablesDb.kt index 36d5b887..f4255988 100644 --- a/src/main/kotlin/io/appwrite/services/TablesDb.kt +++ b/src/main/kotlin/io/appwrite/services/TablesDb.kt @@ -1117,7 +1117,7 @@ class TablesDB(client: Client) : Service(client) { * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @param key Column Key. * @param required Is column required? - * @param default Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param default Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. * @return [io.appwrite.models.ColumnLine] */ @JvmOverloads @@ -1127,7 +1127,7 @@ class TablesDB(client: Client) : Service(client) { tableId: String, key: String, required: Boolean, - default: String? = null, + default: List? = null, ): io.appwrite.models.ColumnLine { val apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/line" .replace("{databaseId}", databaseId) @@ -1161,7 +1161,7 @@ class TablesDB(client: Client) : Service(client) { * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @param key Column Key. * @param required Is column required? - * @param default Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param default Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. * @param newKey New Column Key. * @return [io.appwrite.models.ColumnLine] */ @@ -1172,7 +1172,7 @@ class TablesDB(client: Client) : Service(client) { tableId: String, key: String, required: Boolean, - default: String? = null, + default: List? = null, newKey: String? = null, ): io.appwrite.models.ColumnLine { val apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}" @@ -1208,7 +1208,7 @@ class TablesDB(client: Client) : Service(client) { * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @param key Column Key. * @param required Is column required? - * @param default Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param default Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. * @return [io.appwrite.models.ColumnPoint] */ @JvmOverloads @@ -1218,7 +1218,7 @@ class TablesDB(client: Client) : Service(client) { tableId: String, key: String, required: Boolean, - default: String? = null, + default: List? = null, ): io.appwrite.models.ColumnPoint { val apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/point" .replace("{databaseId}", databaseId) @@ -1252,7 +1252,7 @@ class TablesDB(client: Client) : Service(client) { * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @param key Column Key. * @param required Is column required? - * @param default Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param default Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. * @param newKey New Column Key. * @return [io.appwrite.models.ColumnPoint] */ @@ -1263,7 +1263,7 @@ class TablesDB(client: Client) : Service(client) { tableId: String, key: String, required: Boolean, - default: String? = null, + default: List? = null, newKey: String? = null, ): io.appwrite.models.ColumnPoint { val apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}" @@ -1299,7 +1299,7 @@ class TablesDB(client: Client) : Service(client) { * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @param key Column Key. * @param required Is column required? - * @param default Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param default Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. * @return [io.appwrite.models.ColumnPolygon] */ @JvmOverloads @@ -1309,7 +1309,7 @@ class TablesDB(client: Client) : Service(client) { tableId: String, key: String, required: Boolean, - default: String? = null, + default: List? = null, ): io.appwrite.models.ColumnPolygon { val apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/polygon" .replace("{databaseId}", databaseId) @@ -1343,7 +1343,7 @@ class TablesDB(client: Client) : Service(client) { * @param tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @param key Column Key. * @param required Is column required? - * @param default Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @param default Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. * @param newKey New Column Key. * @return [io.appwrite.models.ColumnPolygon] */ @@ -1354,7 +1354,7 @@ class TablesDB(client: Client) : Service(client) { tableId: String, key: String, required: Boolean, - default: String? = null, + default: List? = null, newKey: String? = null, ): io.appwrite.models.ColumnPolygon { val apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}" From e6e57efd19125086f724bdabeb88d7e8d54cd235 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 8 Sep 2025 21:43:45 +1200 Subject: [PATCH 6/6] Update spatial queries --- src/main/kotlin/io/appwrite/Query.kt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/kotlin/io/appwrite/Query.kt b/src/main/kotlin/io/appwrite/Query.kt index 57ea731a..2a544394 100644 --- a/src/main/kotlin/io/appwrite/Query.kt +++ b/src/main/kotlin/io/appwrite/Query.kt @@ -86,7 +86,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. @@ -97,7 +97,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. @@ -108,7 +108,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. @@ -119,23 +119,23 @@ 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() - fun intersects(attribute: String, values: List) = Query("intersects", attribute, values).toJson() + fun intersects(attribute: String, values: List) = Query("intersects", attribute, listOf(values)).toJson() - fun notIntersects(attribute: String, values: List) = Query("notIntersects", attribute, values).toJson() + fun notIntersects(attribute: String, values: List) = Query("notIntersects", attribute, listOf(values)).toJson() - fun crosses(attribute: String, values: List) = Query("crosses", attribute, values).toJson() + fun crosses(attribute: String, values: List) = Query("crosses", attribute, listOf(values)).toJson() - fun notCrosses(attribute: String, values: List) = Query("notCrosses", attribute, values).toJson() + fun notCrosses(attribute: String, values: List) = Query("notCrosses", attribute, listOf(values)).toJson() - fun overlaps(attribute: String, values: List) = Query("overlaps", attribute, values).toJson() + fun overlaps(attribute: String, values: List) = Query("overlaps", attribute, listOf(values)).toJson() - fun notOverlaps(attribute: String, values: List) = Query("notOverlaps", attribute, values).toJson() + fun notOverlaps(attribute: String, values: List) = Query("notOverlaps", attribute, listOf(values)).toJson() - fun touches(attribute: String, values: List) = Query("touches", attribute, values).toJson() + fun touches(attribute: String, values: List) = Query("touches", attribute, listOf(values)).toJson() - fun notTouches(attribute: String, values: List) = Query("notTouches", attribute, values).toJson() + fun notTouches(attribute: String, values: List) = Query("notTouches", attribute, listOf(values)).toJson() private fun parseValue(value: Any): List { return when (value) {