diff --git a/README.md b/README.md index 8469be2..0aa839d 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:11.0.0") ``` ### Maven @@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-kotlin - 10.0.0 + 11.0.0 ``` diff --git a/docs/examples/java/account/update-prefs.md b/docs/examples/java/account/update-prefs.md index 0e900d0..0b68939 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 5231be3..d5e777d 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 new file mode 100644 index 0000000..b8ff15a --- /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 + listOf([1,2], [3, 4]), // 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 0000000..f406461 --- /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 + listOf([1,2], [3, 4]), // 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 0000000..2fc5e8b --- /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 + listOf([1,2], [3, 4]), // 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 0000000..3f41048 --- /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 + listOf([1,2], [3, 4]), // 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 0000000..7a8cb2a --- /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 + listOf([1,2], [3, 4]), // 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 0000000..682e21d --- /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 + listOf([1,2], [3, 4]), // 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 0000000..96a0381 --- /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 + listOf([1,2], [3, 4]), // 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 0000000..51c0e64 --- /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 + listOf([1,2], [3, 4]), // 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 0000000..e5a6502 --- /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 + listOf([1,2], [3, 4]), // default (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/create-row.md b/docs/examples/java/tablesdb/create-row.md index 4145022..6c7d847 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 new file mode 100644 index 0000000..fbf151d --- /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 + listOf([1,2], [3, 4]), // 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 0000000..f506e71 --- /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 + listOf([1,2], [3, 4]), // 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 0000000..e391aed --- /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 + listOf([1,2], [3, 4]), // default (optional) + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/kotlin/account/update-prefs.md b/docs/examples/kotlin/account/update-prefs.md index dafee7c..63e66ca 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 695fdbd..1c1d628 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 new file mode 100644 index 0000000..1b19637 --- /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 = 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 new file mode 100644 index 0000000..ed27944 --- /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 = 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 new file mode 100644 index 0000000..006c8e3 --- /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 = 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 new file mode 100644 index 0000000..3b5b78b --- /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 = 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 new file mode 100644 index 0000000..2738fdb --- /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 = 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 new file mode 100644 index 0000000..e2d97d8 --- /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 = 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 new file mode 100644 index 0000000..e867887 --- /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 = 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 new file mode 100644 index 0000000..6340b37 --- /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 = 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 new file mode 100644 index 0000000..d11c954 --- /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 = 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 6a5b188..774800d 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 new file mode 100644 index 0000000..9f6d976 --- /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 = 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 new file mode 100644 index 0000000..4d28299 --- /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 = 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 new file mode 100644 index 0000000..0599559 --- /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 = listOf([1,2], [3, 4]), // optional + newKey = "" // optional +) diff --git a/src/main/kotlin/io/appwrite/Client.kt b/src/main/kotlin/io/appwrite/Client.kt index 41a6878..f5d1c6f 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/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.0.0", + "x-sdk-version" to "11.0.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 bb34452..2a54439 100644 --- a/src/main/kotlin/io/appwrite/Query.kt +++ b/src/main/kotlin/io/appwrite/Query.kt @@ -65,14 +65,78 @@ 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() + /** + * 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(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(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(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(listOf(values, distance, meters))).toJson() + + fun intersects(attribute: String, values: List) = Query("intersects", attribute, listOf(values)).toJson() + + fun notIntersects(attribute: String, values: List) = Query("notIntersects", attribute, listOf(values)).toJson() + + fun crosses(attribute: String, values: List) = Query("crosses", attribute, listOf(values)).toJson() + + fun notCrosses(attribute: String, values: List) = Query("notCrosses", attribute, listOf(values)).toJson() + + fun overlaps(attribute: String, values: List) = Query("overlaps", attribute, listOf(values)).toJson() + + fun notOverlaps(attribute: String, values: List) = Query("notOverlaps", attribute, listOf(values)).toJson() + + fun touches(attribute: String, values: List) = Query("touches", attribute, listOf(values)).toJson() + + fun notTouches(attribute: String, values: List) = Query("notTouches", attribute, listOf(values)).toJson() + private fun parseValue(value: Any): List { return when (value) { is List<*> -> value as List diff --git a/src/main/kotlin/io/appwrite/enums/CreditCard.kt b/src/main/kotlin/io/appwrite/enums/CreditCard.kt index 1826304..ab9b215 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 946fdb3..1595981 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 050f076..eeebc06 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 0000000..cd1e977 --- /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: List?, + +) { + 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? 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 new file mode 100644 index 0000000..b32c1c0 --- /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: List?, + +) { + 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? 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 new file mode 100644 index 0000000..bcccce1 --- /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: List?, + +) { + 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? 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 new file mode 100644 index 0000000..6591821 --- /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: List?, + +) { + 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? 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 new file mode 100644 index 0000000..fd842b1 --- /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: List?, + +) { + 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? 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 new file mode 100644 index 0000000..e1c4268 --- /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: List?, + +) { + 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? List?, + ) + } +} \ 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 46b5cf3..0b70132 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 ee1ead3..ed85e1a 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 b9c75a1..59dd769 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, 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( + 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: List? = 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, 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] + */ + @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: List? = 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 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, array of two numbers [longitude, latitude], representing a single coordinate. 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: List? = 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, 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] + */ + @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: List? = 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, 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( + 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: List? = 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, 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] + */ + @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: List? = 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 354a07b..c139d78 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 a8229df..f425598 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 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). + * @param key Column Key. + * @param required Is column 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 + @Throws(AppwriteException::class) + suspend fun createLineColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: List? = 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 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). + * @param key Column Key. + * @param required Is column 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] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateLineColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: List? = 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 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). + * @param key Column Key. + * @param required Is column 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 + @Throws(AppwriteException::class) + suspend fun createPointColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: List? = 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 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). + * @param key Column Key. + * @param required Is column 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] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updatePointColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: List? = 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 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). + * @param key Column Key. + * @param required Is column 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 + @Throws(AppwriteException::class) + suspend fun createPolygonColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: List? = 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 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). + * @param key Column Key. + * @param required Is column 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] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updatePolygonColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: List? = 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). *