From 928d9cedc8c1ec71b6d9cfffc3c20ad85a0c33ed Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 18 Jul 2025 12:51:55 +1200 Subject: [PATCH 1/5] Add inc/dec --- README.md | 6 +- .../java/databases/create-document.md | 1 + .../databases/decrement-document-attribute.md | 28 ++ .../databases/increment-document-attribute.md | 28 ++ .../java/databases/upsert-document.md | 27 ++ .../java/databases/upsert-documents.md | 2 +- .../kotlin/databases/create-document.md | 1 + .../databases/decrement-document-attribute.md | 19 ++ .../databases/increment-document-attribute.md | 19 ++ .../kotlin/databases/upsert-document.md | 18 ++ .../kotlin/databases/upsert-documents.md | 2 +- src/main/kotlin/io/appwrite/Client.kt | 4 +- .../kotlin/io/appwrite/enums/BuildRuntime.kt | 6 +- .../kotlin/io/appwrite/enums/ImageFormat.kt | 4 +- src/main/kotlin/io/appwrite/enums/Runtime.kt | 6 +- .../io/appwrite/models/AttributeString.kt | 8 + .../kotlin/io/appwrite/models/Document.kt | 10 + .../kotlin/io/appwrite/services/Databases.kt | 250 +++++++++++++++++- .../kotlin/io/appwrite/services/Tokens.kt | 2 +- src/main/kotlin/io/appwrite/services/Users.kt | 2 +- 20 files changed, 419 insertions(+), 24 deletions(-) create mode 100644 docs/examples/java/databases/decrement-document-attribute.md create mode 100644 docs/examples/java/databases/increment-document-attribute.md create mode 100644 docs/examples/java/databases/upsert-document.md create mode 100644 docs/examples/kotlin/databases/decrement-document-attribute.md create mode 100644 docs/examples/kotlin/databases/increment-document-attribute.md create mode 100644 docs/examples/kotlin/databases/upsert-document.md diff --git a/README.md b/README.md index b9997e1..126160d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![Maven Central](https://img.shields.io/maven-central/v/io.appwrite/sdk-for-kotlin.svg?color=green&style=flat-square) ![License](https://img.shields.io/github/license/appwrite/sdk-for-kotlin.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.7.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) @@ -39,7 +39,7 @@ repositories { Next, add the dependency to your project's `build.gradle(.kts)` file: ```groovy -implementation("io.appwrite:sdk-for-kotlin:9.0.0") +implementation("io.appwrite:sdk-for-kotlin:9.1.0") ``` ### Maven @@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-kotlin - 9.0.0 + 9.1.0 ``` diff --git a/docs/examples/java/databases/create-document.md b/docs/examples/java/databases/create-document.md index 368b816..c71bc61 100644 --- a/docs/examples/java/databases/create-document.md +++ b/docs/examples/java/databases/create-document.md @@ -4,6 +4,7 @@ import io.appwrite.services.Databases; Client client = new Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setAdmin("") // .setSession("") // The user session to authenticate with .setKey("") // Your secret API key .setJWT(""); // Your secret JSON Web Token diff --git a/docs/examples/java/databases/decrement-document-attribute.md b/docs/examples/java/databases/decrement-document-attribute.md new file mode 100644 index 0000000..34b7472 --- /dev/null +++ b/docs/examples/java/databases/decrement-document-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.decrementDocumentAttribute( + "", // databaseId + "", // collectionId + "", // documentId + "", // attribute + 0, // value (optional) + 0, // min (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/databases/increment-document-attribute.md b/docs/examples/java/databases/increment-document-attribute.md new file mode 100644 index 0000000..ca9c357 --- /dev/null +++ b/docs/examples/java/databases/increment-document-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.incrementDocumentAttribute( + "", // databaseId + "", // collectionId + "", // documentId + "", // attribute + 0, // value (optional) + 0, // max (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/databases/upsert-document.md b/docs/examples/java/databases/upsert-document.md new file mode 100644 index 0000000..daa4414 --- /dev/null +++ b/docs/examples/java/databases/upsert-document.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 + .setSession(""); // The user session to authenticate with + +Databases databases = new Databases(client); + +databases.upsertDocument( + "", // databaseId + "", // collectionId + "", // documentId + mapOf( "a" to "b" ), // data + listOf("read("any")"), // permissions (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/databases/upsert-documents.md b/docs/examples/java/databases/upsert-documents.md index e2f2a46..95e9a33 100644 --- a/docs/examples/java/databases/upsert-documents.md +++ b/docs/examples/java/databases/upsert-documents.md @@ -12,7 +12,7 @@ Databases databases = new Databases(client); databases.upsertDocuments( "", // databaseId "", // collectionId - listOf(), // documents (optional) + listOf(), // documents new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/kotlin/databases/create-document.md b/docs/examples/kotlin/databases/create-document.md index 93da01e..4c6d737 100644 --- a/docs/examples/kotlin/databases/create-document.md +++ b/docs/examples/kotlin/databases/create-document.md @@ -4,6 +4,7 @@ import io.appwrite.services.Databases val client = Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setAdmin("") // .setSession("") // The user session to authenticate with .setKey("") // Your secret API key .setJWT("") // Your secret JSON Web Token diff --git a/docs/examples/kotlin/databases/decrement-document-attribute.md b/docs/examples/kotlin/databases/decrement-document-attribute.md new file mode 100644 index 0000000..05204d7 --- /dev/null +++ b/docs/examples/kotlin/databases/decrement-document-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.decrementDocumentAttribute( + databaseId = "", + collectionId = "", + documentId = "", + attribute = "", + value = 0, // optional + min = 0 // optional +) diff --git a/docs/examples/kotlin/databases/increment-document-attribute.md b/docs/examples/kotlin/databases/increment-document-attribute.md new file mode 100644 index 0000000..40c1224 --- /dev/null +++ b/docs/examples/kotlin/databases/increment-document-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.incrementDocumentAttribute( + databaseId = "", + collectionId = "", + documentId = "", + attribute = "", + value = 0, // optional + max = 0 // optional +) diff --git a/docs/examples/kotlin/databases/upsert-document.md b/docs/examples/kotlin/databases/upsert-document.md new file mode 100644 index 0000000..d8be0e1 --- /dev/null +++ b/docs/examples/kotlin/databases/upsert-document.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 + .setSession("") // The user session to authenticate with + +val databases = Databases(client) + +val response = databases.upsertDocument( + databaseId = "", + collectionId = "", + documentId = "", + data = mapOf( "a" to "b" ), + permissions = listOf("read("any")") // optional +) diff --git a/docs/examples/kotlin/databases/upsert-documents.md b/docs/examples/kotlin/databases/upsert-documents.md index 7459b38..ca861c6 100644 --- a/docs/examples/kotlin/databases/upsert-documents.md +++ b/docs/examples/kotlin/databases/upsert-documents.md @@ -12,5 +12,5 @@ val databases = Databases(client) val response = databases.upsertDocuments( databaseId = "", collectionId = "", - documents = listOf() // optional + documents = listOf() ) diff --git a/src/main/kotlin/io/appwrite/Client.kt b/src/main/kotlin/io/appwrite/Client.kt index c7824ef..429131e 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/9.0.0 ${System.getProperty("http.agent")}", + "user-agent" to "AppwriteKotlinSDK/9.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 "9.0.0", + "x-sdk-version" to "9.1.0", "x-appwrite-response-format" to "1.7.0", ) diff --git a/src/main/kotlin/io/appwrite/enums/BuildRuntime.kt b/src/main/kotlin/io/appwrite/enums/BuildRuntime.kt index 71d857d..daa1589 100644 --- a/src/main/kotlin/io/appwrite/enums/BuildRuntime.kt +++ b/src/main/kotlin/io/appwrite/enums/BuildRuntime.kt @@ -77,6 +77,8 @@ enum class BuildRuntime(val value: String) { DART_3_3("dart-3.3"), @SerializedName("dart-3.5") DART_3_5("dart-3.5"), + @SerializedName("dart-3.8") + DART_3_8("dart-3.8"), @SerializedName("dotnet-6.0") DOTNET_6_0("dotnet-6.0"), @SerializedName("dotnet-7.0") @@ -128,7 +130,9 @@ enum class BuildRuntime(val value: String) { @SerializedName("flutter-3.27") FLUTTER_3_27("flutter-3.27"), @SerializedName("flutter-3.29") - FLUTTER_3_29("flutter-3.29"); + FLUTTER_3_29("flutter-3.29"), + @SerializedName("flutter-3.32") + FLUTTER_3_32("flutter-3.32"); override fun toString() = value } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/ImageFormat.kt b/src/main/kotlin/io/appwrite/enums/ImageFormat.kt index c3dea06..8e74806 100644 --- a/src/main/kotlin/io/appwrite/enums/ImageFormat.kt +++ b/src/main/kotlin/io/appwrite/enums/ImageFormat.kt @@ -14,7 +14,9 @@ enum class ImageFormat(val value: String) { @SerializedName("heic") HEIC("heic"), @SerializedName("avif") - AVIF("avif"); + AVIF("avif"), + @SerializedName("gif") + GIF("gif"); override fun toString() = value } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/Runtime.kt b/src/main/kotlin/io/appwrite/enums/Runtime.kt index dd65f3e..084811e 100644 --- a/src/main/kotlin/io/appwrite/enums/Runtime.kt +++ b/src/main/kotlin/io/appwrite/enums/Runtime.kt @@ -77,6 +77,8 @@ enum class Runtime(val value: String) { DART_3_3("dart-3.3"), @SerializedName("dart-3.5") DART_3_5("dart-3.5"), + @SerializedName("dart-3.8") + DART_3_8("dart-3.8"), @SerializedName("dotnet-6.0") DOTNET_6_0("dotnet-6.0"), @SerializedName("dotnet-7.0") @@ -128,7 +130,9 @@ enum class Runtime(val value: String) { @SerializedName("flutter-3.27") FLUTTER_3_27("flutter-3.27"), @SerializedName("flutter-3.29") - FLUTTER_3_29("flutter-3.29"); + FLUTTER_3_29("flutter-3.29"), + @SerializedName("flutter-3.32") + FLUTTER_3_32("flutter-3.32"); override fun toString() = value } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/AttributeString.kt b/src/main/kotlin/io/appwrite/models/AttributeString.kt index efae2ba..161d7b8 100644 --- a/src/main/kotlin/io/appwrite/models/AttributeString.kt +++ b/src/main/kotlin/io/appwrite/models/AttributeString.kt @@ -67,6 +67,12 @@ data class AttributeString( @SerializedName("default") var default: String?, + /** + * Defines whether this attribute is encrypted or not. + */ + @SerializedName("encrypt") + var encrypt: Boolean?, + ) { fun toMap(): Map = mapOf( "key" to key as Any, @@ -79,6 +85,7 @@ data class AttributeString( "\$updatedAt" to updatedAt as Any, "size" to size as Any, "default" to default as Any, + "encrypt" to encrypt as Any, ) companion object { @@ -97,6 +104,7 @@ data class AttributeString( updatedAt = map["\$updatedAt"] as String, size = (map["size"] as Number).toLong(), default = map["default"] as? String?, + encrypt = map["encrypt"] as? Boolean?, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Document.kt b/src/main/kotlin/io/appwrite/models/Document.kt index 01204de..c0dfe61 100644 --- a/src/main/kotlin/io/appwrite/models/Document.kt +++ b/src/main/kotlin/io/appwrite/models/Document.kt @@ -13,6 +13,12 @@ data class Document( @SerializedName("\$id") val id: String, + /** + * Document automatically incrementing ID. + */ + @SerializedName("\$sequence") + val sequence: Long, + /** * Collection ID. */ @@ -51,6 +57,7 @@ data class Document( ) { fun toMap(): Map = mapOf( "\$id" to id as Any, + "\$sequence" to sequence as Any, "\$collectionId" to collectionId as Any, "\$databaseId" to databaseId as Any, "\$createdAt" to createdAt as Any, @@ -62,6 +69,7 @@ data class Document( companion object { operator fun invoke( id: String, + sequence: Long, collectionId: String, databaseId: String, createdAt: String, @@ -70,6 +78,7 @@ data class Document( data: Map ) = Document>( id, + sequence, collectionId, databaseId, createdAt, @@ -84,6 +93,7 @@ data class Document( nestedType: Class ) = Document( id = map["\$id"] as String, + sequence = (map["\$sequence"] as Number).toLong(), collectionId = map["\$collectionId"] as String, databaseId = map["\$databaseId"] as String, createdAt = map["\$createdAt"] as String, diff --git a/src/main/kotlin/io/appwrite/services/Databases.kt b/src/main/kotlin/io/appwrite/services/Databases.kt index 143e829..6c57ede 100644 --- a/src/main/kotlin/io/appwrite/services/Databases.kt +++ b/src/main/kotlin/io/appwrite/services/Databases.kt @@ -1590,7 +1590,7 @@ class Databases(client: Client) : Service(client) { ) /** - * Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @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). Make sure to define attributes before creating documents. @@ -1628,7 +1628,7 @@ class Databases(client: Client) : Service(client) { } /** - * Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @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). Make sure to define attributes before creating documents. @@ -1648,19 +1648,18 @@ class Databases(client: Client) : Service(client) { ) /** - * Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @param databaseId Database ID. * @param collectionId Collection ID. * @param documents Array of document data as JSON objects. May contain partial documents. * @return [io.appwrite.models.DocumentList] */ - @JvmOverloads @Throws(AppwriteException::class) suspend fun upsertDocuments( databaseId: String, collectionId: String, - documents: List? = null, + documents: List, nestedType: Class, ): io.appwrite.models.DocumentList { val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents" @@ -1687,19 +1686,18 @@ class Databases(client: Client) : Service(client) { } /** - * Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @param databaseId Database ID. * @param collectionId Collection ID. * @param documents Array of document data as JSON objects. May contain partial documents. * @return [io.appwrite.models.DocumentList] */ - @JvmOverloads @Throws(AppwriteException::class) suspend fun upsertDocuments( databaseId: String, collectionId: String, - documents: List? = null, + documents: List, ): io.appwrite.models.DocumentList> = upsertDocuments( databaseId, collectionId, @@ -1708,7 +1706,7 @@ class Databases(client: Client) : Service(client) { ) /** - * Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. + * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. * * @param databaseId Database ID. * @param collectionId Collection ID. @@ -1750,7 +1748,7 @@ class Databases(client: Client) : Service(client) { } /** - * Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. + * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. * * @param databaseId Database ID. * @param collectionId Collection ID. @@ -1774,7 +1772,7 @@ class Databases(client: Client) : Service(client) { ) /** - * Bulk delete documents using queries, if no queries are passed then all documents are deleted. + * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.Bulk delete documents using queries, if no queries are passed then all documents are deleted. * * @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). @@ -1813,7 +1811,7 @@ class Databases(client: Client) : Service(client) { } /** - * Bulk delete documents using queries, if no queries are passed then all documents are deleted. + * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.Bulk delete documents using queries, if no queries are passed then all documents are deleted. * * @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). @@ -1898,6 +1896,78 @@ class Databases(client: Client) : Service(client) { nestedType = classOf(), ) + /** + * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param data Document data as JSON object. Include all required attributes of the document to be created or updated. + * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun upsertDocument( + databaseId: String, + collectionId: String, + documentId: String, + data: Any, + permissions: List? = null, + nestedType: Class, + ): io.appwrite.models.Document { + val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + .replace("{documentId}", documentId) + + val apiParams = mutableMapOf( + "data" to data, + "permissions" to permissions, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Document = { + io.appwrite.models.Document.from(map = it as Map, nestedType) + } + return client.call( + "PUT", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param data Document data as JSON object. Include all required attributes of the document to be created or updated. + * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun upsertDocument( + databaseId: String, + collectionId: String, + documentId: String, + data: Any, + permissions: List? = null, + ): io.appwrite.models.Document> = upsertDocument( + databaseId, + collectionId, + documentId, + data, + permissions, + nestedType = classOf(), + ) + /** * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. * @@ -2003,6 +2073,162 @@ class Databases(client: Client) : Service(client) { ) } + /** + * Decrement a specific attribute of a document by a given value. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param attribute Attribute key. + * @param value Value to decrement the attribute by. The value must be a number. + * @param min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun decrementDocumentAttribute( + databaseId: String, + collectionId: String, + documentId: String, + attribute: String, + value: Double? = null, + min: Double? = null, + nestedType: Class, + ): io.appwrite.models.Document { + val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + .replace("{documentId}", documentId) + .replace("{attribute}", attribute) + + val apiParams = mutableMapOf( + "value" to value, + "min" to min, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Document = { + io.appwrite.models.Document.from(map = it as Map, nestedType) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Decrement a specific attribute of a document by a given value. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param attribute Attribute key. + * @param value Value to decrement the attribute by. The value must be a number. + * @param min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun decrementDocumentAttribute( + databaseId: String, + collectionId: String, + documentId: String, + attribute: String, + value: Double? = null, + min: Double? = null, + ): io.appwrite.models.Document> = decrementDocumentAttribute( + databaseId, + collectionId, + documentId, + attribute, + value, + min, + nestedType = classOf(), + ) + + /** + * Increment a specific attribute of a document by a given value. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param attribute Attribute key. + * @param value Value to increment the attribute by. The value must be a number. + * @param max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun incrementDocumentAttribute( + databaseId: String, + collectionId: String, + documentId: String, + attribute: String, + value: Double? = null, + max: Double? = null, + nestedType: Class, + ): io.appwrite.models.Document { + val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment" + .replace("{databaseId}", databaseId) + .replace("{collectionId}", collectionId) + .replace("{documentId}", documentId) + .replace("{attribute}", attribute) + + val apiParams = mutableMapOf( + "value" to value, + "max" to max, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Document = { + io.appwrite.models.Document.from(map = it as Map, nestedType) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Increment a specific attribute of a document by a given value. + * + * @param databaseId Database ID. + * @param collectionId Collection ID. + * @param documentId Document ID. + * @param attribute Attribute key. + * @param value Value to increment the attribute by. The value must be a number. + * @param max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. + * @return [io.appwrite.models.Document] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun incrementDocumentAttribute( + databaseId: String, + collectionId: String, + documentId: String, + attribute: String, + value: Double? = null, + max: Double? = null, + ): io.appwrite.models.Document> = incrementDocumentAttribute( + databaseId, + collectionId, + documentId, + attribute, + value, + max, + nestedType = classOf(), + ) + /** * List indexes in the collection. * diff --git a/src/main/kotlin/io/appwrite/services/Tokens.kt b/src/main/kotlin/io/appwrite/services/Tokens.kt index 059595a..7e485bd 100644 --- a/src/main/kotlin/io/appwrite/services/Tokens.kt +++ b/src/main/kotlin/io/appwrite/services/Tokens.kt @@ -51,7 +51,7 @@ class Tokens(client: Client) : Service(client) { } /** - * Create a new token. A token is linked to a file. Token can be passed as a header or request get parameter. + * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. * * @param bucketId Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). * @param fileId File unique ID. diff --git a/src/main/kotlin/io/appwrite/services/Users.kt b/src/main/kotlin/io/appwrite/services/Users.kt index c98fd79..549e858 100644 --- a/src/main/kotlin/io/appwrite/services/Users.kt +++ b/src/main/kotlin/io/appwrite/services/Users.kt @@ -1631,7 +1631,7 @@ class Users(client: Client) : Service(client) { * List the messaging targets that are associated with a user. * * @param userId User ID. - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, providerId, identifier, providerType * @return [io.appwrite.models.TargetList] */ @JvmOverloads From 6f0f887c3b3716db74f129b11709493827258f84 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 22 Jul 2025 16:18:10 +0000 Subject: [PATCH 2/5] chore: regenerate --- README.md | 8 +- .../java/databases/create-document.md | 1 - .../java/databases/create-documents.md | 1 + .../java/databases/upsert-document.md | 7 +- .../java/databases/upsert-documents.md | 3 +- .../java/tables/create-boolean-column.md | 28 + .../java/tables/create-datetime-column.md | 28 + .../java/tables/create-email-column.md | 28 + .../java/tables/create-enum-column.md | 29 + .../java/tables/create-float-column.md | 30 + docs/examples/java/tables/create-index.md | 30 + .../java/tables/create-integer-column.md | 30 + docs/examples/java/tables/create-ip-column.md | 28 + .../java/tables/create-relationship-column.md | 31 + docs/examples/java/tables/create-row.md | 28 + docs/examples/java/tables/create-rows.md | 25 + .../java/tables/create-string-column.md | 30 + .../examples/java/tables/create-url-column.md | 28 + docs/examples/java/tables/create.md | 28 + .../java/tables/decrement-row-column.md | 28 + docs/examples/java/tables/delete-column.md | 25 + docs/examples/java/tables/delete-index.md | 25 + docs/examples/java/tables/delete-row.md | 25 + docs/examples/java/tables/delete-rows.md | 25 + docs/examples/java/tables/delete.md | 24 + docs/examples/java/tables/get-column.md | 25 + docs/examples/java/tables/get-index.md | 25 + docs/examples/java/tables/get-row.md | 26 + docs/examples/java/tables/get.md | 24 + .../java/tables/increment-row-column.md | 28 + docs/examples/java/tables/list-columns.md | 25 + docs/examples/java/tables/list-indexes.md | 25 + docs/examples/java/tables/list-rows.md | 25 + docs/examples/java/tables/list.md | 25 + .../java/tables/update-boolean-column.md | 28 + .../java/tables/update-datetime-column.md | 28 + .../java/tables/update-email-column.md | 28 + .../java/tables/update-enum-column.md | 29 + .../java/tables/update-float-column.md | 30 + .../java/tables/update-integer-column.md | 30 + docs/examples/java/tables/update-ip-column.md | 28 + .../java/tables/update-relationship-column.md | 27 + docs/examples/java/tables/update-row.md | 27 + docs/examples/java/tables/update-rows.md | 26 + .../java/tables/update-string-column.md | 29 + .../examples/java/tables/update-url-column.md | 28 + docs/examples/java/tables/update.md | 28 + docs/examples/java/tables/upsert-row.md | 26 + docs/examples/java/tables/upsert-rows.md | 24 + .../kotlin/databases/create-document.md | 1 - .../kotlin/databases/create-documents.md | 1 + .../kotlin/databases/upsert-document.md | 7 +- .../kotlin/databases/upsert-documents.md | 5 +- .../kotlin/tables/create-boolean-column.md | 19 + .../kotlin/tables/create-datetime-column.md | 19 + .../kotlin/tables/create-email-column.md | 19 + .../kotlin/tables/create-enum-column.md | 20 + .../kotlin/tables/create-float-column.md | 21 + docs/examples/kotlin/tables/create-index.md | 21 + .../kotlin/tables/create-integer-column.md | 21 + .../kotlin/tables/create-ip-column.md | 19 + .../tables/create-relationship-column.md | 22 + docs/examples/kotlin/tables/create-row.md | 19 + docs/examples/kotlin/tables/create-rows.md | 16 + .../kotlin/tables/create-string-column.md | 21 + .../kotlin/tables/create-url-column.md | 19 + docs/examples/kotlin/tables/create.md | 19 + .../kotlin/tables/decrement-row-column.md | 19 + docs/examples/kotlin/tables/delete-column.md | 16 + docs/examples/kotlin/tables/delete-index.md | 16 + docs/examples/kotlin/tables/delete-row.md | 16 + docs/examples/kotlin/tables/delete-rows.md | 16 + docs/examples/kotlin/tables/delete.md | 15 + docs/examples/kotlin/tables/get-column.md | 16 + docs/examples/kotlin/tables/get-index.md | 16 + docs/examples/kotlin/tables/get-row.md | 17 + docs/examples/kotlin/tables/get.md | 15 + .../kotlin/tables/increment-row-column.md | 19 + docs/examples/kotlin/tables/list-columns.md | 16 + docs/examples/kotlin/tables/list-indexes.md | 16 + docs/examples/kotlin/tables/list-rows.md | 16 + docs/examples/kotlin/tables/list.md | 16 + .../kotlin/tables/update-boolean-column.md | 19 + .../kotlin/tables/update-datetime-column.md | 19 + .../kotlin/tables/update-email-column.md | 19 + .../kotlin/tables/update-enum-column.md | 20 + .../kotlin/tables/update-float-column.md | 21 + .../kotlin/tables/update-integer-column.md | 21 + .../kotlin/tables/update-ip-column.md | 19 + .../tables/update-relationship-column.md | 18 + docs/examples/kotlin/tables/update-row.md | 18 + docs/examples/kotlin/tables/update-rows.md | 17 + .../kotlin/tables/update-string-column.md | 20 + .../kotlin/tables/update-url-column.md | 19 + docs/examples/kotlin/tables/update.md | 19 + docs/examples/kotlin/tables/upsert-row.md | 17 + docs/examples/kotlin/tables/upsert-rows.md | 15 + src/main/kotlin/io/appwrite/Client.kt | 6 +- .../kotlin/io/appwrite/models/BucketList.kt | 2 +- .../io/appwrite/models/CollectionList.kt | 2 +- .../io/appwrite/models/ColumnBoolean.kt | 94 + .../io/appwrite/models/ColumnDatetime.kt | 102 + .../kotlin/io/appwrite/models/ColumnEmail.kt | 102 + .../kotlin/io/appwrite/models/ColumnEnum.kt | 110 + .../kotlin/io/appwrite/models/ColumnFloat.kt | 110 + .../kotlin/io/appwrite/models/ColumnIndex.kt | 94 + .../io/appwrite/models/ColumnIndexList.kt | 38 + .../io/appwrite/models/ColumnInteger.kt | 110 + .../kotlin/io/appwrite/models/ColumnIp.kt | 102 + .../kotlin/io/appwrite/models/ColumnList.kt | 38 + .../io/appwrite/models/ColumnRelationship.kt | 134 + .../kotlin/io/appwrite/models/ColumnString.kt | 110 + .../kotlin/io/appwrite/models/ColumnUrl.kt | 102 + .../io/appwrite/models/ContinentList.kt | 2 +- .../kotlin/io/appwrite/models/CountryList.kt | 2 +- .../kotlin/io/appwrite/models/CurrencyList.kt | 2 +- .../kotlin/io/appwrite/models/DatabaseList.kt | 2 +- .../io/appwrite/models/DeploymentList.kt | 2 +- .../kotlin/io/appwrite/models/DocumentList.kt | 2 +- .../io/appwrite/models/ExecutionList.kt | 2 +- .../kotlin/io/appwrite/models/FileList.kt | 2 +- .../io/appwrite/models/FrameworkList.kt | 2 +- .../kotlin/io/appwrite/models/FunctionList.kt | 2 +- .../kotlin/io/appwrite/models/IdentityList.kt | 2 +- .../kotlin/io/appwrite/models/IndexList.kt | 2 +- .../kotlin/io/appwrite/models/LanguageList.kt | 2 +- .../io/appwrite/models/LocaleCodeList.kt | 2 +- src/main/kotlin/io/appwrite/models/LogList.kt | 2 +- .../io/appwrite/models/MembershipList.kt | 2 +- .../kotlin/io/appwrite/models/MessageList.kt | 2 +- .../kotlin/io/appwrite/models/PhoneList.kt | 2 +- .../kotlin/io/appwrite/models/ProviderList.kt | 2 +- .../io/appwrite/models/ResourceTokenList.kt | 2 +- src/main/kotlin/io/appwrite/models/Row.kt | 105 + src/main/kotlin/io/appwrite/models/RowList.kt | 46 + .../kotlin/io/appwrite/models/RuntimeList.kt | 2 +- .../kotlin/io/appwrite/models/SessionList.kt | 2 +- .../kotlin/io/appwrite/models/SiteList.kt | 2 +- .../io/appwrite/models/SpecificationList.kt | 2 +- .../io/appwrite/models/SubscriberList.kt | 2 +- src/main/kotlin/io/appwrite/models/Table.kt | 102 + .../kotlin/io/appwrite/models/TableList.kt | 38 + .../kotlin/io/appwrite/models/TargetList.kt | 2 +- .../kotlin/io/appwrite/models/TeamList.kt | 2 +- .../kotlin/io/appwrite/models/TopicList.kt | 2 +- .../kotlin/io/appwrite/models/UserList.kt | 2 +- .../kotlin/io/appwrite/models/VariableList.kt | 2 +- .../kotlin/io/appwrite/services/Account.kt | 6 + .../kotlin/io/appwrite/services/Databases.kt | 397 ++- .../kotlin/io/appwrite/services/Tables.kt | 2201 +++++++++++++++++ 150 files changed, 6118 insertions(+), 125 deletions(-) create mode 100644 docs/examples/java/tables/create-boolean-column.md create mode 100644 docs/examples/java/tables/create-datetime-column.md create mode 100644 docs/examples/java/tables/create-email-column.md create mode 100644 docs/examples/java/tables/create-enum-column.md create mode 100644 docs/examples/java/tables/create-float-column.md create mode 100644 docs/examples/java/tables/create-index.md create mode 100644 docs/examples/java/tables/create-integer-column.md create mode 100644 docs/examples/java/tables/create-ip-column.md create mode 100644 docs/examples/java/tables/create-relationship-column.md create mode 100644 docs/examples/java/tables/create-row.md create mode 100644 docs/examples/java/tables/create-rows.md create mode 100644 docs/examples/java/tables/create-string-column.md create mode 100644 docs/examples/java/tables/create-url-column.md create mode 100644 docs/examples/java/tables/create.md create mode 100644 docs/examples/java/tables/decrement-row-column.md create mode 100644 docs/examples/java/tables/delete-column.md create mode 100644 docs/examples/java/tables/delete-index.md create mode 100644 docs/examples/java/tables/delete-row.md create mode 100644 docs/examples/java/tables/delete-rows.md create mode 100644 docs/examples/java/tables/delete.md create mode 100644 docs/examples/java/tables/get-column.md create mode 100644 docs/examples/java/tables/get-index.md create mode 100644 docs/examples/java/tables/get-row.md create mode 100644 docs/examples/java/tables/get.md create mode 100644 docs/examples/java/tables/increment-row-column.md create mode 100644 docs/examples/java/tables/list-columns.md create mode 100644 docs/examples/java/tables/list-indexes.md create mode 100644 docs/examples/java/tables/list-rows.md create mode 100644 docs/examples/java/tables/list.md create mode 100644 docs/examples/java/tables/update-boolean-column.md create mode 100644 docs/examples/java/tables/update-datetime-column.md create mode 100644 docs/examples/java/tables/update-email-column.md create mode 100644 docs/examples/java/tables/update-enum-column.md create mode 100644 docs/examples/java/tables/update-float-column.md create mode 100644 docs/examples/java/tables/update-integer-column.md create mode 100644 docs/examples/java/tables/update-ip-column.md create mode 100644 docs/examples/java/tables/update-relationship-column.md create mode 100644 docs/examples/java/tables/update-row.md create mode 100644 docs/examples/java/tables/update-rows.md create mode 100644 docs/examples/java/tables/update-string-column.md create mode 100644 docs/examples/java/tables/update-url-column.md create mode 100644 docs/examples/java/tables/update.md create mode 100644 docs/examples/java/tables/upsert-row.md create mode 100644 docs/examples/java/tables/upsert-rows.md create mode 100644 docs/examples/kotlin/tables/create-boolean-column.md create mode 100644 docs/examples/kotlin/tables/create-datetime-column.md create mode 100644 docs/examples/kotlin/tables/create-email-column.md create mode 100644 docs/examples/kotlin/tables/create-enum-column.md create mode 100644 docs/examples/kotlin/tables/create-float-column.md create mode 100644 docs/examples/kotlin/tables/create-index.md create mode 100644 docs/examples/kotlin/tables/create-integer-column.md create mode 100644 docs/examples/kotlin/tables/create-ip-column.md create mode 100644 docs/examples/kotlin/tables/create-relationship-column.md create mode 100644 docs/examples/kotlin/tables/create-row.md create mode 100644 docs/examples/kotlin/tables/create-rows.md create mode 100644 docs/examples/kotlin/tables/create-string-column.md create mode 100644 docs/examples/kotlin/tables/create-url-column.md create mode 100644 docs/examples/kotlin/tables/create.md create mode 100644 docs/examples/kotlin/tables/decrement-row-column.md create mode 100644 docs/examples/kotlin/tables/delete-column.md create mode 100644 docs/examples/kotlin/tables/delete-index.md create mode 100644 docs/examples/kotlin/tables/delete-row.md create mode 100644 docs/examples/kotlin/tables/delete-rows.md create mode 100644 docs/examples/kotlin/tables/delete.md create mode 100644 docs/examples/kotlin/tables/get-column.md create mode 100644 docs/examples/kotlin/tables/get-index.md create mode 100644 docs/examples/kotlin/tables/get-row.md create mode 100644 docs/examples/kotlin/tables/get.md create mode 100644 docs/examples/kotlin/tables/increment-row-column.md create mode 100644 docs/examples/kotlin/tables/list-columns.md create mode 100644 docs/examples/kotlin/tables/list-indexes.md create mode 100644 docs/examples/kotlin/tables/list-rows.md create mode 100644 docs/examples/kotlin/tables/list.md create mode 100644 docs/examples/kotlin/tables/update-boolean-column.md create mode 100644 docs/examples/kotlin/tables/update-datetime-column.md create mode 100644 docs/examples/kotlin/tables/update-email-column.md create mode 100644 docs/examples/kotlin/tables/update-enum-column.md create mode 100644 docs/examples/kotlin/tables/update-float-column.md create mode 100644 docs/examples/kotlin/tables/update-integer-column.md create mode 100644 docs/examples/kotlin/tables/update-ip-column.md create mode 100644 docs/examples/kotlin/tables/update-relationship-column.md create mode 100644 docs/examples/kotlin/tables/update-row.md create mode 100644 docs/examples/kotlin/tables/update-rows.md create mode 100644 docs/examples/kotlin/tables/update-string-column.md create mode 100644 docs/examples/kotlin/tables/update-url-column.md create mode 100644 docs/examples/kotlin/tables/update.md create mode 100644 docs/examples/kotlin/tables/upsert-row.md create mode 100644 docs/examples/kotlin/tables/upsert-rows.md create mode 100644 src/main/kotlin/io/appwrite/models/ColumnBoolean.kt create mode 100644 src/main/kotlin/io/appwrite/models/ColumnDatetime.kt create mode 100644 src/main/kotlin/io/appwrite/models/ColumnEmail.kt create mode 100644 src/main/kotlin/io/appwrite/models/ColumnEnum.kt create mode 100644 src/main/kotlin/io/appwrite/models/ColumnFloat.kt create mode 100644 src/main/kotlin/io/appwrite/models/ColumnIndex.kt create mode 100644 src/main/kotlin/io/appwrite/models/ColumnIndexList.kt create mode 100644 src/main/kotlin/io/appwrite/models/ColumnInteger.kt create mode 100644 src/main/kotlin/io/appwrite/models/ColumnIp.kt create mode 100644 src/main/kotlin/io/appwrite/models/ColumnList.kt create mode 100644 src/main/kotlin/io/appwrite/models/ColumnRelationship.kt create mode 100644 src/main/kotlin/io/appwrite/models/ColumnString.kt create mode 100644 src/main/kotlin/io/appwrite/models/ColumnUrl.kt create mode 100644 src/main/kotlin/io/appwrite/models/Row.kt create mode 100644 src/main/kotlin/io/appwrite/models/RowList.kt create mode 100644 src/main/kotlin/io/appwrite/models/Table.kt create mode 100644 src/main/kotlin/io/appwrite/models/TableList.kt create mode 100644 src/main/kotlin/io/appwrite/services/Tables.kt diff --git a/README.md b/README.md index 126160d..72c5530 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ ![Maven Central](https://img.shields.io/maven-central/v/io.appwrite/sdk-for-kotlin.svg?color=green&style=flat-square) ![License](https://img.shields.io/github/license/appwrite/sdk-for-kotlin.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.8.0-blue.svg?style=flat-square) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-kotlin/releases).** +**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-kotlin/releases).** > This is the Kotlin SDK for integrating with Appwrite from your Kotlin server-side code. If you're looking for the Android SDK you should check [appwrite/sdk-for-android](https://github.com/appwrite/sdk-for-android) @@ -39,7 +39,7 @@ repositories { Next, add the dependency to your project's `build.gradle(.kts)` file: ```groovy -implementation("io.appwrite:sdk-for-kotlin:9.1.0") +implementation("io.appwrite:sdk-for-kotlin:10.0.0") ``` ### Maven @@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-kotlin - 9.1.0 + 10.0.0 ``` diff --git a/docs/examples/java/databases/create-document.md b/docs/examples/java/databases/create-document.md index c71bc61..368b816 100644 --- a/docs/examples/java/databases/create-document.md +++ b/docs/examples/java/databases/create-document.md @@ -4,7 +4,6 @@ import io.appwrite.services.Databases; Client client = new Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setAdmin("") // .setSession("") // The user session to authenticate with .setKey("") // Your secret API key .setJWT(""); // Your secret JSON Web Token diff --git a/docs/examples/java/databases/create-documents.md b/docs/examples/java/databases/create-documents.md index d816af3..77d7981 100644 --- a/docs/examples/java/databases/create-documents.md +++ b/docs/examples/java/databases/create-documents.md @@ -4,6 +4,7 @@ import io.appwrite.services.Databases; Client client = new Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setAdmin("") // .setKey(""); // Your secret API key Databases databases = new Databases(client); diff --git a/docs/examples/java/databases/upsert-document.md b/docs/examples/java/databases/upsert-document.md index daa4414..b1b4de4 100644 --- a/docs/examples/java/databases/upsert-document.md +++ b/docs/examples/java/databases/upsert-document.md @@ -4,8 +4,9 @@ import io.appwrite.services.Databases; Client client = new Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setSession(""); // The user session to authenticate with + .setSession("") // The user session to authenticate with + .setKey("") // Your secret API key + .setJWT(""); // Your secret JSON Web Token Databases databases = new Databases(client); @@ -13,8 +14,6 @@ databases.upsertDocument( "", // databaseId "", // collectionId "", // documentId - mapOf( "a" to "b" ), // data - listOf("read("any")"), // permissions (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/databases/upsert-documents.md b/docs/examples/java/databases/upsert-documents.md index 95e9a33..0bf0c17 100644 --- a/docs/examples/java/databases/upsert-documents.md +++ b/docs/examples/java/databases/upsert-documents.md @@ -4,7 +4,7 @@ import io.appwrite.services.Databases; Client client = new Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID + .setAdmin("") // .setKey(""); // Your secret API key Databases databases = new Databases(client); @@ -12,7 +12,6 @@ Databases databases = new Databases(client); databases.upsertDocuments( "", // databaseId "", // collectionId - listOf(), // documents new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/tables/create-boolean-column.md b/docs/examples/java/tables/create-boolean-column.md new file mode 100644 index 0000000..2336ee9 --- /dev/null +++ b/docs/examples/java/tables/create-boolean-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.createBooleanColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + false, // default (optional) + false, // array (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/create-datetime-column.md b/docs/examples/java/tables/create-datetime-column.md new file mode 100644 index 0000000..dd3df83 --- /dev/null +++ b/docs/examples/java/tables/create-datetime-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.createDatetimeColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + "", // default (optional) + false, // array (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/create-email-column.md b/docs/examples/java/tables/create-email-column.md new file mode 100644 index 0000000..3b130d1 --- /dev/null +++ b/docs/examples/java/tables/create-email-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.createEmailColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + "email@example.com", // default (optional) + false, // array (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/create-enum-column.md b/docs/examples/java/tables/create-enum-column.md new file mode 100644 index 0000000..73c6e1c --- /dev/null +++ b/docs/examples/java/tables/create-enum-column.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.createEnumColumn( + "", // databaseId + "", // tableId + "", // key + listOf(), // elements + false, // required + "", // default (optional) + false, // array (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/create-float-column.md b/docs/examples/java/tables/create-float-column.md new file mode 100644 index 0000000..dd6f207 --- /dev/null +++ b/docs/examples/java/tables/create-float-column.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.createFloatColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + 0, // min (optional) + 0, // max (optional) + 0, // default (optional) + false, // array (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/create-index.md b/docs/examples/java/tables/create-index.md new file mode 100644 index 0000000..2a4df00 --- /dev/null +++ b/docs/examples/java/tables/create-index.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; +import io.appwrite.enums.IndexType; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.createIndex( + "", // databaseId + "", // tableId + "", // key + IndexType.KEY, // type + listOf(), // columns + listOf(), // orders (optional) + listOf(), // lengths (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/create-integer-column.md b/docs/examples/java/tables/create-integer-column.md new file mode 100644 index 0000000..3546ac8 --- /dev/null +++ b/docs/examples/java/tables/create-integer-column.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.createIntegerColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + 0, // min (optional) + 0, // max (optional) + 0, // default (optional) + false, // array (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/create-ip-column.md b/docs/examples/java/tables/create-ip-column.md new file mode 100644 index 0000000..825d8b0 --- /dev/null +++ b/docs/examples/java/tables/create-ip-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.createIpColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + "", // default (optional) + false, // array (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/create-relationship-column.md b/docs/examples/java/tables/create-relationship-column.md new file mode 100644 index 0000000..7a0b50a --- /dev/null +++ b/docs/examples/java/tables/create-relationship-column.md @@ -0,0 +1,31 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; +import io.appwrite.enums.RelationshipType; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.createRelationshipColumn( + "", // databaseId + "", // tableId + "", // relatedTableId + RelationshipType.ONETOONE, // type + false, // twoWay (optional) + "", // key (optional) + "", // twoWayKey (optional) + RelationMutate.CASCADE, // onDelete (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/create-row.md b/docs/examples/java/tables/create-row.md new file mode 100644 index 0000000..7ba3678 --- /dev/null +++ b/docs/examples/java/tables/create-row.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setSession("") // The user session to authenticate with + .setKey("") // Your secret API key + .setJWT(""); // Your secret JSON Web Token + +Tables tables = new Tables(client); + +tables.createRow( + "", // databaseId + "", // tableId + "", // rowId + mapOf( "a" to "b" ), // data + listOf("read("any")"), // permissions (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/create-rows.md b/docs/examples/java/tables/create-rows.md new file mode 100644 index 0000000..c20aa2c --- /dev/null +++ b/docs/examples/java/tables/create-rows.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setAdmin("") // + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.createRows( + "", // databaseId + "", // tableId + listOf(), // rows + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/create-string-column.md b/docs/examples/java/tables/create-string-column.md new file mode 100644 index 0000000..b8cb626 --- /dev/null +++ b/docs/examples/java/tables/create-string-column.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.createStringColumn( + "", // databaseId + "", // tableId + "", // key + 1, // size + false, // required + "", // default (optional) + false, // array (optional) + false, // encrypt (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/create-url-column.md b/docs/examples/java/tables/create-url-column.md new file mode 100644 index 0000000..91e90c8 --- /dev/null +++ b/docs/examples/java/tables/create-url-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.createUrlColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + "https://example.com", // default (optional) + false, // array (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/create.md b/docs/examples/java/tables/create.md new file mode 100644 index 0000000..6a9faf0 --- /dev/null +++ b/docs/examples/java/tables/create.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.create( + "", // databaseId + "", // tableId + "", // name + listOf("read("any")"), // permissions (optional) + false, // rowSecurity (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/decrement-row-column.md b/docs/examples/java/tables/decrement-row-column.md new file mode 100644 index 0000000..9e79f36 --- /dev/null +++ b/docs/examples/java/tables/decrement-row-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.decrementRowColumn( + "", // databaseId + "", // tableId + "", // rowId + "", // column + 0, // value (optional) + 0, // min (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/delete-column.md b/docs/examples/java/tables/delete-column.md new file mode 100644 index 0000000..f14390c --- /dev/null +++ b/docs/examples/java/tables/delete-column.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.deleteColumn( + "", // databaseId + "", // tableId + "", // key + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/delete-index.md b/docs/examples/java/tables/delete-index.md new file mode 100644 index 0000000..1b22eb0 --- /dev/null +++ b/docs/examples/java/tables/delete-index.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.deleteIndex( + "", // databaseId + "", // tableId + "", // key + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/delete-row.md b/docs/examples/java/tables/delete-row.md new file mode 100644 index 0000000..a48745a --- /dev/null +++ b/docs/examples/java/tables/delete-row.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +Tables tables = new Tables(client); + +tables.deleteRow( + "", // databaseId + "", // tableId + "", // rowId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/delete-rows.md b/docs/examples/java/tables/delete-rows.md new file mode 100644 index 0000000..6a86321 --- /dev/null +++ b/docs/examples/java/tables/delete-rows.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.deleteRows( + "", // databaseId + "", // tableId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/delete.md b/docs/examples/java/tables/delete.md new file mode 100644 index 0000000..e777c72 --- /dev/null +++ b/docs/examples/java/tables/delete.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.delete( + "", // databaseId + "", // tableId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/get-column.md b/docs/examples/java/tables/get-column.md new file mode 100644 index 0000000..b4f7e12 --- /dev/null +++ b/docs/examples/java/tables/get-column.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.getColumn( + "", // databaseId + "", // tableId + "", // key + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/get-index.md b/docs/examples/java/tables/get-index.md new file mode 100644 index 0000000..5bcd59d --- /dev/null +++ b/docs/examples/java/tables/get-index.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.getIndex( + "", // databaseId + "", // tableId + "", // key + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/get-row.md b/docs/examples/java/tables/get-row.md new file mode 100644 index 0000000..7f72c25 --- /dev/null +++ b/docs/examples/java/tables/get-row.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +Tables tables = new Tables(client); + +tables.getRow( + "", // databaseId + "", // tableId + "", // rowId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/get.md b/docs/examples/java/tables/get.md new file mode 100644 index 0000000..6f3c639 --- /dev/null +++ b/docs/examples/java/tables/get.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.get( + "", // databaseId + "", // tableId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/increment-row-column.md b/docs/examples/java/tables/increment-row-column.md new file mode 100644 index 0000000..f9c8283 --- /dev/null +++ b/docs/examples/java/tables/increment-row-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.incrementRowColumn( + "", // databaseId + "", // tableId + "", // rowId + "", // column + 0, // value (optional) + 0, // max (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/list-columns.md b/docs/examples/java/tables/list-columns.md new file mode 100644 index 0000000..05e1960 --- /dev/null +++ b/docs/examples/java/tables/list-columns.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.listColumns( + "", // databaseId + "", // tableId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/list-indexes.md b/docs/examples/java/tables/list-indexes.md new file mode 100644 index 0000000..c9bd445 --- /dev/null +++ b/docs/examples/java/tables/list-indexes.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.listIndexes( + "", // databaseId + "", // tableId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/list-rows.md b/docs/examples/java/tables/list-rows.md new file mode 100644 index 0000000..8cbc356 --- /dev/null +++ b/docs/examples/java/tables/list-rows.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +Tables tables = new Tables(client); + +tables.listRows( + "", // databaseId + "", // tableId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/list.md b/docs/examples/java/tables/list.md new file mode 100644 index 0000000..c3e0c55 --- /dev/null +++ b/docs/examples/java/tables/list.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.list( + "", // databaseId + listOf(), // queries (optional) + "", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/update-boolean-column.md b/docs/examples/java/tables/update-boolean-column.md new file mode 100644 index 0000000..647190e --- /dev/null +++ b/docs/examples/java/tables/update-boolean-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.updateBooleanColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + false, // default + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/update-datetime-column.md b/docs/examples/java/tables/update-datetime-column.md new file mode 100644 index 0000000..38e0e60 --- /dev/null +++ b/docs/examples/java/tables/update-datetime-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.updateDatetimeColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + "", // default + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/update-email-column.md b/docs/examples/java/tables/update-email-column.md new file mode 100644 index 0000000..918884e --- /dev/null +++ b/docs/examples/java/tables/update-email-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.updateEmailColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + "email@example.com", // default + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/update-enum-column.md b/docs/examples/java/tables/update-enum-column.md new file mode 100644 index 0000000..b1bbc83 --- /dev/null +++ b/docs/examples/java/tables/update-enum-column.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.updateEnumColumn( + "", // databaseId + "", // tableId + "", // key + listOf(), // elements + false, // required + "", // default + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/update-float-column.md b/docs/examples/java/tables/update-float-column.md new file mode 100644 index 0000000..977c237 --- /dev/null +++ b/docs/examples/java/tables/update-float-column.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.updateFloatColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + 0, // default + 0, // min (optional) + 0, // max (optional) + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/update-integer-column.md b/docs/examples/java/tables/update-integer-column.md new file mode 100644 index 0000000..d2ad81d --- /dev/null +++ b/docs/examples/java/tables/update-integer-column.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.updateIntegerColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + 0, // default + 0, // min (optional) + 0, // max (optional) + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/update-ip-column.md b/docs/examples/java/tables/update-ip-column.md new file mode 100644 index 0000000..cd6e67b --- /dev/null +++ b/docs/examples/java/tables/update-ip-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.updateIpColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + "", // default + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/update-relationship-column.md b/docs/examples/java/tables/update-relationship-column.md new file mode 100644 index 0000000..e0dc185 --- /dev/null +++ b/docs/examples/java/tables/update-relationship-column.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.updateRelationshipColumn( + "", // databaseId + "", // tableId + "", // key + RelationMutate.CASCADE, // onDelete (optional) + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/update-row.md b/docs/examples/java/tables/update-row.md new file mode 100644 index 0000000..8270c3f --- /dev/null +++ b/docs/examples/java/tables/update-row.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +Tables tables = new Tables(client); + +tables.updateRow( + "", // databaseId + "", // tableId + "", // rowId + mapOf( "a" to "b" ), // data (optional) + listOf("read("any")"), // permissions (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/update-rows.md b/docs/examples/java/tables/update-rows.md new file mode 100644 index 0000000..a518785 --- /dev/null +++ b/docs/examples/java/tables/update-rows.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.updateRows( + "", // databaseId + "", // tableId + mapOf( "a" to "b" ), // data (optional) + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/update-string-column.md b/docs/examples/java/tables/update-string-column.md new file mode 100644 index 0000000..31e279d --- /dev/null +++ b/docs/examples/java/tables/update-string-column.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.updateStringColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + "", // default + 1, // size (optional) + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/update-url-column.md b/docs/examples/java/tables/update-url-column.md new file mode 100644 index 0000000..201e578 --- /dev/null +++ b/docs/examples/java/tables/update-url-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.updateUrlColumn( + "", // databaseId + "", // tableId + "", // key + false, // required + "https://example.com", // default + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/update.md b/docs/examples/java/tables/update.md new file mode 100644 index 0000000..cf560cb --- /dev/null +++ b/docs/examples/java/tables/update.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.update( + "", // databaseId + "", // tableId + "", // name + listOf("read("any")"), // permissions (optional) + false, // rowSecurity (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/upsert-row.md b/docs/examples/java/tables/upsert-row.md new file mode 100644 index 0000000..11127c5 --- /dev/null +++ b/docs/examples/java/tables/upsert-row.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setSession("") // The user session to authenticate with + .setKey("") // Your secret API key + .setJWT(""); // Your secret JSON Web Token + +Tables tables = new Tables(client); + +tables.upsertRow( + "", // databaseId + "", // tableId + "", // rowId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tables/upsert-rows.md b/docs/examples/java/tables/upsert-rows.md new file mode 100644 index 0000000..14b3822 --- /dev/null +++ b/docs/examples/java/tables/upsert-rows.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tables; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setAdmin("") // + .setKey(""); // Your secret API key + +Tables tables = new Tables(client); + +tables.upsertRows( + "", // databaseId + "", // tableId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/kotlin/databases/create-document.md b/docs/examples/kotlin/databases/create-document.md index 4c6d737..93da01e 100644 --- a/docs/examples/kotlin/databases/create-document.md +++ b/docs/examples/kotlin/databases/create-document.md @@ -4,7 +4,6 @@ import io.appwrite.services.Databases val client = Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setAdmin("") // .setSession("") // The user session to authenticate with .setKey("") // Your secret API key .setJWT("") // Your secret JSON Web Token diff --git a/docs/examples/kotlin/databases/create-documents.md b/docs/examples/kotlin/databases/create-documents.md index 01692c6..ddce31c 100644 --- a/docs/examples/kotlin/databases/create-documents.md +++ b/docs/examples/kotlin/databases/create-documents.md @@ -4,6 +4,7 @@ import io.appwrite.services.Databases val client = Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setAdmin("") // .setKey("") // Your secret API key val databases = Databases(client) diff --git a/docs/examples/kotlin/databases/upsert-document.md b/docs/examples/kotlin/databases/upsert-document.md index d8be0e1..df261db 100644 --- a/docs/examples/kotlin/databases/upsert-document.md +++ b/docs/examples/kotlin/databases/upsert-document.md @@ -4,15 +4,14 @@ import io.appwrite.services.Databases val client = Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID .setSession("") // The user session to authenticate with + .setKey("") // Your secret API key + .setJWT("") // Your secret JSON Web Token val databases = Databases(client) val response = databases.upsertDocument( databaseId = "", collectionId = "", - documentId = "", - data = mapOf( "a" to "b" ), - permissions = listOf("read("any")") // optional + documentId = "" ) diff --git a/docs/examples/kotlin/databases/upsert-documents.md b/docs/examples/kotlin/databases/upsert-documents.md index ca861c6..1cb376f 100644 --- a/docs/examples/kotlin/databases/upsert-documents.md +++ b/docs/examples/kotlin/databases/upsert-documents.md @@ -4,13 +4,12 @@ import io.appwrite.services.Databases val client = Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID + .setAdmin("") // .setKey("") // Your secret API key val databases = Databases(client) val response = databases.upsertDocuments( databaseId = "", - collectionId = "", - documents = listOf() + collectionId = "" ) diff --git a/docs/examples/kotlin/tables/create-boolean-column.md b/docs/examples/kotlin/tables/create-boolean-column.md new file mode 100644 index 0000000..68b8dc5 --- /dev/null +++ b/docs/examples/kotlin/tables/create-boolean-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.createBooleanColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = false, // optional + array = false // optional +) diff --git a/docs/examples/kotlin/tables/create-datetime-column.md b/docs/examples/kotlin/tables/create-datetime-column.md new file mode 100644 index 0000000..8740a71 --- /dev/null +++ b/docs/examples/kotlin/tables/create-datetime-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.createDatetimeColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "", // optional + array = false // optional +) diff --git a/docs/examples/kotlin/tables/create-email-column.md b/docs/examples/kotlin/tables/create-email-column.md new file mode 100644 index 0000000..34a6cb6 --- /dev/null +++ b/docs/examples/kotlin/tables/create-email-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.createEmailColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "email@example.com", // optional + array = false // optional +) diff --git a/docs/examples/kotlin/tables/create-enum-column.md b/docs/examples/kotlin/tables/create-enum-column.md new file mode 100644 index 0000000..d3d2fc9 --- /dev/null +++ b/docs/examples/kotlin/tables/create-enum-column.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.createEnumColumn( + databaseId = "", + tableId = "", + key = "", + elements = listOf(), + required = false, + default = "", // optional + array = false // optional +) diff --git a/docs/examples/kotlin/tables/create-float-column.md b/docs/examples/kotlin/tables/create-float-column.md new file mode 100644 index 0000000..8540430 --- /dev/null +++ b/docs/examples/kotlin/tables/create-float-column.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.createFloatColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + min = 0, // optional + max = 0, // optional + default = 0, // optional + array = false // optional +) diff --git a/docs/examples/kotlin/tables/create-index.md b/docs/examples/kotlin/tables/create-index.md new file mode 100644 index 0000000..053c88a --- /dev/null +++ b/docs/examples/kotlin/tables/create-index.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables +import io.appwrite.enums.IndexType + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.createIndex( + databaseId = "", + tableId = "", + key = "", + type = IndexType.KEY, + columns = listOf(), + orders = listOf(), // optional + lengths = listOf() // optional +) diff --git a/docs/examples/kotlin/tables/create-integer-column.md b/docs/examples/kotlin/tables/create-integer-column.md new file mode 100644 index 0000000..1222746 --- /dev/null +++ b/docs/examples/kotlin/tables/create-integer-column.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.createIntegerColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + min = 0, // optional + max = 0, // optional + default = 0, // optional + array = false // optional +) diff --git a/docs/examples/kotlin/tables/create-ip-column.md b/docs/examples/kotlin/tables/create-ip-column.md new file mode 100644 index 0000000..277c756 --- /dev/null +++ b/docs/examples/kotlin/tables/create-ip-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.createIpColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "", // optional + array = false // optional +) diff --git a/docs/examples/kotlin/tables/create-relationship-column.md b/docs/examples/kotlin/tables/create-relationship-column.md new file mode 100644 index 0000000..aa07fac --- /dev/null +++ b/docs/examples/kotlin/tables/create-relationship-column.md @@ -0,0 +1,22 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables +import io.appwrite.enums.RelationshipType + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.createRelationshipColumn( + databaseId = "", + tableId = "", + relatedTableId = "", + type = RelationshipType.ONETOONE, + twoWay = false, // optional + key = "", // optional + twoWayKey = "", // optional + onDelete = "cascade" // optional +) diff --git a/docs/examples/kotlin/tables/create-row.md b/docs/examples/kotlin/tables/create-row.md new file mode 100644 index 0000000..5df0890 --- /dev/null +++ b/docs/examples/kotlin/tables/create-row.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setSession("") // The user session to authenticate with + .setKey("") // Your secret API key + .setJWT("") // Your secret JSON Web Token + +val tables = Tables(client) + +val response = tables.createRow( + databaseId = "", + tableId = "", + rowId = "", + data = mapOf( "a" to "b" ), + permissions = listOf("read("any")") // optional +) diff --git a/docs/examples/kotlin/tables/create-rows.md b/docs/examples/kotlin/tables/create-rows.md new file mode 100644 index 0000000..f549d6f --- /dev/null +++ b/docs/examples/kotlin/tables/create-rows.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setAdmin("") // + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.createRows( + databaseId = "", + tableId = "", + rows = listOf() +) diff --git a/docs/examples/kotlin/tables/create-string-column.md b/docs/examples/kotlin/tables/create-string-column.md new file mode 100644 index 0000000..d82026c --- /dev/null +++ b/docs/examples/kotlin/tables/create-string-column.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.createStringColumn( + databaseId = "", + tableId = "", + key = "", + size = 1, + required = false, + default = "", // optional + array = false, // optional + encrypt = false // optional +) diff --git a/docs/examples/kotlin/tables/create-url-column.md b/docs/examples/kotlin/tables/create-url-column.md new file mode 100644 index 0000000..42f50e9 --- /dev/null +++ b/docs/examples/kotlin/tables/create-url-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.createUrlColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "https://example.com", // optional + array = false // optional +) diff --git a/docs/examples/kotlin/tables/create.md b/docs/examples/kotlin/tables/create.md new file mode 100644 index 0000000..3dc1d1a --- /dev/null +++ b/docs/examples/kotlin/tables/create.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.create( + databaseId = "", + tableId = "", + name = "", + permissions = listOf("read("any")"), // optional + rowSecurity = false, // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/tables/decrement-row-column.md b/docs/examples/kotlin/tables/decrement-row-column.md new file mode 100644 index 0000000..f78f7bb --- /dev/null +++ b/docs/examples/kotlin/tables/decrement-row-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.decrementRowColumn( + databaseId = "", + tableId = "", + rowId = "", + column = "", + value = 0, // optional + min = 0 // optional +) diff --git a/docs/examples/kotlin/tables/delete-column.md b/docs/examples/kotlin/tables/delete-column.md new file mode 100644 index 0000000..d41f2ce --- /dev/null +++ b/docs/examples/kotlin/tables/delete-column.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.deleteColumn( + databaseId = "", + tableId = "", + key = "" +) diff --git a/docs/examples/kotlin/tables/delete-index.md b/docs/examples/kotlin/tables/delete-index.md new file mode 100644 index 0000000..7af6648 --- /dev/null +++ b/docs/examples/kotlin/tables/delete-index.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.deleteIndex( + databaseId = "", + tableId = "", + key = "" +) diff --git a/docs/examples/kotlin/tables/delete-row.md b/docs/examples/kotlin/tables/delete-row.md new file mode 100644 index 0000000..d182ccf --- /dev/null +++ b/docs/examples/kotlin/tables/delete-row.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val tables = Tables(client) + +val response = tables.deleteRow( + databaseId = "", + tableId = "", + rowId = "" +) diff --git a/docs/examples/kotlin/tables/delete-rows.md b/docs/examples/kotlin/tables/delete-rows.md new file mode 100644 index 0000000..54ff6b6 --- /dev/null +++ b/docs/examples/kotlin/tables/delete-rows.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.deleteRows( + databaseId = "", + tableId = "", + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/tables/delete.md b/docs/examples/kotlin/tables/delete.md new file mode 100644 index 0000000..5cbd032 --- /dev/null +++ b/docs/examples/kotlin/tables/delete.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.delete( + databaseId = "", + tableId = "" +) diff --git a/docs/examples/kotlin/tables/get-column.md b/docs/examples/kotlin/tables/get-column.md new file mode 100644 index 0000000..6f4d65b --- /dev/null +++ b/docs/examples/kotlin/tables/get-column.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.getColumn( + databaseId = "", + tableId = "", + key = "" +) diff --git a/docs/examples/kotlin/tables/get-index.md b/docs/examples/kotlin/tables/get-index.md new file mode 100644 index 0000000..660502f --- /dev/null +++ b/docs/examples/kotlin/tables/get-index.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.getIndex( + databaseId = "", + tableId = "", + key = "" +) diff --git a/docs/examples/kotlin/tables/get-row.md b/docs/examples/kotlin/tables/get-row.md new file mode 100644 index 0000000..cbaaa6c --- /dev/null +++ b/docs/examples/kotlin/tables/get-row.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val tables = Tables(client) + +val response = tables.getRow( + databaseId = "", + tableId = "", + rowId = "", + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/tables/get.md b/docs/examples/kotlin/tables/get.md new file mode 100644 index 0000000..ff6d354 --- /dev/null +++ b/docs/examples/kotlin/tables/get.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.get( + databaseId = "", + tableId = "" +) diff --git a/docs/examples/kotlin/tables/increment-row-column.md b/docs/examples/kotlin/tables/increment-row-column.md new file mode 100644 index 0000000..7917b7f --- /dev/null +++ b/docs/examples/kotlin/tables/increment-row-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.incrementRowColumn( + databaseId = "", + tableId = "", + rowId = "", + column = "", + value = 0, // optional + max = 0 // optional +) diff --git a/docs/examples/kotlin/tables/list-columns.md b/docs/examples/kotlin/tables/list-columns.md new file mode 100644 index 0000000..4c17651 --- /dev/null +++ b/docs/examples/kotlin/tables/list-columns.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.listColumns( + databaseId = "", + tableId = "", + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/tables/list-indexes.md b/docs/examples/kotlin/tables/list-indexes.md new file mode 100644 index 0000000..bcd1fe7 --- /dev/null +++ b/docs/examples/kotlin/tables/list-indexes.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.listIndexes( + databaseId = "", + tableId = "", + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/tables/list-rows.md b/docs/examples/kotlin/tables/list-rows.md new file mode 100644 index 0000000..38b776a --- /dev/null +++ b/docs/examples/kotlin/tables/list-rows.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val tables = Tables(client) + +val response = tables.listRows( + databaseId = "", + tableId = "", + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/tables/list.md b/docs/examples/kotlin/tables/list.md new file mode 100644 index 0000000..37b0344 --- /dev/null +++ b/docs/examples/kotlin/tables/list.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.list( + databaseId = "", + queries = listOf(), // optional + search = "" // optional +) diff --git a/docs/examples/kotlin/tables/update-boolean-column.md b/docs/examples/kotlin/tables/update-boolean-column.md new file mode 100644 index 0000000..10a0422 --- /dev/null +++ b/docs/examples/kotlin/tables/update-boolean-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.updateBooleanColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = false, + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tables/update-datetime-column.md b/docs/examples/kotlin/tables/update-datetime-column.md new file mode 100644 index 0000000..69ccf03 --- /dev/null +++ b/docs/examples/kotlin/tables/update-datetime-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.updateDatetimeColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "", + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tables/update-email-column.md b/docs/examples/kotlin/tables/update-email-column.md new file mode 100644 index 0000000..593a89b --- /dev/null +++ b/docs/examples/kotlin/tables/update-email-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.updateEmailColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "email@example.com", + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tables/update-enum-column.md b/docs/examples/kotlin/tables/update-enum-column.md new file mode 100644 index 0000000..b672e3e --- /dev/null +++ b/docs/examples/kotlin/tables/update-enum-column.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.updateEnumColumn( + databaseId = "", + tableId = "", + key = "", + elements = listOf(), + required = false, + default = "", + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tables/update-float-column.md b/docs/examples/kotlin/tables/update-float-column.md new file mode 100644 index 0000000..005c4e6 --- /dev/null +++ b/docs/examples/kotlin/tables/update-float-column.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.updateFloatColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = 0, + min = 0, // optional + max = 0, // optional + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tables/update-integer-column.md b/docs/examples/kotlin/tables/update-integer-column.md new file mode 100644 index 0000000..39da19d --- /dev/null +++ b/docs/examples/kotlin/tables/update-integer-column.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.updateIntegerColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = 0, + min = 0, // optional + max = 0, // optional + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tables/update-ip-column.md b/docs/examples/kotlin/tables/update-ip-column.md new file mode 100644 index 0000000..40e54bc --- /dev/null +++ b/docs/examples/kotlin/tables/update-ip-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.updateIpColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "", + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tables/update-relationship-column.md b/docs/examples/kotlin/tables/update-relationship-column.md new file mode 100644 index 0000000..d4c36e8 --- /dev/null +++ b/docs/examples/kotlin/tables/update-relationship-column.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.updateRelationshipColumn( + databaseId = "", + tableId = "", + key = "", + onDelete = "cascade", // optional + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tables/update-row.md b/docs/examples/kotlin/tables/update-row.md new file mode 100644 index 0000000..6d3d9a4 --- /dev/null +++ b/docs/examples/kotlin/tables/update-row.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val tables = Tables(client) + +val response = tables.updateRow( + databaseId = "", + tableId = "", + rowId = "", + data = mapOf( "a" to "b" ), // optional + permissions = listOf("read("any")") // optional +) diff --git a/docs/examples/kotlin/tables/update-rows.md b/docs/examples/kotlin/tables/update-rows.md new file mode 100644 index 0000000..aac87c1 --- /dev/null +++ b/docs/examples/kotlin/tables/update-rows.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.updateRows( + databaseId = "", + tableId = "", + data = mapOf( "a" to "b" ), // optional + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/tables/update-string-column.md b/docs/examples/kotlin/tables/update-string-column.md new file mode 100644 index 0000000..bb5b1f4 --- /dev/null +++ b/docs/examples/kotlin/tables/update-string-column.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.updateStringColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "", + size = 1, // optional + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tables/update-url-column.md b/docs/examples/kotlin/tables/update-url-column.md new file mode 100644 index 0000000..07f43e3 --- /dev/null +++ b/docs/examples/kotlin/tables/update-url-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.updateUrlColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "https://example.com", + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tables/update.md b/docs/examples/kotlin/tables/update.md new file mode 100644 index 0000000..3815323 --- /dev/null +++ b/docs/examples/kotlin/tables/update.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.update( + databaseId = "", + tableId = "", + name = "", + permissions = listOf("read("any")"), // optional + rowSecurity = false, // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/tables/upsert-row.md b/docs/examples/kotlin/tables/upsert-row.md new file mode 100644 index 0000000..6e02b3a --- /dev/null +++ b/docs/examples/kotlin/tables/upsert-row.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setSession("") // The user session to authenticate with + .setKey("") // Your secret API key + .setJWT("") // Your secret JSON Web Token + +val tables = Tables(client) + +val response = tables.upsertRow( + databaseId = "", + tableId = "", + rowId = "" +) diff --git a/docs/examples/kotlin/tables/upsert-rows.md b/docs/examples/kotlin/tables/upsert-rows.md new file mode 100644 index 0000000..d639e3d --- /dev/null +++ b/docs/examples/kotlin/tables/upsert-rows.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tables + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setAdmin("") // + .setKey("") // Your secret API key + +val tables = Tables(client) + +val response = tables.upsertRows( + databaseId = "", + tableId = "" +) diff --git a/src/main/kotlin/io/appwrite/Client.kt b/src/main/kotlin/io/appwrite/Client.kt index 429131e..41a6878 100644 --- a/src/main/kotlin/io/appwrite/Client.kt +++ b/src/main/kotlin/io/appwrite/Client.kt @@ -58,12 +58,12 @@ class Client @JvmOverloads constructor( init { headers = mutableMapOf( "content-type" to "application/json", - "user-agent" to "AppwriteKotlinSDK/9.1.0 ${System.getProperty("http.agent")}", + "user-agent" to "AppwriteKotlinSDK/10.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 "9.1.0", - "x-appwrite-response-format" to "1.7.0", + "x-sdk-version" to "10.0.0", + "x-appwrite-response-format" to "1.8.0", ) config = mutableMapOf() diff --git a/src/main/kotlin/io/appwrite/models/BucketList.kt b/src/main/kotlin/io/appwrite/models/BucketList.kt index 91e331f..58cce61 100644 --- a/src/main/kotlin/io/appwrite/models/BucketList.kt +++ b/src/main/kotlin/io/appwrite/models/BucketList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class BucketList( /** - * Total number of buckets documents that matched your query. + * Total number of buckets rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/CollectionList.kt b/src/main/kotlin/io/appwrite/models/CollectionList.kt index b171ae8..6cd040a 100644 --- a/src/main/kotlin/io/appwrite/models/CollectionList.kt +++ b/src/main/kotlin/io/appwrite/models/CollectionList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class CollectionList( /** - * Total number of collections documents that matched your query. + * Total number of collections rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/ColumnBoolean.kt b/src/main/kotlin/io/appwrite/models/ColumnBoolean.kt new file mode 100644 index 0000000..fc5c45e --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnBoolean.kt @@ -0,0 +1,94 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * ColumnBoolean + */ +data class ColumnBoolean( + /** + * 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 attribute when not provided. Cannot be set when attribute is required. + */ + @SerializedName("default") + var default: Boolean?, + +) { + 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, + ) = ColumnBoolean( + 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? Boolean?, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnDatetime.kt b/src/main/kotlin/io/appwrite/models/ColumnDatetime.kt new file mode 100644 index 0000000..3c5c446 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnDatetime.kt @@ -0,0 +1,102 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * ColumnDatetime + */ +data class ColumnDatetime( + /** + * 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, + + /** + * ISO 8601 format. + */ + @SerializedName("format") + val format: String, + + /** + * Default value for attribute when not provided. Only null is optional + */ + @SerializedName("default") + var default: String?, + +) { + 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, + "format" to format as Any, + "default" to default as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ColumnDatetime( + 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, + format = map["format"] as String, + default = map["default"] as? String?, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnEmail.kt b/src/main/kotlin/io/appwrite/models/ColumnEmail.kt new file mode 100644 index 0000000..43c9cf2 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnEmail.kt @@ -0,0 +1,102 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * ColumnEmail + */ +data class ColumnEmail( + /** + * 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, + + /** + * String format. + */ + @SerializedName("format") + val format: String, + + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + @SerializedName("default") + var default: String?, + +) { + 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, + "format" to format as Any, + "default" to default as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ColumnEmail( + 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, + format = map["format"] as String, + default = map["default"] as? String?, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnEnum.kt b/src/main/kotlin/io/appwrite/models/ColumnEnum.kt new file mode 100644 index 0000000..717316b --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnEnum.kt @@ -0,0 +1,110 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * ColumnEnum + */ +data class ColumnEnum( + /** + * 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, + + /** + * Array of elements in enumerated type. + */ + @SerializedName("elements") + val elements: List, + + /** + * String format. + */ + @SerializedName("format") + val format: String, + + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + @SerializedName("default") + var default: String?, + +) { + 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, + "elements" to elements as Any, + "format" to format as Any, + "default" to default as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ColumnEnum( + 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, + elements = map["elements"] as List, + format = map["format"] as String, + default = map["default"] as? String?, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnFloat.kt b/src/main/kotlin/io/appwrite/models/ColumnFloat.kt new file mode 100644 index 0000000..92b7a2f --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnFloat.kt @@ -0,0 +1,110 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * ColumnFloat + */ +data class ColumnFloat( + /** + * 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, + + /** + * Minimum value to enforce for new documents. + */ + @SerializedName("min") + var min: Double?, + + /** + * Maximum value to enforce for new documents. + */ + @SerializedName("max") + var max: Double?, + + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + @SerializedName("default") + var default: Double?, + +) { + 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, + "min" to min as Any, + "max" to max as Any, + "default" to default as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ColumnFloat( + 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, + min = (map["min"] as? Number)?.toDouble(), + max = (map["max"] as? Number)?.toDouble(), + default = (map["default"] as? Number)?.toDouble(), + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnIndex.kt b/src/main/kotlin/io/appwrite/models/ColumnIndex.kt new file mode 100644 index 0000000..4912fe9 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnIndex.kt @@ -0,0 +1,94 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Index + */ +data class ColumnIndex( + /** + * Index Key. + */ + @SerializedName("key") + val key: String, + + /** + * Index type. + */ + @SerializedName("type") + val type: String, + + /** + * Index 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 index. + */ + @SerializedName("error") + val error: String, + + /** + * Index columns. + */ + @SerializedName("columns") + val columns: List, + + /** + * Index columns length. + */ + @SerializedName("lengths") + val lengths: List, + + /** + * Index orders. + */ + @SerializedName("orders") + var orders: List?, + + /** + * Index creation date in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Index update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + +) { + fun toMap(): Map = mapOf( + "key" to key as Any, + "type" to type as Any, + "status" to status as Any, + "error" to error as Any, + "columns" to columns as Any, + "lengths" to lengths as Any, + "orders" to orders as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ColumnIndex( + key = map["key"] as String, + type = map["type"] as String, + status = map["status"] as String, + error = map["error"] as String, + columns = map["columns"] as List, + lengths = map["lengths"] as List, + orders = map["orders"] as? List?, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnIndexList.kt b/src/main/kotlin/io/appwrite/models/ColumnIndexList.kt new file mode 100644 index 0000000..fc877a9 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnIndexList.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Column Indexes List + */ +data class ColumnIndexList( + /** + * Total number of indexes rows that matched your query. + */ + @SerializedName("total") + val total: Long, + + /** + * List of indexes. + */ + @SerializedName("indexes") + val indexes: List, + +) { + fun toMap(): Map = mapOf( + "total" to total as Any, + "indexes" to indexes.map { it.toMap() } as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ColumnIndexList( + total = (map["total"] as Number).toLong(), + indexes = (map["indexes"] as List>).map { ColumnIndex.from(map = it) }, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnInteger.kt b/src/main/kotlin/io/appwrite/models/ColumnInteger.kt new file mode 100644 index 0000000..0545ec5 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnInteger.kt @@ -0,0 +1,110 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * ColumnInteger + */ +data class ColumnInteger( + /** + * 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, + + /** + * Minimum value to enforce for new documents. + */ + @SerializedName("min") + var min: Long?, + + /** + * Maximum value to enforce for new documents. + */ + @SerializedName("max") + var max: Long?, + + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + @SerializedName("default") + var default: Long?, + +) { + 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, + "min" to min as Any, + "max" to max as Any, + "default" to default as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ColumnInteger( + 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, + min = (map["min"] as? Number)?.toLong(), + max = (map["max"] as? Number)?.toLong(), + default = (map["default"] as? Number)?.toLong(), + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnIp.kt b/src/main/kotlin/io/appwrite/models/ColumnIp.kt new file mode 100644 index 0000000..dad7442 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnIp.kt @@ -0,0 +1,102 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * ColumnIP + */ +data class ColumnIp( + /** + * 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, + + /** + * String format. + */ + @SerializedName("format") + val format: String, + + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + @SerializedName("default") + var default: String?, + +) { + 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, + "format" to format as Any, + "default" to default as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ColumnIp( + 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, + format = map["format"] as String, + default = map["default"] as? String?, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnList.kt b/src/main/kotlin/io/appwrite/models/ColumnList.kt new file mode 100644 index 0000000..06e8bd4 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnList.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Columns List + */ +data class ColumnList( + /** + * Total number of columns in the given table. + */ + @SerializedName("total") + val total: Long, + + /** + * List of columns. + */ + @SerializedName("columns") + val columns: List, + +) { + fun toMap(): Map = mapOf( + "total" to total as Any, + "columns" to columns as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ColumnList( + total = (map["total"] as Number).toLong(), + columns = map["columns"] as List, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnRelationship.kt b/src/main/kotlin/io/appwrite/models/ColumnRelationship.kt new file mode 100644 index 0000000..5524b42 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnRelationship.kt @@ -0,0 +1,134 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * ColumnRelationship + */ +data class ColumnRelationship( + /** + * 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, + + /** + * The ID of the related table. + */ + @SerializedName("relatedTable") + val relatedTable: String, + + /** + * The type of the relationship. + */ + @SerializedName("relationType") + val relationType: String, + + /** + * Is the relationship two-way? + */ + @SerializedName("twoWay") + val twoWay: Boolean, + + /** + * The key of the two-way relationship. + */ + @SerializedName("twoWayKey") + val twoWayKey: String, + + /** + * How deleting the parent document will propagate to child documents. + */ + @SerializedName("onDelete") + val onDelete: String, + + /** + * Whether this is the parent or child side of the relationship + */ + @SerializedName("side") + val side: String, + +) { + 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, + "relatedTable" to relatedTable as Any, + "relationType" to relationType as Any, + "twoWay" to twoWay as Any, + "twoWayKey" to twoWayKey as Any, + "onDelete" to onDelete as Any, + "side" to side as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ColumnRelationship( + 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, + relatedTable = map["relatedTable"] as String, + relationType = map["relationType"] as String, + twoWay = map["twoWay"] as Boolean, + twoWayKey = map["twoWayKey"] as String, + onDelete = map["onDelete"] as String, + side = map["side"] as String, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnString.kt b/src/main/kotlin/io/appwrite/models/ColumnString.kt new file mode 100644 index 0000000..773a8ce --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnString.kt @@ -0,0 +1,110 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * ColumnString + */ +data class ColumnString( + /** + * 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, + + /** + * Column size. + */ + @SerializedName("size") + val size: Long, + + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + @SerializedName("default") + var default: String?, + + /** + * Defines whether this column is encrypted or not. + */ + @SerializedName("encrypt") + var encrypt: Boolean?, + +) { + 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, + "size" to size as Any, + "default" to default as Any, + "encrypt" to encrypt as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ColumnString( + 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, + size = (map["size"] as Number).toLong(), + default = map["default"] as? String?, + encrypt = map["encrypt"] as? Boolean?, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnUrl.kt b/src/main/kotlin/io/appwrite/models/ColumnUrl.kt new file mode 100644 index 0000000..10cd5d9 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnUrl.kt @@ -0,0 +1,102 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * ColumnURL + */ +data class ColumnUrl( + /** + * 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, + + /** + * String format. + */ + @SerializedName("format") + val format: String, + + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + @SerializedName("default") + var default: String?, + +) { + 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, + "format" to format as Any, + "default" to default as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ColumnUrl( + 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, + format = map["format"] as String, + default = map["default"] as? String?, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ContinentList.kt b/src/main/kotlin/io/appwrite/models/ContinentList.kt index fdd490a..a6ec310 100644 --- a/src/main/kotlin/io/appwrite/models/ContinentList.kt +++ b/src/main/kotlin/io/appwrite/models/ContinentList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class ContinentList( /** - * Total number of continents documents that matched your query. + * Total number of continents rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/CountryList.kt b/src/main/kotlin/io/appwrite/models/CountryList.kt index 350a894..546cf73 100644 --- a/src/main/kotlin/io/appwrite/models/CountryList.kt +++ b/src/main/kotlin/io/appwrite/models/CountryList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class CountryList( /** - * Total number of countries documents that matched your query. + * Total number of countries rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/CurrencyList.kt b/src/main/kotlin/io/appwrite/models/CurrencyList.kt index fe1e001..95dec92 100644 --- a/src/main/kotlin/io/appwrite/models/CurrencyList.kt +++ b/src/main/kotlin/io/appwrite/models/CurrencyList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class CurrencyList( /** - * Total number of currencies documents that matched your query. + * Total number of currencies rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/DatabaseList.kt b/src/main/kotlin/io/appwrite/models/DatabaseList.kt index 81c91aa..3b98e29 100644 --- a/src/main/kotlin/io/appwrite/models/DatabaseList.kt +++ b/src/main/kotlin/io/appwrite/models/DatabaseList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class DatabaseList( /** - * Total number of databases documents that matched your query. + * Total number of databases rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/DeploymentList.kt b/src/main/kotlin/io/appwrite/models/DeploymentList.kt index 2b7cf64..3bc6f49 100644 --- a/src/main/kotlin/io/appwrite/models/DeploymentList.kt +++ b/src/main/kotlin/io/appwrite/models/DeploymentList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class DeploymentList( /** - * Total number of deployments documents that matched your query. + * Total number of deployments rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/DocumentList.kt b/src/main/kotlin/io/appwrite/models/DocumentList.kt index fa3dd20..6f40579 100644 --- a/src/main/kotlin/io/appwrite/models/DocumentList.kt +++ b/src/main/kotlin/io/appwrite/models/DocumentList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class DocumentList( /** - * Total number of documents documents that matched your query. + * Total number of documents rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/ExecutionList.kt b/src/main/kotlin/io/appwrite/models/ExecutionList.kt index 322aeee..ac11e4f 100644 --- a/src/main/kotlin/io/appwrite/models/ExecutionList.kt +++ b/src/main/kotlin/io/appwrite/models/ExecutionList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class ExecutionList( /** - * Total number of executions documents that matched your query. + * Total number of executions rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/FileList.kt b/src/main/kotlin/io/appwrite/models/FileList.kt index 5af18f1..ba69ea8 100644 --- a/src/main/kotlin/io/appwrite/models/FileList.kt +++ b/src/main/kotlin/io/appwrite/models/FileList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class FileList( /** - * Total number of files documents that matched your query. + * Total number of files rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/FrameworkList.kt b/src/main/kotlin/io/appwrite/models/FrameworkList.kt index 41532c8..243bc0f 100644 --- a/src/main/kotlin/io/appwrite/models/FrameworkList.kt +++ b/src/main/kotlin/io/appwrite/models/FrameworkList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class FrameworkList( /** - * Total number of frameworks documents that matched your query. + * Total number of frameworks rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/FunctionList.kt b/src/main/kotlin/io/appwrite/models/FunctionList.kt index 6aaa86a..7ffe820 100644 --- a/src/main/kotlin/io/appwrite/models/FunctionList.kt +++ b/src/main/kotlin/io/appwrite/models/FunctionList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class FunctionList( /** - * Total number of functions documents that matched your query. + * Total number of functions rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/IdentityList.kt b/src/main/kotlin/io/appwrite/models/IdentityList.kt index 1cbb07d..2e1a33a 100644 --- a/src/main/kotlin/io/appwrite/models/IdentityList.kt +++ b/src/main/kotlin/io/appwrite/models/IdentityList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class IdentityList( /** - * Total number of identities documents that matched your query. + * Total number of identities rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/IndexList.kt b/src/main/kotlin/io/appwrite/models/IndexList.kt index a14167d..1c2120a 100644 --- a/src/main/kotlin/io/appwrite/models/IndexList.kt +++ b/src/main/kotlin/io/appwrite/models/IndexList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class IndexList( /** - * Total number of indexes documents that matched your query. + * Total number of indexes rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/LanguageList.kt b/src/main/kotlin/io/appwrite/models/LanguageList.kt index 07559b9..ab78452 100644 --- a/src/main/kotlin/io/appwrite/models/LanguageList.kt +++ b/src/main/kotlin/io/appwrite/models/LanguageList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class LanguageList( /** - * Total number of languages documents that matched your query. + * Total number of languages rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/LocaleCodeList.kt b/src/main/kotlin/io/appwrite/models/LocaleCodeList.kt index 3973a03..6f47333 100644 --- a/src/main/kotlin/io/appwrite/models/LocaleCodeList.kt +++ b/src/main/kotlin/io/appwrite/models/LocaleCodeList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class LocaleCodeList( /** - * Total number of localeCodes documents that matched your query. + * Total number of localeCodes rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/LogList.kt b/src/main/kotlin/io/appwrite/models/LogList.kt index b9f381c..d2e0b00 100644 --- a/src/main/kotlin/io/appwrite/models/LogList.kt +++ b/src/main/kotlin/io/appwrite/models/LogList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class LogList( /** - * Total number of logs documents that matched your query. + * Total number of logs rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/MembershipList.kt b/src/main/kotlin/io/appwrite/models/MembershipList.kt index 7feaaaa..efcffc4 100644 --- a/src/main/kotlin/io/appwrite/models/MembershipList.kt +++ b/src/main/kotlin/io/appwrite/models/MembershipList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class MembershipList( /** - * Total number of memberships documents that matched your query. + * Total number of memberships rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/MessageList.kt b/src/main/kotlin/io/appwrite/models/MessageList.kt index 85e4a1b..1926541 100644 --- a/src/main/kotlin/io/appwrite/models/MessageList.kt +++ b/src/main/kotlin/io/appwrite/models/MessageList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class MessageList( /** - * Total number of messages documents that matched your query. + * Total number of messages rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/PhoneList.kt b/src/main/kotlin/io/appwrite/models/PhoneList.kt index b17de4f..675295f 100644 --- a/src/main/kotlin/io/appwrite/models/PhoneList.kt +++ b/src/main/kotlin/io/appwrite/models/PhoneList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class PhoneList( /** - * Total number of phones documents that matched your query. + * Total number of phones rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/ProviderList.kt b/src/main/kotlin/io/appwrite/models/ProviderList.kt index 113ba67..4223124 100644 --- a/src/main/kotlin/io/appwrite/models/ProviderList.kt +++ b/src/main/kotlin/io/appwrite/models/ProviderList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class ProviderList( /** - * Total number of providers documents that matched your query. + * Total number of providers rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/ResourceTokenList.kt b/src/main/kotlin/io/appwrite/models/ResourceTokenList.kt index bb9e6d7..aaf22f8 100644 --- a/src/main/kotlin/io/appwrite/models/ResourceTokenList.kt +++ b/src/main/kotlin/io/appwrite/models/ResourceTokenList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class ResourceTokenList( /** - * Total number of tokens documents that matched your query. + * Total number of tokens rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/Row.kt b/src/main/kotlin/io/appwrite/models/Row.kt new file mode 100644 index 0000000..bb5c14f --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/Row.kt @@ -0,0 +1,105 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Row + */ +data class Row( + /** + * Row ID. + */ + @SerializedName("\$id") + val id: String, + + /** + * Row automatically incrementing ID. + */ + @SerializedName("\$sequence") + val sequence: Long, + + /** + * Table ID. + */ + @SerializedName("\$tableId") + val tableId: String, + + /** + * Database ID. + */ + @SerializedName("\$databaseId") + val databaseId: String, + + /** + * Row creation date in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Row update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + + /** + * Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + @SerializedName("\$permissions") + val permissions: List, + + /** + * Additional properties + */ + @SerializedName("data") + val data: T +) { + fun toMap(): Map = mapOf( + "\$id" to id as Any, + "\$sequence" to sequence as Any, + "\$tableId" to tableId as Any, + "\$databaseId" to databaseId as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, + "\$permissions" to permissions as Any, + "data" to data!!.jsonCast(to = Map::class.java) + ) + + companion object { + operator fun invoke( + id: String, + sequence: Long, + tableId: String, + databaseId: String, + createdAt: String, + updatedAt: String, + permissions: List, + data: Map + ) = Row>( + id, + sequence, + tableId, + databaseId, + createdAt, + updatedAt, + permissions, + data + ) + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + nestedType: Class + ) = Row( + id = map["\$id"] as String, + sequence = (map["\$sequence"] as Number).toLong(), + tableId = map["\$tableId"] as String, + databaseId = map["\$databaseId"] as String, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, + permissions = map["\$permissions"] as List, + data = map.jsonCast(to = nestedType) + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/RowList.kt b/src/main/kotlin/io/appwrite/models/RowList.kt new file mode 100644 index 0000000..289f39b --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/RowList.kt @@ -0,0 +1,46 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Rows List + */ +data class RowList( + /** + * Total number of rows rows that matched your query. + */ + @SerializedName("total") + val total: Long, + + /** + * List of rows. + */ + @SerializedName("rows") + val rows: List>, + +) { + fun toMap(): Map = mapOf( + "total" to total as Any, + "rows" to rows.map { it.toMap() } as Any, + ) + + companion object { + operator fun invoke( + total: Long, + rows: List>>, + ) = RowList>( + total, + rows, + ) + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + nestedType: Class + ) = RowList( + total = (map["total"] as Number).toLong(), + rows = (map["rows"] as List>).map { Row.from(map = it, nestedType) }, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/RuntimeList.kt b/src/main/kotlin/io/appwrite/models/RuntimeList.kt index d08e9a2..55c17d9 100644 --- a/src/main/kotlin/io/appwrite/models/RuntimeList.kt +++ b/src/main/kotlin/io/appwrite/models/RuntimeList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class RuntimeList( /** - * Total number of runtimes documents that matched your query. + * Total number of runtimes rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/SessionList.kt b/src/main/kotlin/io/appwrite/models/SessionList.kt index c7080e6..13e0c36 100644 --- a/src/main/kotlin/io/appwrite/models/SessionList.kt +++ b/src/main/kotlin/io/appwrite/models/SessionList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class SessionList( /** - * Total number of sessions documents that matched your query. + * Total number of sessions rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/SiteList.kt b/src/main/kotlin/io/appwrite/models/SiteList.kt index 15ecc7f..5332571 100644 --- a/src/main/kotlin/io/appwrite/models/SiteList.kt +++ b/src/main/kotlin/io/appwrite/models/SiteList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class SiteList( /** - * Total number of sites documents that matched your query. + * Total number of sites rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/SpecificationList.kt b/src/main/kotlin/io/appwrite/models/SpecificationList.kt index f504577..5ac8cf9 100644 --- a/src/main/kotlin/io/appwrite/models/SpecificationList.kt +++ b/src/main/kotlin/io/appwrite/models/SpecificationList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class SpecificationList( /** - * Total number of specifications documents that matched your query. + * Total number of specifications rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/SubscriberList.kt b/src/main/kotlin/io/appwrite/models/SubscriberList.kt index 87181a3..8f811c7 100644 --- a/src/main/kotlin/io/appwrite/models/SubscriberList.kt +++ b/src/main/kotlin/io/appwrite/models/SubscriberList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class SubscriberList( /** - * Total number of subscribers documents that matched your query. + * Total number of subscribers rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/Table.kt b/src/main/kotlin/io/appwrite/models/Table.kt new file mode 100644 index 0000000..9b43c41 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/Table.kt @@ -0,0 +1,102 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Table + */ +data class Table( + /** + * Table ID. + */ + @SerializedName("\$id") + val id: String, + + /** + * Table creation date in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Table update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + + /** + * Table permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + @SerializedName("\$permissions") + val permissions: List, + + /** + * Database ID. + */ + @SerializedName("databaseId") + val databaseId: String, + + /** + * Table name. + */ + @SerializedName("name") + val name: String, + + /** + * Table enabled. Can be 'enabled' or 'disabled'. When disabled, the table is inaccessible to users, but remains accessible to Server SDKs using API keys. + */ + @SerializedName("enabled") + val enabled: Boolean, + + /** + * Whether row-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + @SerializedName("rowSecurity") + val rowSecurity: Boolean, + + /** + * Table columns. + */ + @SerializedName("columns") + val columns: List, + + /** + * Table indexes. + */ + @SerializedName("indexes") + val indexes: List, + +) { + fun toMap(): Map = mapOf( + "\$id" to id as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, + "\$permissions" to permissions as Any, + "databaseId" to databaseId as Any, + "name" to name as Any, + "enabled" to enabled as Any, + "rowSecurity" to rowSecurity as Any, + "columns" to columns as Any, + "indexes" to indexes.map { it.toMap() } as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = Table( + id = map["\$id"] as String, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, + permissions = map["\$permissions"] as List, + databaseId = map["databaseId"] as String, + name = map["name"] as String, + enabled = map["enabled"] as Boolean, + rowSecurity = map["rowSecurity"] as Boolean, + columns = map["columns"] as List, + indexes = (map["indexes"] as List>).map { ColumnIndex.from(map = it) }, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/TableList.kt b/src/main/kotlin/io/appwrite/models/TableList.kt new file mode 100644 index 0000000..3ee5afb --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/TableList.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Tables List + */ +data class TableList( + /** + * Total number of tables rows that matched your query. + */ + @SerializedName("total") + val total: Long, + + /** + * List of tables. + */ + @SerializedName("tables") + val tables: List, + +) { + fun toMap(): Map = mapOf( + "total" to total as Any, + "tables" to tables.map { it.toMap() } as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = TableList( + total = (map["total"] as Number).toLong(), + tables = (map["tables"] as List>).map { Table.from(map = it) }, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/TargetList.kt b/src/main/kotlin/io/appwrite/models/TargetList.kt index 01470c8..8b94727 100644 --- a/src/main/kotlin/io/appwrite/models/TargetList.kt +++ b/src/main/kotlin/io/appwrite/models/TargetList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class TargetList( /** - * Total number of targets documents that matched your query. + * Total number of targets rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/TeamList.kt b/src/main/kotlin/io/appwrite/models/TeamList.kt index 17ccd6b..f1a1968 100644 --- a/src/main/kotlin/io/appwrite/models/TeamList.kt +++ b/src/main/kotlin/io/appwrite/models/TeamList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class TeamList( /** - * Total number of teams documents that matched your query. + * Total number of teams rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/TopicList.kt b/src/main/kotlin/io/appwrite/models/TopicList.kt index 7173fec..2a1cc5f 100644 --- a/src/main/kotlin/io/appwrite/models/TopicList.kt +++ b/src/main/kotlin/io/appwrite/models/TopicList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class TopicList( /** - * Total number of topics documents that matched your query. + * Total number of topics rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/UserList.kt b/src/main/kotlin/io/appwrite/models/UserList.kt index efe164f..3bf322e 100644 --- a/src/main/kotlin/io/appwrite/models/UserList.kt +++ b/src/main/kotlin/io/appwrite/models/UserList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class UserList( /** - * Total number of users documents that matched your query. + * Total number of users rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/VariableList.kt b/src/main/kotlin/io/appwrite/models/VariableList.kt index 06004c6..3f7e430 100644 --- a/src/main/kotlin/io/appwrite/models/VariableList.kt +++ b/src/main/kotlin/io/appwrite/models/VariableList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class VariableList( /** - * Total number of variables documents that matched your query. + * Total number of variables rows that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/services/Account.kt b/src/main/kotlin/io/appwrite/services/Account.kt index 26494eb..dcfe70d 100644 --- a/src/main/kotlin/io/appwrite/services/Account.kt +++ b/src/main/kotlin/io/appwrite/services/Account.kt @@ -1046,6 +1046,9 @@ class Account(client: Client) : Service(client) { * @param secret Valid verification token. * @return [io.appwrite.models.Session] */ + @Deprecated( + message = "This API has been deprecated." + ) @Throws(AppwriteException::class) suspend fun updateMagicURLSession( userId: String, @@ -1080,6 +1083,9 @@ class Account(client: Client) : Service(client) { * @param secret Valid verification token. * @return [io.appwrite.models.Session] */ + @Deprecated( + message = "This API has been deprecated." + ) @Throws(AppwriteException::class) suspend fun updatePhoneSession( userId: String, diff --git a/src/main/kotlin/io/appwrite/services/Databases.kt b/src/main/kotlin/io/appwrite/services/Databases.kt index 6c57ede..688d372 100644 --- a/src/main/kotlin/io/appwrite/services/Databases.kt +++ b/src/main/kotlin/io/appwrite/services/Databases.kt @@ -188,6 +188,11 @@ class Databases(client: Client) : Service(client) { * @param search Search term to filter your list results. Max length: 256 chars. * @return [io.appwrite.models.CollectionList] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.list` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.list"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun listCollections( @@ -228,6 +233,11 @@ class Databases(client: Client) : Service(client) { * @param enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. * @return [io.appwrite.models.Collection] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.create` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.create"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createCollection( @@ -271,6 +281,11 @@ class Databases(client: Client) : Service(client) { * @param collectionId Collection ID. * @return [io.appwrite.models.Collection] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.get` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.get"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun getCollection( databaseId: String, @@ -308,6 +323,11 @@ class Databases(client: Client) : Service(client) { * @param enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. * @return [io.appwrite.models.Collection] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.update` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.update"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateCollection( @@ -351,6 +371,11 @@ class Databases(client: Client) : Service(client) { * @param collectionId Collection ID. * @return [Any] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.delete` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.delete"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun deleteCollection( databaseId: String, @@ -378,10 +403,15 @@ class Databases(client: Client) : Service(client) { * List attributes in the collection. * * @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 collectionId Collection ID. * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error * @return [io.appwrite.models.AttributeList] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.listColumns` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.listColumns"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun listAttributes( @@ -415,13 +445,18 @@ class Databases(client: Client) : Service(client) { * Create a boolean 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 collectionId Collection ID. You can create a new table 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. Cannot be set when attribute is required. * @param array Is attribute an array? * @return [io.appwrite.models.AttributeBoolean] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.createBooleanColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.createBooleanColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createBooleanAttribute( @@ -462,13 +497,18 @@ class Databases(client: Client) : Service(client) { * Update a boolean 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#databasesCreateCollection). + * @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. Cannot be set when attribute is required. * @param newKey New attribute key. * @return [io.appwrite.models.AttributeBoolean] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.updateBooleanColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.updateBooleanColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateBooleanAttribute( @@ -509,13 +549,18 @@ class Databases(client: Client) : Service(client) { * Create a date time attribute according to the ISO 8601 standard. * * @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 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 the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required. * @param array Is attribute an array? * @return [io.appwrite.models.AttributeDatetime] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.createDatetimeColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.createDatetimeColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createDatetimeAttribute( @@ -556,13 +601,18 @@ class Databases(client: Client) : Service(client) { * Update a date time 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#databasesCreateCollection). + * @param collectionId Collection ID. * @param key Attribute Key. * @param required Is attribute required? * @param default Default value for attribute when not provided. Cannot be set when attribute is required. * @param newKey New attribute key. * @return [io.appwrite.models.AttributeDatetime] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.updateDatetimeColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.updateDatetimeColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateDatetimeAttribute( @@ -603,13 +653,18 @@ class Databases(client: Client) : Service(client) { * Create an email 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 collectionId Collection ID. * @param key Attribute Key. * @param required Is attribute required? * @param default Default value for attribute when not provided. Cannot be set when attribute is required. * @param array Is attribute an array? * @return [io.appwrite.models.AttributeEmail] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.createEmailColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.createEmailColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createEmailAttribute( @@ -650,13 +705,18 @@ class Databases(client: Client) : Service(client) { * Update an email 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#databasesCreateCollection). + * @param collectionId Collection ID. * @param key Attribute Key. * @param required Is attribute required? * @param default Default value for attribute when not provided. Cannot be set when attribute is required. - * @param newKey New attribute key. + * @param newKey New Attribute Key. * @return [io.appwrite.models.AttributeEmail] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.updateEmailColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.updateEmailColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateEmailAttribute( @@ -694,17 +754,22 @@ class Databases(client: Client) : Service(client) { } /** - * Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute. + * Create an enum attribute. The `elements` param acts as a white-list of accepted values for this 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 collectionId Collection ID. * @param key Attribute Key. - * @param elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. + * @param elements Array of enum values. * @param required Is attribute required? * @param default Default value for attribute when not provided. Cannot be set when attribute is required. * @param array Is attribute an array? * @return [io.appwrite.models.AttributeEnum] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.createEnumColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.createEnumColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createEnumAttribute( @@ -747,14 +812,19 @@ class Databases(client: Client) : Service(client) { * Update an enum 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#databasesCreateCollection). + * @param collectionId Collection ID. * @param key Attribute Key. - * @param elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. + * @param elements Updated list of enum values. * @param required Is attribute required? * @param default Default value for attribute when not provided. Cannot be set when attribute is required. - * @param newKey New attribute key. + * @param newKey New Attribute Key. * @return [io.appwrite.models.AttributeEnum] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.updateEnumColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.updateEnumColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateEnumAttribute( @@ -797,15 +867,20 @@ class Databases(client: Client) : Service(client) { * Create a float attribute. Optionally, minimum and maximum values can be provided. * * @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 collectionId Collection ID. * @param key Attribute Key. * @param required Is attribute required? - * @param min Minimum value to enforce on new documents - * @param max Maximum value to enforce on new documents - * @param default Default value for attribute when not provided. Cannot be set when attribute is required. + * @param min Minimum value. + * @param max Maximum value. + * @param default Default value. Cannot be set when required. * @param array Is attribute an array? * @return [io.appwrite.models.AttributeFloat] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.createFloatColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.createFloatColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createFloatAttribute( @@ -850,15 +925,20 @@ class Databases(client: Client) : Service(client) { * Update a float 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#databasesCreateCollection). + * @param collectionId Collection ID. * @param key Attribute Key. * @param required Is attribute required? - * @param default Default value for attribute when not provided. Cannot be set when attribute is required. - * @param min Minimum value to enforce on new documents - * @param max Maximum value to enforce on new documents - * @param newKey New attribute key. + * @param default Default value. Cannot be set when required. + * @param min Minimum value. + * @param max Maximum value. + * @param newKey New Attribute Key. * @return [io.appwrite.models.AttributeFloat] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.updateFloatColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.updateFloatColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateFloatAttribute( @@ -903,15 +983,20 @@ class Databases(client: Client) : Service(client) { * Create an integer attribute. Optionally, minimum and maximum values can be provided. * * @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 collectionId Collection ID. * @param key Attribute Key. * @param required Is attribute required? - * @param min Minimum value to enforce on new documents - * @param max Maximum value to enforce on new documents - * @param default Default value for attribute when not provided. Cannot be set when attribute is required. + * @param min Minimum value + * @param max Maximum value + * @param default Default value. Cannot be set when attribute is required. * @param array Is attribute an array? * @return [io.appwrite.models.AttributeInteger] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.createIntegerColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.createIntegerColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createIntegerAttribute( @@ -956,15 +1041,20 @@ class Databases(client: Client) : Service(client) { * Update an integer 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#databasesCreateCollection). + * @param collectionId Collection ID. * @param key Attribute Key. * @param required Is attribute required? - * @param default Default value for attribute when not provided. Cannot be set when attribute is required. - * @param min Minimum value to enforce on new documents - * @param max Maximum value to enforce on new documents - * @param newKey New attribute key. + * @param default Default value. Cannot be set when attribute is required. + * @param min Minimum value + * @param max Maximum value + * @param newKey New Attribute Key. * @return [io.appwrite.models.AttributeInteger] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.updateIntegerColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.updateIntegerColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateIntegerAttribute( @@ -1009,13 +1099,18 @@ class Databases(client: Client) : Service(client) { * Create IP address 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 collectionId Collection ID. * @param key Attribute Key. * @param required Is attribute required? - * @param default Default value for attribute when not provided. Cannot be set when attribute is required. + * @param default Default value. Cannot be set when attribute is required. * @param array Is attribute an array? * @return [io.appwrite.models.AttributeIp] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.createIpColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.createIpColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createIpAttribute( @@ -1056,13 +1151,18 @@ class Databases(client: Client) : Service(client) { * Update an ip 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#databasesCreateCollection). + * @param collectionId Collection ID. * @param key Attribute Key. * @param required Is attribute required? - * @param default Default value for attribute when not provided. Cannot be set when attribute is required. - * @param newKey New attribute key. + * @param default Default value. Cannot be set when attribute is required. + * @param newKey New Attribute Key. * @return [io.appwrite.models.AttributeIp] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.updateIpColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.updateIpColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateIpAttribute( @@ -1103,8 +1203,8 @@ class Databases(client: Client) : Service(client) { * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). * * @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 relatedCollectionId Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param collectionId Collection ID. + * @param relatedCollectionId Related Collection ID. * @param type Relation type * @param twoWay Is Two Way? * @param key Attribute Key. @@ -1112,6 +1212,11 @@ class Databases(client: Client) : Service(client) { * @param onDelete Constraints option * @return [io.appwrite.models.AttributeRelationship] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.createRelationshipColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.createRelationshipColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createRelationshipAttribute( @@ -1156,7 +1261,7 @@ class Databases(client: Client) : Service(client) { * Create a string 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 collectionId Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param key Attribute Key. * @param size Attribute size for text attributes, in number of characters. * @param required Is attribute required? @@ -1165,6 +1270,11 @@ class Databases(client: Client) : Service(client) { * @param encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. * @return [io.appwrite.models.AttributeString] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.createStringColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.createStringColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createStringAttribute( @@ -1209,14 +1319,19 @@ class Databases(client: Client) : Service(client) { * Update a string 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#databasesCreateCollection). + * @param collectionId Collection ID. You can create a new table 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. Cannot be set when attribute is required. * @param size Maximum size of the string attribute. - * @param newKey New attribute key. + * @param newKey New Attribute Key. * @return [io.appwrite.models.AttributeString] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.updateStringColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.updateStringColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateStringAttribute( @@ -1259,13 +1374,18 @@ class Databases(client: Client) : Service(client) { * Create a URL 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 collectionId Collection ID. * @param key Attribute Key. * @param required Is attribute required? * @param default Default value for attribute when not provided. Cannot be set when attribute is required. * @param array Is attribute an array? * @return [io.appwrite.models.AttributeUrl] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.createUrlColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.createUrlColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createUrlAttribute( @@ -1306,13 +1426,18 @@ class Databases(client: Client) : Service(client) { * Update an url 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#databasesCreateCollection). + * @param collectionId Collection ID. * @param key Attribute Key. * @param required Is attribute required? * @param default Default value for attribute when not provided. Cannot be set when attribute is required. - * @param newKey New attribute key. + * @param newKey New Attribute Key. * @return [io.appwrite.models.AttributeUrl] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.updateUrlColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.updateUrlColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateUrlAttribute( @@ -1353,10 +1478,15 @@ class Databases(client: Client) : Service(client) { * Get attribute by ID. * * @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 collectionId Collection ID. * @param key Attribute Key. * @return [Any] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.getColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.getColumn"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun getAttribute( databaseId: String, @@ -1385,10 +1515,15 @@ class Databases(client: Client) : Service(client) { * Deletes an 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 collectionId Collection ID. * @param key Attribute Key. * @return [Any] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.deleteColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.deleteColumn"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun deleteAttribute( databaseId: String, @@ -1418,12 +1553,17 @@ class Databases(client: Client) : Service(client) { * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). * * @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 collectionId Collection ID. * @param key Attribute Key. * @param onDelete Constraints option - * @param newKey New attribute key. + * @param newKey New Attribute Key. * @return [io.appwrite.models.AttributeRelationship] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.updateRelationshipColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.updateRelationshipColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateRelationshipAttribute( @@ -1466,6 +1606,11 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @return [io.appwrite.models.DocumentList] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.listRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.listRows"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun listDocuments( @@ -1504,6 +1649,11 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @return [io.appwrite.models.DocumentList] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.listRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.listRows"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun listDocuments( @@ -1527,6 +1677,11 @@ class Databases(client: Client) : Service(client) { * @param permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). * @return [io.appwrite.models.Document] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.createRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.createRow"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createDocument( @@ -1572,6 +1727,11 @@ class Databases(client: Client) : Service(client) { * @param permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). * @return [io.appwrite.models.Document] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.createRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.createRow"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createDocument( @@ -1597,6 +1757,11 @@ class Databases(client: Client) : Service(client) { * @param documents Array of documents data as JSON objects. * @return [io.appwrite.models.DocumentList] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.createRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.createRow"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun createDocuments( databaseId: String, @@ -1635,6 +1800,11 @@ class Databases(client: Client) : Service(client) { * @param documents Array of documents data as JSON objects. * @return [io.appwrite.models.DocumentList] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.createRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.createRow"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun createDocuments( databaseId: String, @@ -1652,14 +1822,17 @@ class Databases(client: Client) : Service(client) { * * @param databaseId Database ID. * @param collectionId Collection ID. - * @param documents Array of document data as JSON objects. May contain partial documents. * @return [io.appwrite.models.DocumentList] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.upsertRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.upsertRows"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun upsertDocuments( databaseId: String, collectionId: String, - documents: List, nestedType: Class, ): io.appwrite.models.DocumentList { val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents" @@ -1667,7 +1840,6 @@ class Databases(client: Client) : Service(client) { .replace("{collectionId}", collectionId) val apiParams = mutableMapOf( - "documents" to documents, ) val apiHeaders = mutableMapOf( "content-type" to "application/json", @@ -1690,18 +1862,20 @@ class Databases(client: Client) : Service(client) { * * @param databaseId Database ID. * @param collectionId Collection ID. - * @param documents Array of document data as JSON objects. May contain partial documents. * @return [io.appwrite.models.DocumentList] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.upsertRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.upsertRows"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun upsertDocuments( databaseId: String, collectionId: String, - documents: List, ): io.appwrite.models.DocumentList> = upsertDocuments( databaseId, collectionId, - documents, nestedType = classOf(), ) @@ -1714,6 +1888,11 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @return [io.appwrite.models.DocumentList] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.updateRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.updateRows"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateDocuments( @@ -1756,6 +1935,11 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @return [io.appwrite.models.DocumentList] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.updateRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.updateRows"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateDocuments( @@ -1779,6 +1963,11 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @return [io.appwrite.models.DocumentList] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.deleteRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.deleteRows"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun deleteDocuments( @@ -1818,6 +2007,11 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @return [io.appwrite.models.DocumentList] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.deleteRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.deleteRows"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun deleteDocuments( @@ -1840,6 +2034,11 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @return [io.appwrite.models.Document] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.getRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.getRow"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun getDocument( @@ -1881,6 +2080,11 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @return [io.appwrite.models.Document] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.getRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.getRow"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun getDocument( @@ -1902,18 +2106,18 @@ class Databases(client: Client) : Service(client) { * @param databaseId Database ID. * @param collectionId Collection ID. * @param documentId Document ID. - * @param data Document data as JSON object. Include all required attributes of the document to be created or updated. - * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @return [io.appwrite.models.Document] */ - @JvmOverloads + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.upsertRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.upsertRow"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun upsertDocument( databaseId: String, collectionId: String, documentId: String, - data: Any, - permissions: List? = null, nestedType: Class, ): io.appwrite.models.Document { val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" @@ -1922,8 +2126,6 @@ class Databases(client: Client) : Service(client) { .replace("{documentId}", documentId) val apiParams = mutableMapOf( - "data" to data, - "permissions" to permissions, ) val apiHeaders = mutableMapOf( "content-type" to "application/json", @@ -1947,24 +2149,22 @@ class Databases(client: Client) : Service(client) { * @param databaseId Database ID. * @param collectionId Collection ID. * @param documentId Document ID. - * @param data Document data as JSON object. Include all required attributes of the document to be created or updated. - * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @return [io.appwrite.models.Document] */ - @JvmOverloads + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.upsertRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.upsertRow"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun upsertDocument( databaseId: String, collectionId: String, documentId: String, - data: Any, - permissions: List? = null, ): io.appwrite.models.Document> = upsertDocument( databaseId, collectionId, documentId, - data, - permissions, nestedType = classOf(), ) @@ -1978,6 +2178,11 @@ class Databases(client: Client) : Service(client) { * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @return [io.appwrite.models.Document] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.updateRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.updateRow"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateDocument( @@ -2023,6 +2228,11 @@ class Databases(client: Client) : Service(client) { * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @return [io.appwrite.models.Document] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.updateRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.updateRow"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateDocument( @@ -2048,6 +2258,11 @@ class Databases(client: Client) : Service(client) { * @param documentId Document ID. * @return [Any] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.deleteRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.deleteRow"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun deleteDocument( databaseId: String, @@ -2080,10 +2295,15 @@ class Databases(client: Client) : Service(client) { * @param collectionId Collection ID. * @param documentId Document ID. * @param attribute Attribute key. - * @param value Value to decrement the attribute by. The value must be a number. + * @param value Value to increment the attribute by. The value must be a number. * @param min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. * @return [io.appwrite.models.Document] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.decrementRowColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.decrementRowColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun decrementDocumentAttribute( @@ -2128,10 +2348,15 @@ class Databases(client: Client) : Service(client) { * @param collectionId Collection ID. * @param documentId Document ID. * @param attribute Attribute key. - * @param value Value to decrement the attribute by. The value must be a number. + * @param value Value to increment the attribute by. The value must be a number. * @param min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. * @return [io.appwrite.models.Document] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.decrementRowColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.decrementRowColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun decrementDocumentAttribute( @@ -2162,6 +2387,11 @@ class Databases(client: Client) : Service(client) { * @param max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. * @return [io.appwrite.models.Document] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.incrementRowColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.incrementRowColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun incrementDocumentAttribute( @@ -2210,6 +2440,11 @@ class Databases(client: Client) : Service(client) { * @param max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. * @return [io.appwrite.models.Document] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.incrementRowColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.incrementRowColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun incrementDocumentAttribute( @@ -2237,6 +2472,11 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error * @return [io.appwrite.models.IndexList] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.listIndexes` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.listIndexes"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun listIndexes( @@ -2278,6 +2518,11 @@ class Databases(client: Client) : Service(client) { * @param lengths Length of index. Maximum of 100 * @return [io.appwrite.models.Index] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.createIndex` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.createIndex"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createIndex( @@ -2324,6 +2569,11 @@ class Databases(client: Client) : Service(client) { * @param key Index Key. * @return [io.appwrite.models.Index] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.getIndex` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.getIndex"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun getIndex( databaseId: String, @@ -2360,6 +2610,11 @@ class Databases(client: Client) : Service(client) { * @param key Index Key. * @return [Any] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Tables.deleteIndex` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Tables.deleteIndex"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun deleteIndex( databaseId: String, diff --git a/src/main/kotlin/io/appwrite/services/Tables.kt b/src/main/kotlin/io/appwrite/services/Tables.kt new file mode 100644 index 0000000..027b003 --- /dev/null +++ b/src/main/kotlin/io/appwrite/services/Tables.kt @@ -0,0 +1,2201 @@ +package io.appwrite.services + +import io.appwrite.Client +import io.appwrite.models.* +import io.appwrite.enums.* +import io.appwrite.exceptions.AppwriteException +import io.appwrite.extensions.classOf +import okhttp3.Cookie +import java.io.File + +/** + * The Tables service allows you to create structured tables of rows, query and filter lists of rows +**/ +class Tables(client: Client) : Service(client) { + + /** + * Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. + * + * @param databaseId Database ID. + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, rowSecurity + * @param search Search term to filter your list results. Max length: 256 chars. + * @return [io.appwrite.models.TableList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun list( + databaseId: String, + queries: List? = null, + search: String? = null, + ): io.appwrite.models.TableList { + val apiPath = "/databases/{databaseId}/tables" + .replace("{databaseId}", databaseId) + + val apiParams = mutableMapOf( + "queries" to queries, + "search" to search, + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.TableList = { + io.appwrite.models.TableList.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.TableList::class.java, + converter, + ) + } + + /** + * Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + * + * @param databaseId Database ID. + * @param tableId Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param name Table name. Max length: 128 chars. + * @param permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param rowSecurity Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param enabled Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + * @return [io.appwrite.models.Table] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun create( + databaseId: String, + tableId: String, + name: String, + permissions: List? = null, + rowSecurity: Boolean? = null, + enabled: Boolean? = null, + ): io.appwrite.models.Table { + val apiPath = "/databases/{databaseId}/tables" + .replace("{databaseId}", databaseId) + + val apiParams = mutableMapOf( + "tableId" to tableId, + "name" to name, + "permissions" to permissions, + "rowSecurity" to rowSecurity, + "enabled" to enabled, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Table = { + io.appwrite.models.Table.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Table::class.java, + converter, + ) + } + + /** + * Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @return [io.appwrite.models.Table] + */ + @Throws(AppwriteException::class) + suspend fun get( + databaseId: String, + tableId: String, + ): io.appwrite.models.Table { + val apiPath = "/databases/{databaseId}/tables/{tableId}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.Table = { + io.appwrite.models.Table.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Table::class.java, + converter, + ) + } + + /** + * Update a table by its unique ID. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param name Table name. Max length: 128 chars. + * @param permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param rowSecurity Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param enabled Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + * @return [io.appwrite.models.Table] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun update( + databaseId: String, + tableId: String, + name: String, + permissions: List? = null, + rowSecurity: Boolean? = null, + enabled: Boolean? = null, + ): io.appwrite.models.Table { + val apiPath = "/databases/{databaseId}/tables/{tableId}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "name" to name, + "permissions" to permissions, + "rowSecurity" to rowSecurity, + "enabled" to enabled, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Table = { + io.appwrite.models.Table.from(map = it as Map) + } + return client.call( + "PUT", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Table::class.java, + converter, + ) + } + + /** + * Delete a table by its unique ID. Only users with write permissions have access to delete this resource. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @return [Any] + */ + @Throws(AppwriteException::class) + suspend fun delete( + databaseId: String, + tableId: String, + ): Any { + val apiPath = "/databases/{databaseId}/tables/{tableId}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + + /** + * List attributes in the collection. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error + * @return [io.appwrite.models.ColumnList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun listColumns( + databaseId: String, + tableId: String, + queries: List? = null, + ): io.appwrite.models.ColumnList { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "queries" to queries, + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.ColumnList = { + io.appwrite.models.ColumnList.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnList::class.java, + converter, + ) + } + + /** + * Create a boolean column. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + * @param key Column Key. + * @param required Is column required? + * @param default Default value for column when not provided. Cannot be set when column is required. + * @param array Is column an array? + * @return [io.appwrite.models.ColumnBoolean] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createBooleanColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: Boolean? = null, + array: Boolean? = null, + ): io.appwrite.models.ColumnBoolean { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/boolean" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "key" to key, + "required" to required, + "default" to default, + "array" to array, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnBoolean = { + io.appwrite.models.ColumnBoolean.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnBoolean::class.java, + converter, + ) + } + + /** + * Update a boolean 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 Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + * @param key Column Key. + * @param required Is column required? + * @param default Default value for column when not provided. Cannot be set when column is required. + * @param newKey New Column Key. + * @return [io.appwrite.models.ColumnBoolean] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateBooleanColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: Boolean? = null, + newKey: String? = null, + ): io.appwrite.models.ColumnBoolean { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/boolean/{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.ColumnBoolean = { + io.appwrite.models.ColumnBoolean.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnBoolean::class.java, + converter, + ) + } + + /** + * Create a date time column according to the ISO 8601 standard. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @param required Is column required? + * @param default Default value for the column in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when column is required. + * @param array Is column an array? + * @return [io.appwrite.models.ColumnDatetime] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createDatetimeColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: String? = null, + array: Boolean? = null, + ): io.appwrite.models.ColumnDatetime { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/datetime" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "key" to key, + "required" to required, + "default" to default, + "array" to array, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnDatetime = { + io.appwrite.models.ColumnDatetime.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnDatetime::class.java, + converter, + ) + } + + /** + * Update a date time column. Changing the `default` value will not update already existing rows. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @param required Is column required? + * @param default Default value for column when not provided. Cannot be set when column is required. + * @param newKey New Column Key. + * @return [io.appwrite.models.ColumnDatetime] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateDatetimeColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: String? = null, + newKey: String? = null, + ): io.appwrite.models.ColumnDatetime { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/datetime/{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.ColumnDatetime = { + io.appwrite.models.ColumnDatetime.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnDatetime::class.java, + converter, + ) + } + + /** + * Create an email column. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @param required Is column required? + * @param default Default value for column when not provided. Cannot be set when column is required. + * @param array Is column an array? + * @return [io.appwrite.models.ColumnEmail] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createEmailColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: String? = null, + array: Boolean? = null, + ): io.appwrite.models.ColumnEmail { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/email" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "key" to key, + "required" to required, + "default" to default, + "array" to array, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnEmail = { + io.appwrite.models.ColumnEmail.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnEmail::class.java, + converter, + ) + } + + /** + * Update an email column. Changing the `default` value will not update already existing rows. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @param required Is column required? + * @param default Default value for column when not provided. Cannot be set when column is required. + * @param newKey New Column Key. + * @return [io.appwrite.models.ColumnEmail] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateEmailColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: String? = null, + newKey: String? = null, + ): io.appwrite.models.ColumnEmail { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/email/{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.ColumnEmail = { + io.appwrite.models.ColumnEmail.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnEmail::class.java, + converter, + ) + } + + /** + * Create an enumeration column. The `elements` param acts as a white-list of accepted values for this column. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @param elements Array of enum values. + * @param required Is column required? + * @param default Default value for column when not provided. Cannot be set when column is required. + * @param array Is column an array? + * @return [io.appwrite.models.ColumnEnum] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createEnumColumn( + databaseId: String, + tableId: String, + key: String, + elements: List, + required: Boolean, + default: String? = null, + array: Boolean? = null, + ): io.appwrite.models.ColumnEnum { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/enum" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "key" to key, + "elements" to elements, + "required" to required, + "default" to default, + "array" to array, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnEnum = { + io.appwrite.models.ColumnEnum.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnEnum::class.java, + converter, + ) + } + + /** + * Update an enum column. Changing the `default` value will not update already existing rows. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @param elements Updated list of enum values. + * @param required Is column required? + * @param default Default value for column when not provided. Cannot be set when column is required. + * @param newKey New Column Key. + * @return [io.appwrite.models.ColumnEnum] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateEnumColumn( + databaseId: String, + tableId: String, + key: String, + elements: List, + required: Boolean, + default: String? = null, + newKey: String? = null, + ): io.appwrite.models.ColumnEnum { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/enum/{key}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{key}", key) + + val apiParams = mutableMapOf( + "elements" to elements, + "required" to required, + "default" to default, + "newKey" to newKey, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnEnum = { + io.appwrite.models.ColumnEnum.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnEnum::class.java, + converter, + ) + } + + /** + * Create a float column. Optionally, minimum and maximum values can be provided. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @param required Is column required? + * @param min Minimum value + * @param max Maximum value + * @param default Default value. Cannot be set when required. + * @param array Is column an array? + * @return [io.appwrite.models.ColumnFloat] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createFloatColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + min: Double? = null, + max: Double? = null, + default: Double? = null, + array: Boolean? = null, + ): io.appwrite.models.ColumnFloat { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/float" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "key" to key, + "required" to required, + "min" to min, + "max" to max, + "default" to default, + "array" to array, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnFloat = { + io.appwrite.models.ColumnFloat.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnFloat::class.java, + converter, + ) + } + + /** + * Update a float column. Changing the `default` value will not update already existing rows. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @param required Is column required? + * @param default Default value. Cannot be set when required. + * @param min Minimum value + * @param max Maximum value + * @param newKey New Column Key. + * @return [io.appwrite.models.ColumnFloat] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateFloatColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: Double? = null, + min: Double? = null, + max: Double? = null, + newKey: String? = null, + ): io.appwrite.models.ColumnFloat { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/float/{key}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{key}", key) + + val apiParams = mutableMapOf( + "required" to required, + "min" to min, + "max" to max, + "default" to default, + "newKey" to newKey, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnFloat = { + io.appwrite.models.ColumnFloat.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnFloat::class.java, + converter, + ) + } + + /** + * Create an integer column. Optionally, minimum and maximum values can be provided. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @param required Is column required? + * @param min Minimum value + * @param max Maximum value + * @param default Default value. Cannot be set when column is required. + * @param array Is column an array? + * @return [io.appwrite.models.ColumnInteger] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createIntegerColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + min: Long? = null, + max: Long? = null, + default: Long? = null, + array: Boolean? = null, + ): io.appwrite.models.ColumnInteger { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/integer" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "key" to key, + "required" to required, + "min" to min, + "max" to max, + "default" to default, + "array" to array, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnInteger = { + io.appwrite.models.ColumnInteger.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnInteger::class.java, + converter, + ) + } + + /** + * Update an integer column. Changing the `default` value will not update already existing rows. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @param required Is column required? + * @param default Default value. Cannot be set when column is required. + * @param min Minimum value + * @param max Maximum value + * @param newKey New Column Key. + * @return [io.appwrite.models.ColumnInteger] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateIntegerColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: Long? = null, + min: Long? = null, + max: Long? = null, + newKey: String? = null, + ): io.appwrite.models.ColumnInteger { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/integer/{key}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{key}", key) + + val apiParams = mutableMapOf( + "required" to required, + "min" to min, + "max" to max, + "default" to default, + "newKey" to newKey, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnInteger = { + io.appwrite.models.ColumnInteger.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnInteger::class.java, + converter, + ) + } + + /** + * Create IP address column. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @param required Is column required? + * @param default Default value. Cannot be set when column is required. + * @param array Is column an array? + * @return [io.appwrite.models.ColumnIp] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createIpColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: String? = null, + array: Boolean? = null, + ): io.appwrite.models.ColumnIp { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/ip" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "key" to key, + "required" to required, + "default" to default, + "array" to array, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnIp = { + io.appwrite.models.ColumnIp.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnIp::class.java, + converter, + ) + } + + /** + * Update an ip column. Changing the `default` value will not update already existing rows. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @param required Is column required? + * @param default Default value. Cannot be set when column is required. + * @param newKey New Column Key. + * @return [io.appwrite.models.ColumnIp] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateIpColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: String? = null, + newKey: String? = null, + ): io.appwrite.models.ColumnIp { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/ip/{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.ColumnIp = { + io.appwrite.models.ColumnIp.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnIp::class.java, + converter, + ) + } + + /** + * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param relatedTableId Related Table ID. + * @param type Relation type + * @param twoWay Is Two Way? + * @param key Column Key. + * @param twoWayKey Two Way Column Key. + * @param onDelete Constraints option + * @return [io.appwrite.models.ColumnRelationship] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createRelationshipColumn( + databaseId: String, + tableId: String, + relatedTableId: String, + type: io.appwrite.enums.RelationshipType, + twoWay: Boolean? = null, + key: String? = null, + twoWayKey: String? = null, + onDelete: io.appwrite.enums.RelationMutate? = null, + ): io.appwrite.models.ColumnRelationship { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/relationship" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "relatedTableId" to relatedTableId, + "type" to type, + "twoWay" to twoWay, + "key" to key, + "twoWayKey" to twoWayKey, + "onDelete" to onDelete, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnRelationship = { + io.appwrite.models.ColumnRelationship.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnRelationship::class.java, + converter, + ) + } + + /** + * Create a string column. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + * @param key Column Key. + * @param size Attribute size for text attributes, in number of characters. + * @param required Is column required? + * @param default Default value for column when not provided. Cannot be set when column is required. + * @param array Is column an array? + * @param encrypt Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @return [io.appwrite.models.ColumnString] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createStringColumn( + databaseId: String, + tableId: String, + key: String, + size: Long, + required: Boolean, + default: String? = null, + array: Boolean? = null, + encrypt: Boolean? = null, + ): io.appwrite.models.ColumnString { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/string" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "key" to key, + "size" to size, + "required" to required, + "default" to default, + "array" to array, + "encrypt" to encrypt, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnString = { + io.appwrite.models.ColumnString.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnString::class.java, + converter, + ) + } + + /** + * Update a string 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 Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + * @param key Column Key. + * @param required Is column required? + * @param default Default value for column when not provided. Cannot be set when column is required. + * @param size Maximum size of the string column. + * @param newKey New Column Key. + * @return [io.appwrite.models.ColumnString] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateStringColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: String? = null, + size: Long? = null, + newKey: String? = null, + ): io.appwrite.models.ColumnString { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/string/{key}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{key}", key) + + val apiParams = mutableMapOf( + "required" to required, + "default" to default, + "size" to size, + "newKey" to newKey, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnString = { + io.appwrite.models.ColumnString.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnString::class.java, + converter, + ) + } + + /** + * Create a URL column. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @param required Is column required? + * @param default Default value for column when not provided. Cannot be set when column is required. + * @param array Is column an array? + * @return [io.appwrite.models.ColumnUrl] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createUrlColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: String? = null, + array: Boolean? = null, + ): io.appwrite.models.ColumnUrl { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/url" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "key" to key, + "required" to required, + "default" to default, + "array" to array, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnUrl = { + io.appwrite.models.ColumnUrl.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnUrl::class.java, + converter, + ) + } + + /** + * Update an url column. Changing the `default` value will not update already existing rows. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @param required Is column required? + * @param default Default value for column when not provided. Cannot be set when column is required. + * @param newKey New Column Key. + * @return [io.appwrite.models.ColumnUrl] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateUrlColumn( + databaseId: String, + tableId: String, + key: String, + required: Boolean, + default: String? = null, + newKey: String? = null, + ): io.appwrite.models.ColumnUrl { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/url/{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.ColumnUrl = { + io.appwrite.models.ColumnUrl.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnUrl::class.java, + converter, + ) + } + + /** + * Get column by ID. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @return [Any] + */ + @Throws(AppwriteException::class) + suspend fun getColumn( + databaseId: String, + tableId: String, + key: String, + ): Any { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/{key}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{key}", key) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + ) + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + + /** + * Deletes a column. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @return [Any] + */ + @Throws(AppwriteException::class) + suspend fun deleteColumn( + databaseId: String, + tableId: String, + key: String, + ): Any { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/{key}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{key}", key) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + + /** + * Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param key Column Key. + * @param onDelete Constraints option + * @param newKey New Column Key. + * @return [io.appwrite.models.ColumnRelationship] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateRelationshipColumn( + databaseId: String, + tableId: String, + key: String, + onDelete: io.appwrite.enums.RelationMutate? = null, + newKey: String? = null, + ): io.appwrite.models.ColumnRelationship { + val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/{key}/relationship" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{key}", key) + + val apiParams = mutableMapOf( + "onDelete" to onDelete, + "newKey" to newKey, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnRelationship = { + io.appwrite.models.ColumnRelationship.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnRelationship::class.java, + converter, + ) + } + + /** + * List indexes in the collection. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error + * @return [io.appwrite.models.ColumnIndexList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun listIndexes( + databaseId: String, + tableId: String, + queries: List? = null, + ): io.appwrite.models.ColumnIndexList { + val apiPath = "/databases/{databaseId}/tables/{tableId}/indexes" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "queries" to queries, + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.ColumnIndexList = { + io.appwrite.models.ColumnIndexList.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnIndexList::class.java, + converter, + ) + } + + /** + * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request.Attributes can be `key`, `fulltext`, and `unique`. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + * @param key Index Key. + * @param type Index type. + * @param columns Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long. + * @param orders Array of index orders. Maximum of 100 orders are allowed. + * @param lengths Length of index. Maximum of 100 + * @return [io.appwrite.models.ColumnIndex] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createIndex( + databaseId: String, + tableId: String, + key: String, + type: io.appwrite.enums.IndexType, + columns: List, + orders: List? = null, + lengths: List? = null, + ): io.appwrite.models.ColumnIndex { + val apiPath = "/databases/{databaseId}/tables/{tableId}/indexes" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "key" to key, + "type" to type, + "columns" to columns, + "orders" to orders, + "lengths" to lengths, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ColumnIndex = { + io.appwrite.models.ColumnIndex.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnIndex::class.java, + converter, + ) + } + + /** + * Get index by ID. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + * @param key Index Key. + * @return [io.appwrite.models.ColumnIndex] + */ + @Throws(AppwriteException::class) + suspend fun getIndex( + databaseId: String, + tableId: String, + key: String, + ): io.appwrite.models.ColumnIndex { + val apiPath = "/databases/{databaseId}/tables/{tableId}/indexes/{key}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{key}", key) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.ColumnIndex = { + io.appwrite.models.ColumnIndex.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ColumnIndex::class.java, + converter, + ) + } + + /** + * Delete an index. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + * @param key Index Key. + * @return [Any] + */ + @Throws(AppwriteException::class) + suspend fun deleteIndex( + databaseId: String, + tableId: String, + key: String, + ): Any { + val apiPath = "/databases/{databaseId}/tables/{tableId}/indexes/{key}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{key}", key) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + + /** + * Get a list of all the user's rows in a given table. You can use the query params to filter your results. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @return [io.appwrite.models.RowList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun listRows( + databaseId: String, + tableId: String, + queries: List? = null, + nestedType: Class, + ): io.appwrite.models.RowList { + val apiPath = "/databases/{databaseId}/tables/{tableId}/rows" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "queries" to queries, + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.RowList = { + io.appwrite.models.RowList.from(map = it as Map, nestedType) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Get a list of all the user's rows in a given table. You can use the query params to filter your results. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @return [io.appwrite.models.RowList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun listRows( + databaseId: String, + tableId: String, + queries: List? = null, + ): io.appwrite.models.RowList> = listRows( + databaseId, + tableId, + queries, + nestedType = classOf(), + ) + + /** + * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows. + * @param rowId Row ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param data Row data as JSON object. + * @param permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @return [io.appwrite.models.Row] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createRow( + databaseId: String, + tableId: String, + rowId: String, + data: Any, + permissions: List? = null, + nestedType: Class, + ): io.appwrite.models.Row { + val apiPath = "/databases/{databaseId}/tables/{tableId}/rows" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "rowId" to rowId, + "data" to data, + "permissions" to permissions, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Row = { + io.appwrite.models.Row.from(map = it as Map, nestedType) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows. + * @param rowId Row ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param data Row data as JSON object. + * @param permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @return [io.appwrite.models.Row] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createRow( + databaseId: String, + tableId: String, + rowId: String, + data: Any, + permissions: List? = null, + ): io.appwrite.models.Row> = createRow( + databaseId, + tableId, + rowId, + data, + permissions, + nestedType = classOf(), + ) + + /** + * Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows. + * @param rows Array of documents data as JSON objects. + * @return [io.appwrite.models.RowList] + */ + @Throws(AppwriteException::class) + suspend fun createRows( + databaseId: String, + tableId: String, + rows: List, + nestedType: Class, + ): io.appwrite.models.RowList { + val apiPath = "/databases/{databaseId}/tables/{tableId}/rows" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "rows" to rows, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.RowList = { + io.appwrite.models.RowList.from(map = it as Map, nestedType) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows. + * @param rows Array of documents data as JSON objects. + * @return [io.appwrite.models.RowList] + */ + @Throws(AppwriteException::class) + suspend fun createRows( + databaseId: String, + tableId: String, + rows: List, + ): io.appwrite.models.RowList> = createRows( + databaseId, + tableId, + rows, + nestedType = classOf(), + ) + + /** + * Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @return [io.appwrite.models.RowList] + */ + @Throws(AppwriteException::class) + suspend fun upsertRows( + databaseId: String, + tableId: String, + nestedType: Class, + ): io.appwrite.models.RowList { + val apiPath = "/databases/{databaseId}/tables/{tableId}/rows" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.RowList = { + io.appwrite.models.RowList.from(map = it as Map, nestedType) + } + return client.call( + "PUT", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @return [io.appwrite.models.RowList] + */ + @Throws(AppwriteException::class) + suspend fun upsertRows( + databaseId: String, + tableId: String, + ): io.appwrite.models.RowList> = upsertRows( + databaseId, + tableId, + nestedType = classOf(), + ) + + /** + * Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param data Row data as JSON object. Include only column and value pairs to be updated. + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @return [io.appwrite.models.RowList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateRows( + databaseId: String, + tableId: String, + data: Any? = null, + queries: List? = null, + nestedType: Class, + ): io.appwrite.models.RowList { + val apiPath = "/databases/{databaseId}/tables/{tableId}/rows" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "data" to data, + "queries" to queries, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.RowList = { + io.appwrite.models.RowList.from(map = it as Map, nestedType) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param data Row data as JSON object. Include only column and value pairs to be updated. + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @return [io.appwrite.models.RowList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateRows( + databaseId: String, + tableId: String, + data: Any? = null, + queries: List? = null, + ): io.appwrite.models.RowList> = updateRows( + databaseId, + tableId, + data, + queries, + nestedType = classOf(), + ) + + /** + * Bulk delete rows using queries, if no queries are passed then all rows are deleted. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @return [io.appwrite.models.RowList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun deleteRows( + databaseId: String, + tableId: String, + queries: List? = null, + nestedType: Class, + ): io.appwrite.models.RowList { + val apiPath = "/databases/{databaseId}/tables/{tableId}/rows" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + + val apiParams = mutableMapOf( + "queries" to queries, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.RowList = { + io.appwrite.models.RowList.from(map = it as Map, nestedType) + } + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Bulk delete rows using queries, if no queries are passed then all rows are deleted. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @return [io.appwrite.models.RowList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun deleteRows( + databaseId: String, + tableId: String, + queries: List? = null, + ): io.appwrite.models.RowList> = deleteRows( + databaseId, + tableId, + queries, + nestedType = classOf(), + ) + + /** + * Get a row by its unique ID. This endpoint response returns a JSON object with the row data. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + * @param rowId Row ID. + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @return [io.appwrite.models.Row] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun getRow( + databaseId: String, + tableId: String, + rowId: String, + queries: List? = null, + nestedType: Class, + ): io.appwrite.models.Row { + val apiPath = "/databases/{databaseId}/tables/{tableId}/rows/{rowId}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{rowId}", rowId) + + val apiParams = mutableMapOf( + "queries" to queries, + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.Row = { + io.appwrite.models.Row.from(map = it as Map, nestedType) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Get a row by its unique ID. This endpoint response returns a JSON object with the row data. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + * @param rowId Row ID. + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @return [io.appwrite.models.Row] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun getRow( + databaseId: String, + tableId: String, + rowId: String, + queries: List? = null, + ): io.appwrite.models.Row> = getRow( + databaseId, + tableId, + rowId, + queries, + nestedType = classOf(), + ) + + /** + * Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param rowId Row ID. + * @return [io.appwrite.models.Row] + */ + @Throws(AppwriteException::class) + suspend fun upsertRow( + databaseId: String, + tableId: String, + rowId: String, + nestedType: Class, + ): io.appwrite.models.Row { + val apiPath = "/databases/{databaseId}/tables/{tableId}/rows/{rowId}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{rowId}", rowId) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Row = { + io.appwrite.models.Row.from(map = it as Map, nestedType) + } + return client.call( + "PUT", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param rowId Row ID. + * @return [io.appwrite.models.Row] + */ + @Throws(AppwriteException::class) + suspend fun upsertRow( + databaseId: String, + tableId: String, + rowId: String, + ): io.appwrite.models.Row> = upsertRow( + databaseId, + tableId, + rowId, + nestedType = classOf(), + ) + + /** + * Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param rowId Row ID. + * @param data Row data as JSON object. Include only columns and value pairs to be updated. + * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @return [io.appwrite.models.Row] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateRow( + databaseId: String, + tableId: String, + rowId: String, + data: Any? = null, + permissions: List? = null, + nestedType: Class, + ): io.appwrite.models.Row { + val apiPath = "/databases/{databaseId}/tables/{tableId}/rows/{rowId}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{rowId}", rowId) + + val apiParams = mutableMapOf( + "data" to data, + "permissions" to permissions, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Row = { + io.appwrite.models.Row.from(map = it as Map, nestedType) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param rowId Row ID. + * @param data Row data as JSON object. Include only columns and value pairs to be updated. + * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @return [io.appwrite.models.Row] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateRow( + databaseId: String, + tableId: String, + rowId: String, + data: Any? = null, + permissions: List? = null, + ): io.appwrite.models.Row> = updateRow( + databaseId, + tableId, + rowId, + data, + permissions, + nestedType = classOf(), + ) + + /** + * Delete a row by its unique ID. + * + * @param databaseId Database ID. + * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + * @param rowId Row ID. + * @return [Any] + */ + @Throws(AppwriteException::class) + suspend fun deleteRow( + databaseId: String, + tableId: String, + rowId: String, + ): Any { + val apiPath = "/databases/{databaseId}/tables/{tableId}/rows/{rowId}" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{rowId}", rowId) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + + /** + * Decrement a specific column of a row by a given value. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param rowId Row ID. + * @param column Column key. + * @param value Value to increment the column by. The value must be a number. + * @param min Minimum value for the column. If the current value is lesser than this value, an exception will be thrown. + * @return [io.appwrite.models.Row] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun decrementRowColumn( + databaseId: String, + tableId: String, + rowId: String, + column: String, + value: Double? = null, + min: Double? = null, + nestedType: Class, + ): io.appwrite.models.Row { + val apiPath = "/databases/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{rowId}", rowId) + .replace("{column}", column) + + val apiParams = mutableMapOf( + "value" to value, + "min" to min, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Row = { + io.appwrite.models.Row.from(map = it as Map, nestedType) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Decrement a specific column of a row by a given value. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param rowId Row ID. + * @param column Column key. + * @param value Value to increment the column by. The value must be a number. + * @param min Minimum value for the column. If the current value is lesser than this value, an exception will be thrown. + * @return [io.appwrite.models.Row] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun decrementRowColumn( + databaseId: String, + tableId: String, + rowId: String, + column: String, + value: Double? = null, + min: Double? = null, + ): io.appwrite.models.Row> = decrementRowColumn( + databaseId, + tableId, + rowId, + column, + value, + min, + nestedType = classOf(), + ) + + /** + * Increment a specific column of a row by a given value. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param rowId Row ID. + * @param column Column key. + * @param value Value to increment the column by. The value must be a number. + * @param max Maximum value for the column. If the current value is greater than this value, an error will be thrown. + * @return [io.appwrite.models.Row] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun incrementRowColumn( + databaseId: String, + tableId: String, + rowId: String, + column: String, + value: Double? = null, + max: Double? = null, + nestedType: Class, + ): io.appwrite.models.Row { + val apiPath = "/databases/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment" + .replace("{databaseId}", databaseId) + .replace("{tableId}", tableId) + .replace("{rowId}", rowId) + .replace("{column}", column) + + val apiParams = mutableMapOf( + "value" to value, + "max" to max, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Row = { + io.appwrite.models.Row.from(map = it as Map, nestedType) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Increment a specific column of a row by a given value. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param rowId Row ID. + * @param column Column key. + * @param value Value to increment the column by. The value must be a number. + * @param max Maximum value for the column. If the current value is greater than this value, an error will be thrown. + * @return [io.appwrite.models.Row] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun incrementRowColumn( + databaseId: String, + tableId: String, + rowId: String, + column: String, + value: Double? = null, + max: Double? = null, + ): io.appwrite.models.Row> = incrementRowColumn( + databaseId, + tableId, + rowId, + column, + value, + max, + nestedType = classOf(), + ) + +} \ No newline at end of file From f6bcf984f3b94dab1ab9973306419bc2fd2bcf7a Mon Sep 17 00:00:00 2001 From: root Date: Thu, 24 Jul 2025 06:44:40 +0000 Subject: [PATCH 3/5] chore: regen to 1.7.x --- README.md | 8 +- .../java/databases/create-document.md | 5 +- .../java/databases/create-documents.md | 2 +- .../java/databases/upsert-document.md | 7 +- .../java/databases/upsert-documents.md | 3 +- .../java/tables/create-boolean-column.md | 28 - .../java/tables/create-datetime-column.md | 28 - .../java/tables/create-email-column.md | 28 - .../java/tables/create-enum-column.md | 29 - .../java/tables/create-float-column.md | 30 - docs/examples/java/tables/create-index.md | 30 - .../java/tables/create-integer-column.md | 30 - docs/examples/java/tables/create-ip-column.md | 28 - .../java/tables/create-relationship-column.md | 31 - docs/examples/java/tables/create-row.md | 28 - docs/examples/java/tables/create-rows.md | 25 - .../java/tables/create-string-column.md | 30 - .../examples/java/tables/create-url-column.md | 28 - docs/examples/java/tables/create.md | 28 - .../java/tables/decrement-row-column.md | 28 - docs/examples/java/tables/delete-column.md | 25 - docs/examples/java/tables/delete-index.md | 25 - docs/examples/java/tables/delete-row.md | 25 - docs/examples/java/tables/delete-rows.md | 25 - docs/examples/java/tables/delete.md | 24 - docs/examples/java/tables/get-column.md | 25 - docs/examples/java/tables/get-index.md | 25 - docs/examples/java/tables/get-row.md | 26 - docs/examples/java/tables/get.md | 24 - .../java/tables/increment-row-column.md | 28 - docs/examples/java/tables/list-columns.md | 25 - docs/examples/java/tables/list-indexes.md | 25 - docs/examples/java/tables/list-rows.md | 25 - docs/examples/java/tables/list.md | 25 - .../java/tables/update-boolean-column.md | 28 - .../java/tables/update-datetime-column.md | 28 - .../java/tables/update-email-column.md | 28 - .../java/tables/update-enum-column.md | 29 - .../java/tables/update-float-column.md | 30 - .../java/tables/update-integer-column.md | 30 - docs/examples/java/tables/update-ip-column.md | 28 - .../java/tables/update-relationship-column.md | 27 - docs/examples/java/tables/update-row.md | 27 - docs/examples/java/tables/update-rows.md | 26 - .../java/tables/update-string-column.md | 29 - .../examples/java/tables/update-url-column.md | 28 - docs/examples/java/tables/update.md | 28 - docs/examples/java/tables/upsert-row.md | 26 - docs/examples/java/tables/upsert-rows.md | 24 - .../kotlin/databases/create-document.md | 3 +- .../kotlin/databases/create-documents.md | 2 +- .../kotlin/databases/upsert-document.md | 7 +- .../kotlin/databases/upsert-documents.md | 5 +- .../kotlin/tables/create-boolean-column.md | 19 - .../kotlin/tables/create-datetime-column.md | 19 - .../kotlin/tables/create-email-column.md | 19 - .../kotlin/tables/create-enum-column.md | 20 - .../kotlin/tables/create-float-column.md | 21 - docs/examples/kotlin/tables/create-index.md | 21 - .../kotlin/tables/create-integer-column.md | 21 - .../kotlin/tables/create-ip-column.md | 19 - .../tables/create-relationship-column.md | 22 - docs/examples/kotlin/tables/create-row.md | 19 - docs/examples/kotlin/tables/create-rows.md | 16 - .../kotlin/tables/create-string-column.md | 21 - .../kotlin/tables/create-url-column.md | 19 - docs/examples/kotlin/tables/create.md | 19 - .../kotlin/tables/decrement-row-column.md | 19 - docs/examples/kotlin/tables/delete-column.md | 16 - docs/examples/kotlin/tables/delete-index.md | 16 - docs/examples/kotlin/tables/delete-row.md | 16 - docs/examples/kotlin/tables/delete-rows.md | 16 - docs/examples/kotlin/tables/delete.md | 15 - docs/examples/kotlin/tables/get-column.md | 16 - docs/examples/kotlin/tables/get-index.md | 16 - docs/examples/kotlin/tables/get-row.md | 17 - docs/examples/kotlin/tables/get.md | 15 - .../kotlin/tables/increment-row-column.md | 19 - docs/examples/kotlin/tables/list-columns.md | 16 - docs/examples/kotlin/tables/list-indexes.md | 16 - docs/examples/kotlin/tables/list-rows.md | 16 - docs/examples/kotlin/tables/list.md | 16 - .../kotlin/tables/update-boolean-column.md | 19 - .../kotlin/tables/update-datetime-column.md | 19 - .../kotlin/tables/update-email-column.md | 19 - .../kotlin/tables/update-enum-column.md | 20 - .../kotlin/tables/update-float-column.md | 21 - .../kotlin/tables/update-integer-column.md | 21 - .../kotlin/tables/update-ip-column.md | 19 - .../tables/update-relationship-column.md | 18 - docs/examples/kotlin/tables/update-row.md | 18 - docs/examples/kotlin/tables/update-rows.md | 17 - .../kotlin/tables/update-string-column.md | 20 - .../kotlin/tables/update-url-column.md | 19 - docs/examples/kotlin/tables/update.md | 19 - docs/examples/kotlin/tables/upsert-row.md | 17 - docs/examples/kotlin/tables/upsert-rows.md | 15 - src/main/kotlin/io/appwrite/Client.kt | 6 +- .../kotlin/io/appwrite/models/BucketList.kt | 2 +- .../io/appwrite/models/CollectionList.kt | 2 +- .../io/appwrite/models/ColumnBoolean.kt | 94 - .../io/appwrite/models/ColumnDatetime.kt | 102 - .../kotlin/io/appwrite/models/ColumnEmail.kt | 102 - .../kotlin/io/appwrite/models/ColumnEnum.kt | 110 - .../kotlin/io/appwrite/models/ColumnFloat.kt | 110 - .../kotlin/io/appwrite/models/ColumnIndex.kt | 94 - .../io/appwrite/models/ColumnIndexList.kt | 38 - .../io/appwrite/models/ColumnInteger.kt | 110 - .../kotlin/io/appwrite/models/ColumnIp.kt | 102 - .../kotlin/io/appwrite/models/ColumnList.kt | 38 - .../io/appwrite/models/ColumnRelationship.kt | 134 - .../kotlin/io/appwrite/models/ColumnString.kt | 110 - .../kotlin/io/appwrite/models/ColumnUrl.kt | 102 - .../io/appwrite/models/ContinentList.kt | 2 +- .../kotlin/io/appwrite/models/CountryList.kt | 2 +- .../kotlin/io/appwrite/models/CurrencyList.kt | 2 +- .../kotlin/io/appwrite/models/DatabaseList.kt | 2 +- .../io/appwrite/models/DeploymentList.kt | 2 +- .../kotlin/io/appwrite/models/DocumentList.kt | 2 +- .../io/appwrite/models/ExecutionList.kt | 2 +- .../kotlin/io/appwrite/models/FileList.kt | 2 +- .../io/appwrite/models/FrameworkList.kt | 2 +- .../kotlin/io/appwrite/models/FunctionList.kt | 2 +- .../kotlin/io/appwrite/models/IdentityList.kt | 2 +- .../kotlin/io/appwrite/models/IndexList.kt | 2 +- .../kotlin/io/appwrite/models/LanguageList.kt | 2 +- .../io/appwrite/models/LocaleCodeList.kt | 2 +- src/main/kotlin/io/appwrite/models/LogList.kt | 2 +- .../io/appwrite/models/MembershipList.kt | 2 +- .../kotlin/io/appwrite/models/MessageList.kt | 2 +- .../kotlin/io/appwrite/models/PhoneList.kt | 2 +- .../kotlin/io/appwrite/models/ProviderList.kt | 2 +- .../io/appwrite/models/ResourceTokenList.kt | 2 +- src/main/kotlin/io/appwrite/models/Row.kt | 105 - src/main/kotlin/io/appwrite/models/RowList.kt | 46 - .../kotlin/io/appwrite/models/RuntimeList.kt | 2 +- .../kotlin/io/appwrite/models/SessionList.kt | 2 +- .../kotlin/io/appwrite/models/SiteList.kt | 2 +- .../io/appwrite/models/SpecificationList.kt | 2 +- .../io/appwrite/models/SubscriberList.kt | 2 +- src/main/kotlin/io/appwrite/models/Table.kt | 102 - .../kotlin/io/appwrite/models/TableList.kt | 38 - .../kotlin/io/appwrite/models/TargetList.kt | 2 +- .../kotlin/io/appwrite/models/TeamList.kt | 2 +- .../kotlin/io/appwrite/models/TopicList.kt | 2 +- .../kotlin/io/appwrite/models/UserList.kt | 2 +- .../kotlin/io/appwrite/models/VariableList.kt | 2 +- .../kotlin/io/appwrite/services/Account.kt | 6 - .../kotlin/io/appwrite/services/Databases.kt | 397 +-- .../kotlin/io/appwrite/services/Tables.kt | 2201 ----------------- 150 files changed, 128 insertions(+), 6123 deletions(-) delete mode 100644 docs/examples/java/tables/create-boolean-column.md delete mode 100644 docs/examples/java/tables/create-datetime-column.md delete mode 100644 docs/examples/java/tables/create-email-column.md delete mode 100644 docs/examples/java/tables/create-enum-column.md delete mode 100644 docs/examples/java/tables/create-float-column.md delete mode 100644 docs/examples/java/tables/create-index.md delete mode 100644 docs/examples/java/tables/create-integer-column.md delete mode 100644 docs/examples/java/tables/create-ip-column.md delete mode 100644 docs/examples/java/tables/create-relationship-column.md delete mode 100644 docs/examples/java/tables/create-row.md delete mode 100644 docs/examples/java/tables/create-rows.md delete mode 100644 docs/examples/java/tables/create-string-column.md delete mode 100644 docs/examples/java/tables/create-url-column.md delete mode 100644 docs/examples/java/tables/create.md delete mode 100644 docs/examples/java/tables/decrement-row-column.md delete mode 100644 docs/examples/java/tables/delete-column.md delete mode 100644 docs/examples/java/tables/delete-index.md delete mode 100644 docs/examples/java/tables/delete-row.md delete mode 100644 docs/examples/java/tables/delete-rows.md delete mode 100644 docs/examples/java/tables/delete.md delete mode 100644 docs/examples/java/tables/get-column.md delete mode 100644 docs/examples/java/tables/get-index.md delete mode 100644 docs/examples/java/tables/get-row.md delete mode 100644 docs/examples/java/tables/get.md delete mode 100644 docs/examples/java/tables/increment-row-column.md delete mode 100644 docs/examples/java/tables/list-columns.md delete mode 100644 docs/examples/java/tables/list-indexes.md delete mode 100644 docs/examples/java/tables/list-rows.md delete mode 100644 docs/examples/java/tables/list.md delete mode 100644 docs/examples/java/tables/update-boolean-column.md delete mode 100644 docs/examples/java/tables/update-datetime-column.md delete mode 100644 docs/examples/java/tables/update-email-column.md delete mode 100644 docs/examples/java/tables/update-enum-column.md delete mode 100644 docs/examples/java/tables/update-float-column.md delete mode 100644 docs/examples/java/tables/update-integer-column.md delete mode 100644 docs/examples/java/tables/update-ip-column.md delete mode 100644 docs/examples/java/tables/update-relationship-column.md delete mode 100644 docs/examples/java/tables/update-row.md delete mode 100644 docs/examples/java/tables/update-rows.md delete mode 100644 docs/examples/java/tables/update-string-column.md delete mode 100644 docs/examples/java/tables/update-url-column.md delete mode 100644 docs/examples/java/tables/update.md delete mode 100644 docs/examples/java/tables/upsert-row.md delete mode 100644 docs/examples/java/tables/upsert-rows.md delete mode 100644 docs/examples/kotlin/tables/create-boolean-column.md delete mode 100644 docs/examples/kotlin/tables/create-datetime-column.md delete mode 100644 docs/examples/kotlin/tables/create-email-column.md delete mode 100644 docs/examples/kotlin/tables/create-enum-column.md delete mode 100644 docs/examples/kotlin/tables/create-float-column.md delete mode 100644 docs/examples/kotlin/tables/create-index.md delete mode 100644 docs/examples/kotlin/tables/create-integer-column.md delete mode 100644 docs/examples/kotlin/tables/create-ip-column.md delete mode 100644 docs/examples/kotlin/tables/create-relationship-column.md delete mode 100644 docs/examples/kotlin/tables/create-row.md delete mode 100644 docs/examples/kotlin/tables/create-rows.md delete mode 100644 docs/examples/kotlin/tables/create-string-column.md delete mode 100644 docs/examples/kotlin/tables/create-url-column.md delete mode 100644 docs/examples/kotlin/tables/create.md delete mode 100644 docs/examples/kotlin/tables/decrement-row-column.md delete mode 100644 docs/examples/kotlin/tables/delete-column.md delete mode 100644 docs/examples/kotlin/tables/delete-index.md delete mode 100644 docs/examples/kotlin/tables/delete-row.md delete mode 100644 docs/examples/kotlin/tables/delete-rows.md delete mode 100644 docs/examples/kotlin/tables/delete.md delete mode 100644 docs/examples/kotlin/tables/get-column.md delete mode 100644 docs/examples/kotlin/tables/get-index.md delete mode 100644 docs/examples/kotlin/tables/get-row.md delete mode 100644 docs/examples/kotlin/tables/get.md delete mode 100644 docs/examples/kotlin/tables/increment-row-column.md delete mode 100644 docs/examples/kotlin/tables/list-columns.md delete mode 100644 docs/examples/kotlin/tables/list-indexes.md delete mode 100644 docs/examples/kotlin/tables/list-rows.md delete mode 100644 docs/examples/kotlin/tables/list.md delete mode 100644 docs/examples/kotlin/tables/update-boolean-column.md delete mode 100644 docs/examples/kotlin/tables/update-datetime-column.md delete mode 100644 docs/examples/kotlin/tables/update-email-column.md delete mode 100644 docs/examples/kotlin/tables/update-enum-column.md delete mode 100644 docs/examples/kotlin/tables/update-float-column.md delete mode 100644 docs/examples/kotlin/tables/update-integer-column.md delete mode 100644 docs/examples/kotlin/tables/update-ip-column.md delete mode 100644 docs/examples/kotlin/tables/update-relationship-column.md delete mode 100644 docs/examples/kotlin/tables/update-row.md delete mode 100644 docs/examples/kotlin/tables/update-rows.md delete mode 100644 docs/examples/kotlin/tables/update-string-column.md delete mode 100644 docs/examples/kotlin/tables/update-url-column.md delete mode 100644 docs/examples/kotlin/tables/update.md delete mode 100644 docs/examples/kotlin/tables/upsert-row.md delete mode 100644 docs/examples/kotlin/tables/upsert-rows.md delete mode 100644 src/main/kotlin/io/appwrite/models/ColumnBoolean.kt delete mode 100644 src/main/kotlin/io/appwrite/models/ColumnDatetime.kt delete mode 100644 src/main/kotlin/io/appwrite/models/ColumnEmail.kt delete mode 100644 src/main/kotlin/io/appwrite/models/ColumnEnum.kt delete mode 100644 src/main/kotlin/io/appwrite/models/ColumnFloat.kt delete mode 100644 src/main/kotlin/io/appwrite/models/ColumnIndex.kt delete mode 100644 src/main/kotlin/io/appwrite/models/ColumnIndexList.kt delete mode 100644 src/main/kotlin/io/appwrite/models/ColumnInteger.kt delete mode 100644 src/main/kotlin/io/appwrite/models/ColumnIp.kt delete mode 100644 src/main/kotlin/io/appwrite/models/ColumnList.kt delete mode 100644 src/main/kotlin/io/appwrite/models/ColumnRelationship.kt delete mode 100644 src/main/kotlin/io/appwrite/models/ColumnString.kt delete mode 100644 src/main/kotlin/io/appwrite/models/ColumnUrl.kt delete mode 100644 src/main/kotlin/io/appwrite/models/Row.kt delete mode 100644 src/main/kotlin/io/appwrite/models/RowList.kt delete mode 100644 src/main/kotlin/io/appwrite/models/Table.kt delete mode 100644 src/main/kotlin/io/appwrite/models/TableList.kt delete mode 100644 src/main/kotlin/io/appwrite/services/Tables.kt diff --git a/README.md b/README.md index 72c5530..52fd0c1 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ ![Maven Central](https://img.shields.io/maven-central/v/io.appwrite/sdk-for-kotlin.svg?color=green&style=flat-square) ![License](https://img.shields.io/github/license/appwrite/sdk-for-kotlin.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.8.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-kotlin/releases).** +**This SDK is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-kotlin/releases).** > This is the Kotlin SDK for integrating with Appwrite from your Kotlin server-side code. If you're looking for the Android SDK you should check [appwrite/sdk-for-android](https://github.com/appwrite/sdk-for-android) @@ -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:9.0.0") ``` ### Maven @@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-kotlin - 10.0.0 + 9.0.0 ``` diff --git a/docs/examples/java/databases/create-document.md b/docs/examples/java/databases/create-document.md index 368b816..5231be3 100644 --- a/docs/examples/java/databases/create-document.md +++ b/docs/examples/java/databases/create-document.md @@ -4,9 +4,8 @@ import io.appwrite.services.Databases; Client client = new Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setSession("") // The user session to authenticate with - .setKey("") // Your secret API key - .setJWT(""); // Your secret JSON Web Token + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with Databases databases = new Databases(client); diff --git a/docs/examples/java/databases/create-documents.md b/docs/examples/java/databases/create-documents.md index 77d7981..0de0c27 100644 --- a/docs/examples/java/databases/create-documents.md +++ b/docs/examples/java/databases/create-documents.md @@ -4,7 +4,7 @@ import io.appwrite.services.Databases; Client client = new Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setAdmin("") // + .setProject("") // Your project ID .setKey(""); // Your secret API key Databases databases = new Databases(client); diff --git a/docs/examples/java/databases/upsert-document.md b/docs/examples/java/databases/upsert-document.md index b1b4de4..daa4414 100644 --- a/docs/examples/java/databases/upsert-document.md +++ b/docs/examples/java/databases/upsert-document.md @@ -4,9 +4,8 @@ import io.appwrite.services.Databases; Client client = new Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setSession("") // The user session to authenticate with - .setKey("") // Your secret API key - .setJWT(""); // Your secret JSON Web Token + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with Databases databases = new Databases(client); @@ -14,6 +13,8 @@ databases.upsertDocument( "", // databaseId "", // collectionId "", // documentId + mapOf( "a" to "b" ), // data + listOf("read("any")"), // permissions (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/databases/upsert-documents.md b/docs/examples/java/databases/upsert-documents.md index 0bf0c17..95e9a33 100644 --- a/docs/examples/java/databases/upsert-documents.md +++ b/docs/examples/java/databases/upsert-documents.md @@ -4,7 +4,7 @@ import io.appwrite.services.Databases; Client client = new Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setAdmin("") // + .setProject("") // Your project ID .setKey(""); // Your secret API key Databases databases = new Databases(client); @@ -12,6 +12,7 @@ Databases databases = new Databases(client); databases.upsertDocuments( "", // databaseId "", // collectionId + listOf(), // documents new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/tables/create-boolean-column.md b/docs/examples/java/tables/create-boolean-column.md deleted file mode 100644 index 2336ee9..0000000 --- a/docs/examples/java/tables/create-boolean-column.md +++ /dev/null @@ -1,28 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.createBooleanColumn( - "", // databaseId - "", // tableId - "", // key - false, // required - false, // default (optional) - false, // array (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/create-datetime-column.md b/docs/examples/java/tables/create-datetime-column.md deleted file mode 100644 index dd3df83..0000000 --- a/docs/examples/java/tables/create-datetime-column.md +++ /dev/null @@ -1,28 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.createDatetimeColumn( - "", // databaseId - "", // tableId - "", // key - false, // required - "", // default (optional) - false, // array (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/create-email-column.md b/docs/examples/java/tables/create-email-column.md deleted file mode 100644 index 3b130d1..0000000 --- a/docs/examples/java/tables/create-email-column.md +++ /dev/null @@ -1,28 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.createEmailColumn( - "", // databaseId - "", // tableId - "", // key - false, // required - "email@example.com", // default (optional) - false, // array (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/create-enum-column.md b/docs/examples/java/tables/create-enum-column.md deleted file mode 100644 index 73c6e1c..0000000 --- a/docs/examples/java/tables/create-enum-column.md +++ /dev/null @@ -1,29 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.createEnumColumn( - "", // databaseId - "", // tableId - "", // key - listOf(), // elements - false, // required - "", // default (optional) - false, // array (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/create-float-column.md b/docs/examples/java/tables/create-float-column.md deleted file mode 100644 index dd6f207..0000000 --- a/docs/examples/java/tables/create-float-column.md +++ /dev/null @@ -1,30 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.createFloatColumn( - "", // databaseId - "", // tableId - "", // key - false, // required - 0, // min (optional) - 0, // max (optional) - 0, // default (optional) - false, // array (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/create-index.md b/docs/examples/java/tables/create-index.md deleted file mode 100644 index 2a4df00..0000000 --- a/docs/examples/java/tables/create-index.md +++ /dev/null @@ -1,30 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; -import io.appwrite.enums.IndexType; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.createIndex( - "", // databaseId - "", // tableId - "", // key - IndexType.KEY, // type - listOf(), // columns - listOf(), // orders (optional) - listOf(), // lengths (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/create-integer-column.md b/docs/examples/java/tables/create-integer-column.md deleted file mode 100644 index 3546ac8..0000000 --- a/docs/examples/java/tables/create-integer-column.md +++ /dev/null @@ -1,30 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.createIntegerColumn( - "", // databaseId - "", // tableId - "", // key - false, // required - 0, // min (optional) - 0, // max (optional) - 0, // default (optional) - false, // array (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/create-ip-column.md b/docs/examples/java/tables/create-ip-column.md deleted file mode 100644 index 825d8b0..0000000 --- a/docs/examples/java/tables/create-ip-column.md +++ /dev/null @@ -1,28 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.createIpColumn( - "", // databaseId - "", // tableId - "", // key - false, // required - "", // default (optional) - false, // array (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/create-relationship-column.md b/docs/examples/java/tables/create-relationship-column.md deleted file mode 100644 index 7a0b50a..0000000 --- a/docs/examples/java/tables/create-relationship-column.md +++ /dev/null @@ -1,31 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; -import io.appwrite.enums.RelationshipType; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.createRelationshipColumn( - "", // databaseId - "", // tableId - "", // relatedTableId - RelationshipType.ONETOONE, // type - false, // twoWay (optional) - "", // key (optional) - "", // twoWayKey (optional) - RelationMutate.CASCADE, // onDelete (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/create-row.md b/docs/examples/java/tables/create-row.md deleted file mode 100644 index 7ba3678..0000000 --- a/docs/examples/java/tables/create-row.md +++ /dev/null @@ -1,28 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setSession("") // The user session to authenticate with - .setKey("") // Your secret API key - .setJWT(""); // Your secret JSON Web Token - -Tables tables = new Tables(client); - -tables.createRow( - "", // databaseId - "", // tableId - "", // rowId - mapOf( "a" to "b" ), // data - listOf("read("any")"), // permissions (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/create-rows.md b/docs/examples/java/tables/create-rows.md deleted file mode 100644 index c20aa2c..0000000 --- a/docs/examples/java/tables/create-rows.md +++ /dev/null @@ -1,25 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setAdmin("") // - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.createRows( - "", // databaseId - "", // tableId - listOf(), // rows - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/create-string-column.md b/docs/examples/java/tables/create-string-column.md deleted file mode 100644 index b8cb626..0000000 --- a/docs/examples/java/tables/create-string-column.md +++ /dev/null @@ -1,30 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.createStringColumn( - "", // databaseId - "", // tableId - "", // key - 1, // size - false, // required - "", // default (optional) - false, // array (optional) - false, // encrypt (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/create-url-column.md b/docs/examples/java/tables/create-url-column.md deleted file mode 100644 index 91e90c8..0000000 --- a/docs/examples/java/tables/create-url-column.md +++ /dev/null @@ -1,28 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.createUrlColumn( - "", // databaseId - "", // tableId - "", // key - false, // required - "https://example.com", // default (optional) - false, // array (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/create.md b/docs/examples/java/tables/create.md deleted file mode 100644 index 6a9faf0..0000000 --- a/docs/examples/java/tables/create.md +++ /dev/null @@ -1,28 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.create( - "", // databaseId - "", // tableId - "", // name - listOf("read("any")"), // permissions (optional) - false, // rowSecurity (optional) - false, // enabled (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/decrement-row-column.md b/docs/examples/java/tables/decrement-row-column.md deleted file mode 100644 index 9e79f36..0000000 --- a/docs/examples/java/tables/decrement-row-column.md +++ /dev/null @@ -1,28 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.decrementRowColumn( - "", // databaseId - "", // tableId - "", // rowId - "", // column - 0, // value (optional) - 0, // min (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/delete-column.md b/docs/examples/java/tables/delete-column.md deleted file mode 100644 index f14390c..0000000 --- a/docs/examples/java/tables/delete-column.md +++ /dev/null @@ -1,25 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.deleteColumn( - "", // databaseId - "", // tableId - "", // key - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/delete-index.md b/docs/examples/java/tables/delete-index.md deleted file mode 100644 index 1b22eb0..0000000 --- a/docs/examples/java/tables/delete-index.md +++ /dev/null @@ -1,25 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.deleteIndex( - "", // databaseId - "", // tableId - "", // key - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/delete-row.md b/docs/examples/java/tables/delete-row.md deleted file mode 100644 index a48745a..0000000 --- a/docs/examples/java/tables/delete-row.md +++ /dev/null @@ -1,25 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setSession(""); // The user session to authenticate with - -Tables tables = new Tables(client); - -tables.deleteRow( - "", // databaseId - "", // tableId - "", // rowId - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/delete-rows.md b/docs/examples/java/tables/delete-rows.md deleted file mode 100644 index 6a86321..0000000 --- a/docs/examples/java/tables/delete-rows.md +++ /dev/null @@ -1,25 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.deleteRows( - "", // databaseId - "", // tableId - listOf(), // queries (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/delete.md b/docs/examples/java/tables/delete.md deleted file mode 100644 index e777c72..0000000 --- a/docs/examples/java/tables/delete.md +++ /dev/null @@ -1,24 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.delete( - "", // databaseId - "", // tableId - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/get-column.md b/docs/examples/java/tables/get-column.md deleted file mode 100644 index b4f7e12..0000000 --- a/docs/examples/java/tables/get-column.md +++ /dev/null @@ -1,25 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.getColumn( - "", // databaseId - "", // tableId - "", // key - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/get-index.md b/docs/examples/java/tables/get-index.md deleted file mode 100644 index 5bcd59d..0000000 --- a/docs/examples/java/tables/get-index.md +++ /dev/null @@ -1,25 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.getIndex( - "", // databaseId - "", // tableId - "", // key - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/get-row.md b/docs/examples/java/tables/get-row.md deleted file mode 100644 index 7f72c25..0000000 --- a/docs/examples/java/tables/get-row.md +++ /dev/null @@ -1,26 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setSession(""); // The user session to authenticate with - -Tables tables = new Tables(client); - -tables.getRow( - "", // databaseId - "", // tableId - "", // rowId - listOf(), // queries (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/get.md b/docs/examples/java/tables/get.md deleted file mode 100644 index 6f3c639..0000000 --- a/docs/examples/java/tables/get.md +++ /dev/null @@ -1,24 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.get( - "", // databaseId - "", // tableId - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/increment-row-column.md b/docs/examples/java/tables/increment-row-column.md deleted file mode 100644 index f9c8283..0000000 --- a/docs/examples/java/tables/increment-row-column.md +++ /dev/null @@ -1,28 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.incrementRowColumn( - "", // databaseId - "", // tableId - "", // rowId - "", // column - 0, // value (optional) - 0, // max (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/list-columns.md b/docs/examples/java/tables/list-columns.md deleted file mode 100644 index 05e1960..0000000 --- a/docs/examples/java/tables/list-columns.md +++ /dev/null @@ -1,25 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.listColumns( - "", // databaseId - "", // tableId - listOf(), // queries (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/list-indexes.md b/docs/examples/java/tables/list-indexes.md deleted file mode 100644 index c9bd445..0000000 --- a/docs/examples/java/tables/list-indexes.md +++ /dev/null @@ -1,25 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.listIndexes( - "", // databaseId - "", // tableId - listOf(), // queries (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/list-rows.md b/docs/examples/java/tables/list-rows.md deleted file mode 100644 index 8cbc356..0000000 --- a/docs/examples/java/tables/list-rows.md +++ /dev/null @@ -1,25 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setSession(""); // The user session to authenticate with - -Tables tables = new Tables(client); - -tables.listRows( - "", // databaseId - "", // tableId - listOf(), // queries (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/list.md b/docs/examples/java/tables/list.md deleted file mode 100644 index c3e0c55..0000000 --- a/docs/examples/java/tables/list.md +++ /dev/null @@ -1,25 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.list( - "", // databaseId - listOf(), // queries (optional) - "", // search (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/update-boolean-column.md b/docs/examples/java/tables/update-boolean-column.md deleted file mode 100644 index 647190e..0000000 --- a/docs/examples/java/tables/update-boolean-column.md +++ /dev/null @@ -1,28 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.updateBooleanColumn( - "", // databaseId - "", // tableId - "", // key - false, // required - false, // default - "", // newKey (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/update-datetime-column.md b/docs/examples/java/tables/update-datetime-column.md deleted file mode 100644 index 38e0e60..0000000 --- a/docs/examples/java/tables/update-datetime-column.md +++ /dev/null @@ -1,28 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.updateDatetimeColumn( - "", // databaseId - "", // tableId - "", // key - false, // required - "", // default - "", // newKey (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/update-email-column.md b/docs/examples/java/tables/update-email-column.md deleted file mode 100644 index 918884e..0000000 --- a/docs/examples/java/tables/update-email-column.md +++ /dev/null @@ -1,28 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.updateEmailColumn( - "", // databaseId - "", // tableId - "", // key - false, // required - "email@example.com", // default - "", // newKey (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/update-enum-column.md b/docs/examples/java/tables/update-enum-column.md deleted file mode 100644 index b1bbc83..0000000 --- a/docs/examples/java/tables/update-enum-column.md +++ /dev/null @@ -1,29 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.updateEnumColumn( - "", // databaseId - "", // tableId - "", // key - listOf(), // elements - false, // required - "", // default - "", // newKey (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/update-float-column.md b/docs/examples/java/tables/update-float-column.md deleted file mode 100644 index 977c237..0000000 --- a/docs/examples/java/tables/update-float-column.md +++ /dev/null @@ -1,30 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.updateFloatColumn( - "", // databaseId - "", // tableId - "", // key - false, // required - 0, // default - 0, // min (optional) - 0, // max (optional) - "", // newKey (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/update-integer-column.md b/docs/examples/java/tables/update-integer-column.md deleted file mode 100644 index d2ad81d..0000000 --- a/docs/examples/java/tables/update-integer-column.md +++ /dev/null @@ -1,30 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.updateIntegerColumn( - "", // databaseId - "", // tableId - "", // key - false, // required - 0, // default - 0, // min (optional) - 0, // max (optional) - "", // newKey (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/update-ip-column.md b/docs/examples/java/tables/update-ip-column.md deleted file mode 100644 index cd6e67b..0000000 --- a/docs/examples/java/tables/update-ip-column.md +++ /dev/null @@ -1,28 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.updateIpColumn( - "", // databaseId - "", // tableId - "", // key - false, // required - "", // default - "", // newKey (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/update-relationship-column.md b/docs/examples/java/tables/update-relationship-column.md deleted file mode 100644 index e0dc185..0000000 --- a/docs/examples/java/tables/update-relationship-column.md +++ /dev/null @@ -1,27 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.updateRelationshipColumn( - "", // databaseId - "", // tableId - "", // key - RelationMutate.CASCADE, // onDelete (optional) - "", // newKey (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/update-row.md b/docs/examples/java/tables/update-row.md deleted file mode 100644 index 8270c3f..0000000 --- a/docs/examples/java/tables/update-row.md +++ /dev/null @@ -1,27 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setSession(""); // The user session to authenticate with - -Tables tables = new Tables(client); - -tables.updateRow( - "", // databaseId - "", // tableId - "", // rowId - mapOf( "a" to "b" ), // data (optional) - listOf("read("any")"), // permissions (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/update-rows.md b/docs/examples/java/tables/update-rows.md deleted file mode 100644 index a518785..0000000 --- a/docs/examples/java/tables/update-rows.md +++ /dev/null @@ -1,26 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.updateRows( - "", // databaseId - "", // tableId - mapOf( "a" to "b" ), // data (optional) - listOf(), // queries (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/update-string-column.md b/docs/examples/java/tables/update-string-column.md deleted file mode 100644 index 31e279d..0000000 --- a/docs/examples/java/tables/update-string-column.md +++ /dev/null @@ -1,29 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.updateStringColumn( - "", // databaseId - "", // tableId - "", // key - false, // required - "", // default - 1, // size (optional) - "", // newKey (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/update-url-column.md b/docs/examples/java/tables/update-url-column.md deleted file mode 100644 index 201e578..0000000 --- a/docs/examples/java/tables/update-url-column.md +++ /dev/null @@ -1,28 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.updateUrlColumn( - "", // databaseId - "", // tableId - "", // key - false, // required - "https://example.com", // default - "", // newKey (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/update.md b/docs/examples/java/tables/update.md deleted file mode 100644 index cf560cb..0000000 --- a/docs/examples/java/tables/update.md +++ /dev/null @@ -1,28 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.update( - "", // databaseId - "", // tableId - "", // name - listOf("read("any")"), // permissions (optional) - false, // rowSecurity (optional) - false, // enabled (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/upsert-row.md b/docs/examples/java/tables/upsert-row.md deleted file mode 100644 index 11127c5..0000000 --- a/docs/examples/java/tables/upsert-row.md +++ /dev/null @@ -1,26 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setSession("") // The user session to authenticate with - .setKey("") // Your secret API key - .setJWT(""); // Your secret JSON Web Token - -Tables tables = new Tables(client); - -tables.upsertRow( - "", // databaseId - "", // tableId - "", // rowId - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/java/tables/upsert-rows.md b/docs/examples/java/tables/upsert-rows.md deleted file mode 100644 index 14b3822..0000000 --- a/docs/examples/java/tables/upsert-rows.md +++ /dev/null @@ -1,24 +0,0 @@ -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Tables; - -Client client = new Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setAdmin("") // - .setKey(""); // Your secret API key - -Tables tables = new Tables(client); - -tables.upsertRows( - "", // databaseId - "", // tableId - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - System.out.println(result); - }) -); - diff --git a/docs/examples/kotlin/databases/create-document.md b/docs/examples/kotlin/databases/create-document.md index 93da01e..695fdbd 100644 --- a/docs/examples/kotlin/databases/create-document.md +++ b/docs/examples/kotlin/databases/create-document.md @@ -4,9 +4,8 @@ import io.appwrite.services.Databases val client = Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID .setSession("") // The user session to authenticate with - .setKey("") // Your secret API key - .setJWT("") // Your secret JSON Web Token val databases = Databases(client) diff --git a/docs/examples/kotlin/databases/create-documents.md b/docs/examples/kotlin/databases/create-documents.md index ddce31c..41a98dc 100644 --- a/docs/examples/kotlin/databases/create-documents.md +++ b/docs/examples/kotlin/databases/create-documents.md @@ -4,7 +4,7 @@ import io.appwrite.services.Databases val client = Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setAdmin("") // + .setProject("") // Your project ID .setKey("") // Your secret API key val databases = Databases(client) diff --git a/docs/examples/kotlin/databases/upsert-document.md b/docs/examples/kotlin/databases/upsert-document.md index df261db..d8be0e1 100644 --- a/docs/examples/kotlin/databases/upsert-document.md +++ b/docs/examples/kotlin/databases/upsert-document.md @@ -4,14 +4,15 @@ import io.appwrite.services.Databases val client = Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID .setSession("") // The user session to authenticate with - .setKey("") // Your secret API key - .setJWT("") // Your secret JSON Web Token val databases = Databases(client) val response = databases.upsertDocument( databaseId = "", collectionId = "", - documentId = "" + documentId = "", + data = mapOf( "a" to "b" ), + permissions = listOf("read("any")") // optional ) diff --git a/docs/examples/kotlin/databases/upsert-documents.md b/docs/examples/kotlin/databases/upsert-documents.md index 1cb376f..ca861c6 100644 --- a/docs/examples/kotlin/databases/upsert-documents.md +++ b/docs/examples/kotlin/databases/upsert-documents.md @@ -4,12 +4,13 @@ import io.appwrite.services.Databases val client = Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setAdmin("") // + .setProject("") // Your project ID .setKey("") // Your secret API key val databases = Databases(client) val response = databases.upsertDocuments( databaseId = "", - collectionId = "" + collectionId = "", + documents = listOf() ) diff --git a/docs/examples/kotlin/tables/create-boolean-column.md b/docs/examples/kotlin/tables/create-boolean-column.md deleted file mode 100644 index 68b8dc5..0000000 --- a/docs/examples/kotlin/tables/create-boolean-column.md +++ /dev/null @@ -1,19 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.createBooleanColumn( - databaseId = "", - tableId = "", - key = "", - required = false, - default = false, // optional - array = false // optional -) diff --git a/docs/examples/kotlin/tables/create-datetime-column.md b/docs/examples/kotlin/tables/create-datetime-column.md deleted file mode 100644 index 8740a71..0000000 --- a/docs/examples/kotlin/tables/create-datetime-column.md +++ /dev/null @@ -1,19 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.createDatetimeColumn( - databaseId = "", - tableId = "", - key = "", - required = false, - default = "", // optional - array = false // optional -) diff --git a/docs/examples/kotlin/tables/create-email-column.md b/docs/examples/kotlin/tables/create-email-column.md deleted file mode 100644 index 34a6cb6..0000000 --- a/docs/examples/kotlin/tables/create-email-column.md +++ /dev/null @@ -1,19 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.createEmailColumn( - databaseId = "", - tableId = "", - key = "", - required = false, - default = "email@example.com", // optional - array = false // optional -) diff --git a/docs/examples/kotlin/tables/create-enum-column.md b/docs/examples/kotlin/tables/create-enum-column.md deleted file mode 100644 index d3d2fc9..0000000 --- a/docs/examples/kotlin/tables/create-enum-column.md +++ /dev/null @@ -1,20 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.createEnumColumn( - databaseId = "", - tableId = "", - key = "", - elements = listOf(), - required = false, - default = "", // optional - array = false // optional -) diff --git a/docs/examples/kotlin/tables/create-float-column.md b/docs/examples/kotlin/tables/create-float-column.md deleted file mode 100644 index 8540430..0000000 --- a/docs/examples/kotlin/tables/create-float-column.md +++ /dev/null @@ -1,21 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.createFloatColumn( - databaseId = "", - tableId = "", - key = "", - required = false, - min = 0, // optional - max = 0, // optional - default = 0, // optional - array = false // optional -) diff --git a/docs/examples/kotlin/tables/create-index.md b/docs/examples/kotlin/tables/create-index.md deleted file mode 100644 index 053c88a..0000000 --- a/docs/examples/kotlin/tables/create-index.md +++ /dev/null @@ -1,21 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables -import io.appwrite.enums.IndexType - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.createIndex( - databaseId = "", - tableId = "", - key = "", - type = IndexType.KEY, - columns = listOf(), - orders = listOf(), // optional - lengths = listOf() // optional -) diff --git a/docs/examples/kotlin/tables/create-integer-column.md b/docs/examples/kotlin/tables/create-integer-column.md deleted file mode 100644 index 1222746..0000000 --- a/docs/examples/kotlin/tables/create-integer-column.md +++ /dev/null @@ -1,21 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.createIntegerColumn( - databaseId = "", - tableId = "", - key = "", - required = false, - min = 0, // optional - max = 0, // optional - default = 0, // optional - array = false // optional -) diff --git a/docs/examples/kotlin/tables/create-ip-column.md b/docs/examples/kotlin/tables/create-ip-column.md deleted file mode 100644 index 277c756..0000000 --- a/docs/examples/kotlin/tables/create-ip-column.md +++ /dev/null @@ -1,19 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.createIpColumn( - databaseId = "", - tableId = "", - key = "", - required = false, - default = "", // optional - array = false // optional -) diff --git a/docs/examples/kotlin/tables/create-relationship-column.md b/docs/examples/kotlin/tables/create-relationship-column.md deleted file mode 100644 index aa07fac..0000000 --- a/docs/examples/kotlin/tables/create-relationship-column.md +++ /dev/null @@ -1,22 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables -import io.appwrite.enums.RelationshipType - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.createRelationshipColumn( - databaseId = "", - tableId = "", - relatedTableId = "", - type = RelationshipType.ONETOONE, - twoWay = false, // optional - key = "", // optional - twoWayKey = "", // optional - onDelete = "cascade" // optional -) diff --git a/docs/examples/kotlin/tables/create-row.md b/docs/examples/kotlin/tables/create-row.md deleted file mode 100644 index 5df0890..0000000 --- a/docs/examples/kotlin/tables/create-row.md +++ /dev/null @@ -1,19 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setSession("") // The user session to authenticate with - .setKey("") // Your secret API key - .setJWT("") // Your secret JSON Web Token - -val tables = Tables(client) - -val response = tables.createRow( - databaseId = "", - tableId = "", - rowId = "", - data = mapOf( "a" to "b" ), - permissions = listOf("read("any")") // optional -) diff --git a/docs/examples/kotlin/tables/create-rows.md b/docs/examples/kotlin/tables/create-rows.md deleted file mode 100644 index f549d6f..0000000 --- a/docs/examples/kotlin/tables/create-rows.md +++ /dev/null @@ -1,16 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setAdmin("") // - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.createRows( - databaseId = "", - tableId = "", - rows = listOf() -) diff --git a/docs/examples/kotlin/tables/create-string-column.md b/docs/examples/kotlin/tables/create-string-column.md deleted file mode 100644 index d82026c..0000000 --- a/docs/examples/kotlin/tables/create-string-column.md +++ /dev/null @@ -1,21 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.createStringColumn( - databaseId = "", - tableId = "", - key = "", - size = 1, - required = false, - default = "", // optional - array = false, // optional - encrypt = false // optional -) diff --git a/docs/examples/kotlin/tables/create-url-column.md b/docs/examples/kotlin/tables/create-url-column.md deleted file mode 100644 index 42f50e9..0000000 --- a/docs/examples/kotlin/tables/create-url-column.md +++ /dev/null @@ -1,19 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.createUrlColumn( - databaseId = "", - tableId = "", - key = "", - required = false, - default = "https://example.com", // optional - array = false // optional -) diff --git a/docs/examples/kotlin/tables/create.md b/docs/examples/kotlin/tables/create.md deleted file mode 100644 index 3dc1d1a..0000000 --- a/docs/examples/kotlin/tables/create.md +++ /dev/null @@ -1,19 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.create( - databaseId = "", - tableId = "", - name = "", - permissions = listOf("read("any")"), // optional - rowSecurity = false, // optional - enabled = false // optional -) diff --git a/docs/examples/kotlin/tables/decrement-row-column.md b/docs/examples/kotlin/tables/decrement-row-column.md deleted file mode 100644 index f78f7bb..0000000 --- a/docs/examples/kotlin/tables/decrement-row-column.md +++ /dev/null @@ -1,19 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.decrementRowColumn( - databaseId = "", - tableId = "", - rowId = "", - column = "", - value = 0, // optional - min = 0 // optional -) diff --git a/docs/examples/kotlin/tables/delete-column.md b/docs/examples/kotlin/tables/delete-column.md deleted file mode 100644 index d41f2ce..0000000 --- a/docs/examples/kotlin/tables/delete-column.md +++ /dev/null @@ -1,16 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.deleteColumn( - databaseId = "", - tableId = "", - key = "" -) diff --git a/docs/examples/kotlin/tables/delete-index.md b/docs/examples/kotlin/tables/delete-index.md deleted file mode 100644 index 7af6648..0000000 --- a/docs/examples/kotlin/tables/delete-index.md +++ /dev/null @@ -1,16 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.deleteIndex( - databaseId = "", - tableId = "", - key = "" -) diff --git a/docs/examples/kotlin/tables/delete-row.md b/docs/examples/kotlin/tables/delete-row.md deleted file mode 100644 index d182ccf..0000000 --- a/docs/examples/kotlin/tables/delete-row.md +++ /dev/null @@ -1,16 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setSession("") // The user session to authenticate with - -val tables = Tables(client) - -val response = tables.deleteRow( - databaseId = "", - tableId = "", - rowId = "" -) diff --git a/docs/examples/kotlin/tables/delete-rows.md b/docs/examples/kotlin/tables/delete-rows.md deleted file mode 100644 index 54ff6b6..0000000 --- a/docs/examples/kotlin/tables/delete-rows.md +++ /dev/null @@ -1,16 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.deleteRows( - databaseId = "", - tableId = "", - queries = listOf() // optional -) diff --git a/docs/examples/kotlin/tables/delete.md b/docs/examples/kotlin/tables/delete.md deleted file mode 100644 index 5cbd032..0000000 --- a/docs/examples/kotlin/tables/delete.md +++ /dev/null @@ -1,15 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.delete( - databaseId = "", - tableId = "" -) diff --git a/docs/examples/kotlin/tables/get-column.md b/docs/examples/kotlin/tables/get-column.md deleted file mode 100644 index 6f4d65b..0000000 --- a/docs/examples/kotlin/tables/get-column.md +++ /dev/null @@ -1,16 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.getColumn( - databaseId = "", - tableId = "", - key = "" -) diff --git a/docs/examples/kotlin/tables/get-index.md b/docs/examples/kotlin/tables/get-index.md deleted file mode 100644 index 660502f..0000000 --- a/docs/examples/kotlin/tables/get-index.md +++ /dev/null @@ -1,16 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.getIndex( - databaseId = "", - tableId = "", - key = "" -) diff --git a/docs/examples/kotlin/tables/get-row.md b/docs/examples/kotlin/tables/get-row.md deleted file mode 100644 index cbaaa6c..0000000 --- a/docs/examples/kotlin/tables/get-row.md +++ /dev/null @@ -1,17 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setSession("") // The user session to authenticate with - -val tables = Tables(client) - -val response = tables.getRow( - databaseId = "", - tableId = "", - rowId = "", - queries = listOf() // optional -) diff --git a/docs/examples/kotlin/tables/get.md b/docs/examples/kotlin/tables/get.md deleted file mode 100644 index ff6d354..0000000 --- a/docs/examples/kotlin/tables/get.md +++ /dev/null @@ -1,15 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.get( - databaseId = "", - tableId = "" -) diff --git a/docs/examples/kotlin/tables/increment-row-column.md b/docs/examples/kotlin/tables/increment-row-column.md deleted file mode 100644 index 7917b7f..0000000 --- a/docs/examples/kotlin/tables/increment-row-column.md +++ /dev/null @@ -1,19 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.incrementRowColumn( - databaseId = "", - tableId = "", - rowId = "", - column = "", - value = 0, // optional - max = 0 // optional -) diff --git a/docs/examples/kotlin/tables/list-columns.md b/docs/examples/kotlin/tables/list-columns.md deleted file mode 100644 index 4c17651..0000000 --- a/docs/examples/kotlin/tables/list-columns.md +++ /dev/null @@ -1,16 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.listColumns( - databaseId = "", - tableId = "", - queries = listOf() // optional -) diff --git a/docs/examples/kotlin/tables/list-indexes.md b/docs/examples/kotlin/tables/list-indexes.md deleted file mode 100644 index bcd1fe7..0000000 --- a/docs/examples/kotlin/tables/list-indexes.md +++ /dev/null @@ -1,16 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.listIndexes( - databaseId = "", - tableId = "", - queries = listOf() // optional -) diff --git a/docs/examples/kotlin/tables/list-rows.md b/docs/examples/kotlin/tables/list-rows.md deleted file mode 100644 index 38b776a..0000000 --- a/docs/examples/kotlin/tables/list-rows.md +++ /dev/null @@ -1,16 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setSession("") // The user session to authenticate with - -val tables = Tables(client) - -val response = tables.listRows( - databaseId = "", - tableId = "", - queries = listOf() // optional -) diff --git a/docs/examples/kotlin/tables/list.md b/docs/examples/kotlin/tables/list.md deleted file mode 100644 index 37b0344..0000000 --- a/docs/examples/kotlin/tables/list.md +++ /dev/null @@ -1,16 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.list( - databaseId = "", - queries = listOf(), // optional - search = "" // optional -) diff --git a/docs/examples/kotlin/tables/update-boolean-column.md b/docs/examples/kotlin/tables/update-boolean-column.md deleted file mode 100644 index 10a0422..0000000 --- a/docs/examples/kotlin/tables/update-boolean-column.md +++ /dev/null @@ -1,19 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.updateBooleanColumn( - databaseId = "", - tableId = "", - key = "", - required = false, - default = false, - newKey = "" // optional -) diff --git a/docs/examples/kotlin/tables/update-datetime-column.md b/docs/examples/kotlin/tables/update-datetime-column.md deleted file mode 100644 index 69ccf03..0000000 --- a/docs/examples/kotlin/tables/update-datetime-column.md +++ /dev/null @@ -1,19 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.updateDatetimeColumn( - databaseId = "", - tableId = "", - key = "", - required = false, - default = "", - newKey = "" // optional -) diff --git a/docs/examples/kotlin/tables/update-email-column.md b/docs/examples/kotlin/tables/update-email-column.md deleted file mode 100644 index 593a89b..0000000 --- a/docs/examples/kotlin/tables/update-email-column.md +++ /dev/null @@ -1,19 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.updateEmailColumn( - databaseId = "", - tableId = "", - key = "", - required = false, - default = "email@example.com", - newKey = "" // optional -) diff --git a/docs/examples/kotlin/tables/update-enum-column.md b/docs/examples/kotlin/tables/update-enum-column.md deleted file mode 100644 index b672e3e..0000000 --- a/docs/examples/kotlin/tables/update-enum-column.md +++ /dev/null @@ -1,20 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.updateEnumColumn( - databaseId = "", - tableId = "", - key = "", - elements = listOf(), - required = false, - default = "", - newKey = "" // optional -) diff --git a/docs/examples/kotlin/tables/update-float-column.md b/docs/examples/kotlin/tables/update-float-column.md deleted file mode 100644 index 005c4e6..0000000 --- a/docs/examples/kotlin/tables/update-float-column.md +++ /dev/null @@ -1,21 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.updateFloatColumn( - databaseId = "", - tableId = "", - key = "", - required = false, - default = 0, - min = 0, // optional - max = 0, // optional - newKey = "" // optional -) diff --git a/docs/examples/kotlin/tables/update-integer-column.md b/docs/examples/kotlin/tables/update-integer-column.md deleted file mode 100644 index 39da19d..0000000 --- a/docs/examples/kotlin/tables/update-integer-column.md +++ /dev/null @@ -1,21 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.updateIntegerColumn( - databaseId = "", - tableId = "", - key = "", - required = false, - default = 0, - min = 0, // optional - max = 0, // optional - newKey = "" // optional -) diff --git a/docs/examples/kotlin/tables/update-ip-column.md b/docs/examples/kotlin/tables/update-ip-column.md deleted file mode 100644 index 40e54bc..0000000 --- a/docs/examples/kotlin/tables/update-ip-column.md +++ /dev/null @@ -1,19 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.updateIpColumn( - databaseId = "", - tableId = "", - key = "", - required = false, - default = "", - newKey = "" // optional -) diff --git a/docs/examples/kotlin/tables/update-relationship-column.md b/docs/examples/kotlin/tables/update-relationship-column.md deleted file mode 100644 index d4c36e8..0000000 --- a/docs/examples/kotlin/tables/update-relationship-column.md +++ /dev/null @@ -1,18 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.updateRelationshipColumn( - databaseId = "", - tableId = "", - key = "", - onDelete = "cascade", // optional - newKey = "" // optional -) diff --git a/docs/examples/kotlin/tables/update-row.md b/docs/examples/kotlin/tables/update-row.md deleted file mode 100644 index 6d3d9a4..0000000 --- a/docs/examples/kotlin/tables/update-row.md +++ /dev/null @@ -1,18 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setSession("") // The user session to authenticate with - -val tables = Tables(client) - -val response = tables.updateRow( - databaseId = "", - tableId = "", - rowId = "", - data = mapOf( "a" to "b" ), // optional - permissions = listOf("read("any")") // optional -) diff --git a/docs/examples/kotlin/tables/update-rows.md b/docs/examples/kotlin/tables/update-rows.md deleted file mode 100644 index aac87c1..0000000 --- a/docs/examples/kotlin/tables/update-rows.md +++ /dev/null @@ -1,17 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.updateRows( - databaseId = "", - tableId = "", - data = mapOf( "a" to "b" ), // optional - queries = listOf() // optional -) diff --git a/docs/examples/kotlin/tables/update-string-column.md b/docs/examples/kotlin/tables/update-string-column.md deleted file mode 100644 index bb5b1f4..0000000 --- a/docs/examples/kotlin/tables/update-string-column.md +++ /dev/null @@ -1,20 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.updateStringColumn( - databaseId = "", - tableId = "", - key = "", - required = false, - default = "", - size = 1, // optional - newKey = "" // optional -) diff --git a/docs/examples/kotlin/tables/update-url-column.md b/docs/examples/kotlin/tables/update-url-column.md deleted file mode 100644 index 07f43e3..0000000 --- a/docs/examples/kotlin/tables/update-url-column.md +++ /dev/null @@ -1,19 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.updateUrlColumn( - databaseId = "", - tableId = "", - key = "", - required = false, - default = "https://example.com", - newKey = "" // optional -) diff --git a/docs/examples/kotlin/tables/update.md b/docs/examples/kotlin/tables/update.md deleted file mode 100644 index 3815323..0000000 --- a/docs/examples/kotlin/tables/update.md +++ /dev/null @@ -1,19 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.update( - databaseId = "", - tableId = "", - name = "", - permissions = listOf("read("any")"), // optional - rowSecurity = false, // optional - enabled = false // optional -) diff --git a/docs/examples/kotlin/tables/upsert-row.md b/docs/examples/kotlin/tables/upsert-row.md deleted file mode 100644 index 6e02b3a..0000000 --- a/docs/examples/kotlin/tables/upsert-row.md +++ /dev/null @@ -1,17 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setSession("") // The user session to authenticate with - .setKey("") // Your secret API key - .setJWT("") // Your secret JSON Web Token - -val tables = Tables(client) - -val response = tables.upsertRow( - databaseId = "", - tableId = "", - rowId = "" -) diff --git a/docs/examples/kotlin/tables/upsert-rows.md b/docs/examples/kotlin/tables/upsert-rows.md deleted file mode 100644 index d639e3d..0000000 --- a/docs/examples/kotlin/tables/upsert-rows.md +++ /dev/null @@ -1,15 +0,0 @@ -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Tables - -val client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setAdmin("") // - .setKey("") // Your secret API key - -val tables = Tables(client) - -val response = tables.upsertRows( - databaseId = "", - tableId = "" -) diff --git a/src/main/kotlin/io/appwrite/Client.kt b/src/main/kotlin/io/appwrite/Client.kt index 41a6878..c7824ef 100644 --- a/src/main/kotlin/io/appwrite/Client.kt +++ b/src/main/kotlin/io/appwrite/Client.kt @@ -58,12 +58,12 @@ 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/9.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-appwrite-response-format" to "1.8.0", + "x-sdk-version" to "9.0.0", + "x-appwrite-response-format" to "1.7.0", ) config = mutableMapOf() diff --git a/src/main/kotlin/io/appwrite/models/BucketList.kt b/src/main/kotlin/io/appwrite/models/BucketList.kt index 58cce61..91e331f 100644 --- a/src/main/kotlin/io/appwrite/models/BucketList.kt +++ b/src/main/kotlin/io/appwrite/models/BucketList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class BucketList( /** - * Total number of buckets rows that matched your query. + * Total number of buckets documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/CollectionList.kt b/src/main/kotlin/io/appwrite/models/CollectionList.kt index 6cd040a..b171ae8 100644 --- a/src/main/kotlin/io/appwrite/models/CollectionList.kt +++ b/src/main/kotlin/io/appwrite/models/CollectionList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class CollectionList( /** - * Total number of collections rows that matched your query. + * Total number of collections documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/ColumnBoolean.kt b/src/main/kotlin/io/appwrite/models/ColumnBoolean.kt deleted file mode 100644 index fc5c45e..0000000 --- a/src/main/kotlin/io/appwrite/models/ColumnBoolean.kt +++ /dev/null @@ -1,94 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * ColumnBoolean - */ -data class ColumnBoolean( - /** - * 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 attribute when not provided. Cannot be set when attribute is required. - */ - @SerializedName("default") - var default: Boolean?, - -) { - 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, - ) = ColumnBoolean( - 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? Boolean?, - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnDatetime.kt b/src/main/kotlin/io/appwrite/models/ColumnDatetime.kt deleted file mode 100644 index 3c5c446..0000000 --- a/src/main/kotlin/io/appwrite/models/ColumnDatetime.kt +++ /dev/null @@ -1,102 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * ColumnDatetime - */ -data class ColumnDatetime( - /** - * 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, - - /** - * ISO 8601 format. - */ - @SerializedName("format") - val format: String, - - /** - * Default value for attribute when not provided. Only null is optional - */ - @SerializedName("default") - var default: String?, - -) { - 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, - "format" to format as Any, - "default" to default as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = ColumnDatetime( - 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, - format = map["format"] as String, - default = map["default"] as? String?, - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnEmail.kt b/src/main/kotlin/io/appwrite/models/ColumnEmail.kt deleted file mode 100644 index 43c9cf2..0000000 --- a/src/main/kotlin/io/appwrite/models/ColumnEmail.kt +++ /dev/null @@ -1,102 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * ColumnEmail - */ -data class ColumnEmail( - /** - * 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, - - /** - * String format. - */ - @SerializedName("format") - val format: String, - - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - @SerializedName("default") - var default: String?, - -) { - 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, - "format" to format as Any, - "default" to default as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = ColumnEmail( - 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, - format = map["format"] as String, - default = map["default"] as? String?, - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnEnum.kt b/src/main/kotlin/io/appwrite/models/ColumnEnum.kt deleted file mode 100644 index 717316b..0000000 --- a/src/main/kotlin/io/appwrite/models/ColumnEnum.kt +++ /dev/null @@ -1,110 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * ColumnEnum - */ -data class ColumnEnum( - /** - * 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, - - /** - * Array of elements in enumerated type. - */ - @SerializedName("elements") - val elements: List, - - /** - * String format. - */ - @SerializedName("format") - val format: String, - - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - @SerializedName("default") - var default: String?, - -) { - 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, - "elements" to elements as Any, - "format" to format as Any, - "default" to default as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = ColumnEnum( - 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, - elements = map["elements"] as List, - format = map["format"] as String, - default = map["default"] as? String?, - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnFloat.kt b/src/main/kotlin/io/appwrite/models/ColumnFloat.kt deleted file mode 100644 index 92b7a2f..0000000 --- a/src/main/kotlin/io/appwrite/models/ColumnFloat.kt +++ /dev/null @@ -1,110 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * ColumnFloat - */ -data class ColumnFloat( - /** - * 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, - - /** - * Minimum value to enforce for new documents. - */ - @SerializedName("min") - var min: Double?, - - /** - * Maximum value to enforce for new documents. - */ - @SerializedName("max") - var max: Double?, - - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - @SerializedName("default") - var default: Double?, - -) { - 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, - "min" to min as Any, - "max" to max as Any, - "default" to default as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = ColumnFloat( - 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, - min = (map["min"] as? Number)?.toDouble(), - max = (map["max"] as? Number)?.toDouble(), - default = (map["default"] as? Number)?.toDouble(), - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnIndex.kt b/src/main/kotlin/io/appwrite/models/ColumnIndex.kt deleted file mode 100644 index 4912fe9..0000000 --- a/src/main/kotlin/io/appwrite/models/ColumnIndex.kt +++ /dev/null @@ -1,94 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * Index - */ -data class ColumnIndex( - /** - * Index Key. - */ - @SerializedName("key") - val key: String, - - /** - * Index type. - */ - @SerializedName("type") - val type: String, - - /** - * Index 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 index. - */ - @SerializedName("error") - val error: String, - - /** - * Index columns. - */ - @SerializedName("columns") - val columns: List, - - /** - * Index columns length. - */ - @SerializedName("lengths") - val lengths: List, - - /** - * Index orders. - */ - @SerializedName("orders") - var orders: List?, - - /** - * Index creation date in ISO 8601 format. - */ - @SerializedName("\$createdAt") - val createdAt: String, - - /** - * Index update date in ISO 8601 format. - */ - @SerializedName("\$updatedAt") - val updatedAt: String, - -) { - fun toMap(): Map = mapOf( - "key" to key as Any, - "type" to type as Any, - "status" to status as Any, - "error" to error as Any, - "columns" to columns as Any, - "lengths" to lengths as Any, - "orders" to orders as Any, - "\$createdAt" to createdAt as Any, - "\$updatedAt" to updatedAt as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = ColumnIndex( - key = map["key"] as String, - type = map["type"] as String, - status = map["status"] as String, - error = map["error"] as String, - columns = map["columns"] as List, - lengths = map["lengths"] as List, - orders = map["orders"] as? List?, - createdAt = map["\$createdAt"] as String, - updatedAt = map["\$updatedAt"] as String, - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnIndexList.kt b/src/main/kotlin/io/appwrite/models/ColumnIndexList.kt deleted file mode 100644 index fc877a9..0000000 --- a/src/main/kotlin/io/appwrite/models/ColumnIndexList.kt +++ /dev/null @@ -1,38 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * Column Indexes List - */ -data class ColumnIndexList( - /** - * Total number of indexes rows that matched your query. - */ - @SerializedName("total") - val total: Long, - - /** - * List of indexes. - */ - @SerializedName("indexes") - val indexes: List, - -) { - fun toMap(): Map = mapOf( - "total" to total as Any, - "indexes" to indexes.map { it.toMap() } as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = ColumnIndexList( - total = (map["total"] as Number).toLong(), - indexes = (map["indexes"] as List>).map { ColumnIndex.from(map = it) }, - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnInteger.kt b/src/main/kotlin/io/appwrite/models/ColumnInteger.kt deleted file mode 100644 index 0545ec5..0000000 --- a/src/main/kotlin/io/appwrite/models/ColumnInteger.kt +++ /dev/null @@ -1,110 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * ColumnInteger - */ -data class ColumnInteger( - /** - * 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, - - /** - * Minimum value to enforce for new documents. - */ - @SerializedName("min") - var min: Long?, - - /** - * Maximum value to enforce for new documents. - */ - @SerializedName("max") - var max: Long?, - - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - @SerializedName("default") - var default: Long?, - -) { - 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, - "min" to min as Any, - "max" to max as Any, - "default" to default as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = ColumnInteger( - 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, - min = (map["min"] as? Number)?.toLong(), - max = (map["max"] as? Number)?.toLong(), - default = (map["default"] as? Number)?.toLong(), - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnIp.kt b/src/main/kotlin/io/appwrite/models/ColumnIp.kt deleted file mode 100644 index dad7442..0000000 --- a/src/main/kotlin/io/appwrite/models/ColumnIp.kt +++ /dev/null @@ -1,102 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * ColumnIP - */ -data class ColumnIp( - /** - * 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, - - /** - * String format. - */ - @SerializedName("format") - val format: String, - - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - @SerializedName("default") - var default: String?, - -) { - 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, - "format" to format as Any, - "default" to default as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = ColumnIp( - 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, - format = map["format"] as String, - default = map["default"] as? String?, - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnList.kt b/src/main/kotlin/io/appwrite/models/ColumnList.kt deleted file mode 100644 index 06e8bd4..0000000 --- a/src/main/kotlin/io/appwrite/models/ColumnList.kt +++ /dev/null @@ -1,38 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * Columns List - */ -data class ColumnList( - /** - * Total number of columns in the given table. - */ - @SerializedName("total") - val total: Long, - - /** - * List of columns. - */ - @SerializedName("columns") - val columns: List, - -) { - fun toMap(): Map = mapOf( - "total" to total as Any, - "columns" to columns as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = ColumnList( - total = (map["total"] as Number).toLong(), - columns = map["columns"] as List, - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnRelationship.kt b/src/main/kotlin/io/appwrite/models/ColumnRelationship.kt deleted file mode 100644 index 5524b42..0000000 --- a/src/main/kotlin/io/appwrite/models/ColumnRelationship.kt +++ /dev/null @@ -1,134 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * ColumnRelationship - */ -data class ColumnRelationship( - /** - * 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, - - /** - * The ID of the related table. - */ - @SerializedName("relatedTable") - val relatedTable: String, - - /** - * The type of the relationship. - */ - @SerializedName("relationType") - val relationType: String, - - /** - * Is the relationship two-way? - */ - @SerializedName("twoWay") - val twoWay: Boolean, - - /** - * The key of the two-way relationship. - */ - @SerializedName("twoWayKey") - val twoWayKey: String, - - /** - * How deleting the parent document will propagate to child documents. - */ - @SerializedName("onDelete") - val onDelete: String, - - /** - * Whether this is the parent or child side of the relationship - */ - @SerializedName("side") - val side: String, - -) { - 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, - "relatedTable" to relatedTable as Any, - "relationType" to relationType as Any, - "twoWay" to twoWay as Any, - "twoWayKey" to twoWayKey as Any, - "onDelete" to onDelete as Any, - "side" to side as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = ColumnRelationship( - 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, - relatedTable = map["relatedTable"] as String, - relationType = map["relationType"] as String, - twoWay = map["twoWay"] as Boolean, - twoWayKey = map["twoWayKey"] as String, - onDelete = map["onDelete"] as String, - side = map["side"] as String, - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnString.kt b/src/main/kotlin/io/appwrite/models/ColumnString.kt deleted file mode 100644 index 773a8ce..0000000 --- a/src/main/kotlin/io/appwrite/models/ColumnString.kt +++ /dev/null @@ -1,110 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * ColumnString - */ -data class ColumnString( - /** - * 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, - - /** - * Column size. - */ - @SerializedName("size") - val size: Long, - - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - @SerializedName("default") - var default: String?, - - /** - * Defines whether this column is encrypted or not. - */ - @SerializedName("encrypt") - var encrypt: Boolean?, - -) { - 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, - "size" to size as Any, - "default" to default as Any, - "encrypt" to encrypt as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = ColumnString( - 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, - size = (map["size"] as Number).toLong(), - default = map["default"] as? String?, - encrypt = map["encrypt"] as? Boolean?, - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnUrl.kt b/src/main/kotlin/io/appwrite/models/ColumnUrl.kt deleted file mode 100644 index 10cd5d9..0000000 --- a/src/main/kotlin/io/appwrite/models/ColumnUrl.kt +++ /dev/null @@ -1,102 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * ColumnURL - */ -data class ColumnUrl( - /** - * 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, - - /** - * String format. - */ - @SerializedName("format") - val format: String, - - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - @SerializedName("default") - var default: String?, - -) { - 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, - "format" to format as Any, - "default" to default as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = ColumnUrl( - 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, - format = map["format"] as String, - default = map["default"] as? String?, - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ContinentList.kt b/src/main/kotlin/io/appwrite/models/ContinentList.kt index a6ec310..fdd490a 100644 --- a/src/main/kotlin/io/appwrite/models/ContinentList.kt +++ b/src/main/kotlin/io/appwrite/models/ContinentList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class ContinentList( /** - * Total number of continents rows that matched your query. + * Total number of continents documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/CountryList.kt b/src/main/kotlin/io/appwrite/models/CountryList.kt index 546cf73..350a894 100644 --- a/src/main/kotlin/io/appwrite/models/CountryList.kt +++ b/src/main/kotlin/io/appwrite/models/CountryList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class CountryList( /** - * Total number of countries rows that matched your query. + * Total number of countries documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/CurrencyList.kt b/src/main/kotlin/io/appwrite/models/CurrencyList.kt index 95dec92..fe1e001 100644 --- a/src/main/kotlin/io/appwrite/models/CurrencyList.kt +++ b/src/main/kotlin/io/appwrite/models/CurrencyList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class CurrencyList( /** - * Total number of currencies rows that matched your query. + * Total number of currencies documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/DatabaseList.kt b/src/main/kotlin/io/appwrite/models/DatabaseList.kt index 3b98e29..81c91aa 100644 --- a/src/main/kotlin/io/appwrite/models/DatabaseList.kt +++ b/src/main/kotlin/io/appwrite/models/DatabaseList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class DatabaseList( /** - * Total number of databases rows that matched your query. + * Total number of databases documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/DeploymentList.kt b/src/main/kotlin/io/appwrite/models/DeploymentList.kt index 3bc6f49..2b7cf64 100644 --- a/src/main/kotlin/io/appwrite/models/DeploymentList.kt +++ b/src/main/kotlin/io/appwrite/models/DeploymentList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class DeploymentList( /** - * Total number of deployments rows that matched your query. + * Total number of deployments documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/DocumentList.kt b/src/main/kotlin/io/appwrite/models/DocumentList.kt index 6f40579..fa3dd20 100644 --- a/src/main/kotlin/io/appwrite/models/DocumentList.kt +++ b/src/main/kotlin/io/appwrite/models/DocumentList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class DocumentList( /** - * Total number of documents rows that matched your query. + * Total number of documents documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/ExecutionList.kt b/src/main/kotlin/io/appwrite/models/ExecutionList.kt index ac11e4f..322aeee 100644 --- a/src/main/kotlin/io/appwrite/models/ExecutionList.kt +++ b/src/main/kotlin/io/appwrite/models/ExecutionList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class ExecutionList( /** - * Total number of executions rows that matched your query. + * Total number of executions documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/FileList.kt b/src/main/kotlin/io/appwrite/models/FileList.kt index ba69ea8..5af18f1 100644 --- a/src/main/kotlin/io/appwrite/models/FileList.kt +++ b/src/main/kotlin/io/appwrite/models/FileList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class FileList( /** - * Total number of files rows that matched your query. + * Total number of files documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/FrameworkList.kt b/src/main/kotlin/io/appwrite/models/FrameworkList.kt index 243bc0f..41532c8 100644 --- a/src/main/kotlin/io/appwrite/models/FrameworkList.kt +++ b/src/main/kotlin/io/appwrite/models/FrameworkList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class FrameworkList( /** - * Total number of frameworks rows that matched your query. + * Total number of frameworks documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/FunctionList.kt b/src/main/kotlin/io/appwrite/models/FunctionList.kt index 7ffe820..6aaa86a 100644 --- a/src/main/kotlin/io/appwrite/models/FunctionList.kt +++ b/src/main/kotlin/io/appwrite/models/FunctionList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class FunctionList( /** - * Total number of functions rows that matched your query. + * Total number of functions documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/IdentityList.kt b/src/main/kotlin/io/appwrite/models/IdentityList.kt index 2e1a33a..1cbb07d 100644 --- a/src/main/kotlin/io/appwrite/models/IdentityList.kt +++ b/src/main/kotlin/io/appwrite/models/IdentityList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class IdentityList( /** - * Total number of identities rows that matched your query. + * Total number of identities documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/IndexList.kt b/src/main/kotlin/io/appwrite/models/IndexList.kt index 1c2120a..a14167d 100644 --- a/src/main/kotlin/io/appwrite/models/IndexList.kt +++ b/src/main/kotlin/io/appwrite/models/IndexList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class IndexList( /** - * Total number of indexes rows that matched your query. + * Total number of indexes documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/LanguageList.kt b/src/main/kotlin/io/appwrite/models/LanguageList.kt index ab78452..07559b9 100644 --- a/src/main/kotlin/io/appwrite/models/LanguageList.kt +++ b/src/main/kotlin/io/appwrite/models/LanguageList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class LanguageList( /** - * Total number of languages rows that matched your query. + * Total number of languages documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/LocaleCodeList.kt b/src/main/kotlin/io/appwrite/models/LocaleCodeList.kt index 6f47333..3973a03 100644 --- a/src/main/kotlin/io/appwrite/models/LocaleCodeList.kt +++ b/src/main/kotlin/io/appwrite/models/LocaleCodeList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class LocaleCodeList( /** - * Total number of localeCodes rows that matched your query. + * Total number of localeCodes documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/LogList.kt b/src/main/kotlin/io/appwrite/models/LogList.kt index d2e0b00..b9f381c 100644 --- a/src/main/kotlin/io/appwrite/models/LogList.kt +++ b/src/main/kotlin/io/appwrite/models/LogList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class LogList( /** - * Total number of logs rows that matched your query. + * Total number of logs documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/MembershipList.kt b/src/main/kotlin/io/appwrite/models/MembershipList.kt index efcffc4..7feaaaa 100644 --- a/src/main/kotlin/io/appwrite/models/MembershipList.kt +++ b/src/main/kotlin/io/appwrite/models/MembershipList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class MembershipList( /** - * Total number of memberships rows that matched your query. + * Total number of memberships documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/MessageList.kt b/src/main/kotlin/io/appwrite/models/MessageList.kt index 1926541..85e4a1b 100644 --- a/src/main/kotlin/io/appwrite/models/MessageList.kt +++ b/src/main/kotlin/io/appwrite/models/MessageList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class MessageList( /** - * Total number of messages rows that matched your query. + * Total number of messages documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/PhoneList.kt b/src/main/kotlin/io/appwrite/models/PhoneList.kt index 675295f..b17de4f 100644 --- a/src/main/kotlin/io/appwrite/models/PhoneList.kt +++ b/src/main/kotlin/io/appwrite/models/PhoneList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class PhoneList( /** - * Total number of phones rows that matched your query. + * Total number of phones documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/ProviderList.kt b/src/main/kotlin/io/appwrite/models/ProviderList.kt index 4223124..113ba67 100644 --- a/src/main/kotlin/io/appwrite/models/ProviderList.kt +++ b/src/main/kotlin/io/appwrite/models/ProviderList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class ProviderList( /** - * Total number of providers rows that matched your query. + * Total number of providers documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/ResourceTokenList.kt b/src/main/kotlin/io/appwrite/models/ResourceTokenList.kt index aaf22f8..bb9e6d7 100644 --- a/src/main/kotlin/io/appwrite/models/ResourceTokenList.kt +++ b/src/main/kotlin/io/appwrite/models/ResourceTokenList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class ResourceTokenList( /** - * Total number of tokens rows that matched your query. + * Total number of tokens documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/Row.kt b/src/main/kotlin/io/appwrite/models/Row.kt deleted file mode 100644 index bb5c14f..0000000 --- a/src/main/kotlin/io/appwrite/models/Row.kt +++ /dev/null @@ -1,105 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * Row - */ -data class Row( - /** - * Row ID. - */ - @SerializedName("\$id") - val id: String, - - /** - * Row automatically incrementing ID. - */ - @SerializedName("\$sequence") - val sequence: Long, - - /** - * Table ID. - */ - @SerializedName("\$tableId") - val tableId: String, - - /** - * Database ID. - */ - @SerializedName("\$databaseId") - val databaseId: String, - - /** - * Row creation date in ISO 8601 format. - */ - @SerializedName("\$createdAt") - val createdAt: String, - - /** - * Row update date in ISO 8601 format. - */ - @SerializedName("\$updatedAt") - val updatedAt: String, - - /** - * Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - @SerializedName("\$permissions") - val permissions: List, - - /** - * Additional properties - */ - @SerializedName("data") - val data: T -) { - fun toMap(): Map = mapOf( - "\$id" to id as Any, - "\$sequence" to sequence as Any, - "\$tableId" to tableId as Any, - "\$databaseId" to databaseId as Any, - "\$createdAt" to createdAt as Any, - "\$updatedAt" to updatedAt as Any, - "\$permissions" to permissions as Any, - "data" to data!!.jsonCast(to = Map::class.java) - ) - - companion object { - operator fun invoke( - id: String, - sequence: Long, - tableId: String, - databaseId: String, - createdAt: String, - updatedAt: String, - permissions: List, - data: Map - ) = Row>( - id, - sequence, - tableId, - databaseId, - createdAt, - updatedAt, - permissions, - data - ) - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - nestedType: Class - ) = Row( - id = map["\$id"] as String, - sequence = (map["\$sequence"] as Number).toLong(), - tableId = map["\$tableId"] as String, - databaseId = map["\$databaseId"] as String, - createdAt = map["\$createdAt"] as String, - updatedAt = map["\$updatedAt"] as String, - permissions = map["\$permissions"] as List, - data = map.jsonCast(to = nestedType) - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/RowList.kt b/src/main/kotlin/io/appwrite/models/RowList.kt deleted file mode 100644 index 289f39b..0000000 --- a/src/main/kotlin/io/appwrite/models/RowList.kt +++ /dev/null @@ -1,46 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * Rows List - */ -data class RowList( - /** - * Total number of rows rows that matched your query. - */ - @SerializedName("total") - val total: Long, - - /** - * List of rows. - */ - @SerializedName("rows") - val rows: List>, - -) { - fun toMap(): Map = mapOf( - "total" to total as Any, - "rows" to rows.map { it.toMap() } as Any, - ) - - companion object { - operator fun invoke( - total: Long, - rows: List>>, - ) = RowList>( - total, - rows, - ) - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - nestedType: Class - ) = RowList( - total = (map["total"] as Number).toLong(), - rows = (map["rows"] as List>).map { Row.from(map = it, nestedType) }, - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/RuntimeList.kt b/src/main/kotlin/io/appwrite/models/RuntimeList.kt index 55c17d9..d08e9a2 100644 --- a/src/main/kotlin/io/appwrite/models/RuntimeList.kt +++ b/src/main/kotlin/io/appwrite/models/RuntimeList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class RuntimeList( /** - * Total number of runtimes rows that matched your query. + * Total number of runtimes documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/SessionList.kt b/src/main/kotlin/io/appwrite/models/SessionList.kt index 13e0c36..c7080e6 100644 --- a/src/main/kotlin/io/appwrite/models/SessionList.kt +++ b/src/main/kotlin/io/appwrite/models/SessionList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class SessionList( /** - * Total number of sessions rows that matched your query. + * Total number of sessions documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/SiteList.kt b/src/main/kotlin/io/appwrite/models/SiteList.kt index 5332571..15ecc7f 100644 --- a/src/main/kotlin/io/appwrite/models/SiteList.kt +++ b/src/main/kotlin/io/appwrite/models/SiteList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class SiteList( /** - * Total number of sites rows that matched your query. + * Total number of sites documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/SpecificationList.kt b/src/main/kotlin/io/appwrite/models/SpecificationList.kt index 5ac8cf9..f504577 100644 --- a/src/main/kotlin/io/appwrite/models/SpecificationList.kt +++ b/src/main/kotlin/io/appwrite/models/SpecificationList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class SpecificationList( /** - * Total number of specifications rows that matched your query. + * Total number of specifications documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/SubscriberList.kt b/src/main/kotlin/io/appwrite/models/SubscriberList.kt index 8f811c7..87181a3 100644 --- a/src/main/kotlin/io/appwrite/models/SubscriberList.kt +++ b/src/main/kotlin/io/appwrite/models/SubscriberList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class SubscriberList( /** - * Total number of subscribers rows that matched your query. + * Total number of subscribers documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/Table.kt b/src/main/kotlin/io/appwrite/models/Table.kt deleted file mode 100644 index 9b43c41..0000000 --- a/src/main/kotlin/io/appwrite/models/Table.kt +++ /dev/null @@ -1,102 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * Table - */ -data class Table( - /** - * Table ID. - */ - @SerializedName("\$id") - val id: String, - - /** - * Table creation date in ISO 8601 format. - */ - @SerializedName("\$createdAt") - val createdAt: String, - - /** - * Table update date in ISO 8601 format. - */ - @SerializedName("\$updatedAt") - val updatedAt: String, - - /** - * Table permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - @SerializedName("\$permissions") - val permissions: List, - - /** - * Database ID. - */ - @SerializedName("databaseId") - val databaseId: String, - - /** - * Table name. - */ - @SerializedName("name") - val name: String, - - /** - * Table enabled. Can be 'enabled' or 'disabled'. When disabled, the table is inaccessible to users, but remains accessible to Server SDKs using API keys. - */ - @SerializedName("enabled") - val enabled: Boolean, - - /** - * Whether row-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - @SerializedName("rowSecurity") - val rowSecurity: Boolean, - - /** - * Table columns. - */ - @SerializedName("columns") - val columns: List, - - /** - * Table indexes. - */ - @SerializedName("indexes") - val indexes: List, - -) { - fun toMap(): Map = mapOf( - "\$id" to id as Any, - "\$createdAt" to createdAt as Any, - "\$updatedAt" to updatedAt as Any, - "\$permissions" to permissions as Any, - "databaseId" to databaseId as Any, - "name" to name as Any, - "enabled" to enabled as Any, - "rowSecurity" to rowSecurity as Any, - "columns" to columns as Any, - "indexes" to indexes.map { it.toMap() } as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = Table( - id = map["\$id"] as String, - createdAt = map["\$createdAt"] as String, - updatedAt = map["\$updatedAt"] as String, - permissions = map["\$permissions"] as List, - databaseId = map["databaseId"] as String, - name = map["name"] as String, - enabled = map["enabled"] as Boolean, - rowSecurity = map["rowSecurity"] as Boolean, - columns = map["columns"] as List, - indexes = (map["indexes"] as List>).map { ColumnIndex.from(map = it) }, - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/TableList.kt b/src/main/kotlin/io/appwrite/models/TableList.kt deleted file mode 100644 index 3ee5afb..0000000 --- a/src/main/kotlin/io/appwrite/models/TableList.kt +++ /dev/null @@ -1,38 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * Tables List - */ -data class TableList( - /** - * Total number of tables rows that matched your query. - */ - @SerializedName("total") - val total: Long, - - /** - * List of tables. - */ - @SerializedName("tables") - val tables: List
, - -) { - fun toMap(): Map = mapOf( - "total" to total as Any, - "tables" to tables.map { it.toMap() } as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = TableList( - total = (map["total"] as Number).toLong(), - tables = (map["tables"] as List>).map { Table.from(map = it) }, - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/TargetList.kt b/src/main/kotlin/io/appwrite/models/TargetList.kt index 8b94727..01470c8 100644 --- a/src/main/kotlin/io/appwrite/models/TargetList.kt +++ b/src/main/kotlin/io/appwrite/models/TargetList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class TargetList( /** - * Total number of targets rows that matched your query. + * Total number of targets documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/TeamList.kt b/src/main/kotlin/io/appwrite/models/TeamList.kt index f1a1968..17ccd6b 100644 --- a/src/main/kotlin/io/appwrite/models/TeamList.kt +++ b/src/main/kotlin/io/appwrite/models/TeamList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class TeamList( /** - * Total number of teams rows that matched your query. + * Total number of teams documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/TopicList.kt b/src/main/kotlin/io/appwrite/models/TopicList.kt index 2a1cc5f..7173fec 100644 --- a/src/main/kotlin/io/appwrite/models/TopicList.kt +++ b/src/main/kotlin/io/appwrite/models/TopicList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class TopicList( /** - * Total number of topics rows that matched your query. + * Total number of topics documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/UserList.kt b/src/main/kotlin/io/appwrite/models/UserList.kt index 3bf322e..efe164f 100644 --- a/src/main/kotlin/io/appwrite/models/UserList.kt +++ b/src/main/kotlin/io/appwrite/models/UserList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class UserList( /** - * Total number of users rows that matched your query. + * Total number of users documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/VariableList.kt b/src/main/kotlin/io/appwrite/models/VariableList.kt index 3f7e430..06004c6 100644 --- a/src/main/kotlin/io/appwrite/models/VariableList.kt +++ b/src/main/kotlin/io/appwrite/models/VariableList.kt @@ -8,7 +8,7 @@ import io.appwrite.extensions.jsonCast */ data class VariableList( /** - * Total number of variables rows that matched your query. + * Total number of variables documents that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/services/Account.kt b/src/main/kotlin/io/appwrite/services/Account.kt index dcfe70d..26494eb 100644 --- a/src/main/kotlin/io/appwrite/services/Account.kt +++ b/src/main/kotlin/io/appwrite/services/Account.kt @@ -1046,9 +1046,6 @@ class Account(client: Client) : Service(client) { * @param secret Valid verification token. * @return [io.appwrite.models.Session] */ - @Deprecated( - message = "This API has been deprecated." - ) @Throws(AppwriteException::class) suspend fun updateMagicURLSession( userId: String, @@ -1083,9 +1080,6 @@ class Account(client: Client) : Service(client) { * @param secret Valid verification token. * @return [io.appwrite.models.Session] */ - @Deprecated( - message = "This API has been deprecated." - ) @Throws(AppwriteException::class) suspend fun updatePhoneSession( userId: String, diff --git a/src/main/kotlin/io/appwrite/services/Databases.kt b/src/main/kotlin/io/appwrite/services/Databases.kt index 688d372..6c57ede 100644 --- a/src/main/kotlin/io/appwrite/services/Databases.kt +++ b/src/main/kotlin/io/appwrite/services/Databases.kt @@ -188,11 +188,6 @@ class Databases(client: Client) : Service(client) { * @param search Search term to filter your list results. Max length: 256 chars. * @return [io.appwrite.models.CollectionList] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.list` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.list"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun listCollections( @@ -233,11 +228,6 @@ class Databases(client: Client) : Service(client) { * @param enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. * @return [io.appwrite.models.Collection] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.create` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.create"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createCollection( @@ -281,11 +271,6 @@ class Databases(client: Client) : Service(client) { * @param collectionId Collection ID. * @return [io.appwrite.models.Collection] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.get` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.get"), - since = "1.8.0" - ) @Throws(AppwriteException::class) suspend fun getCollection( databaseId: String, @@ -323,11 +308,6 @@ class Databases(client: Client) : Service(client) { * @param enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. * @return [io.appwrite.models.Collection] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.update` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.update"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateCollection( @@ -371,11 +351,6 @@ class Databases(client: Client) : Service(client) { * @param collectionId Collection ID. * @return [Any] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.delete` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.delete"), - since = "1.8.0" - ) @Throws(AppwriteException::class) suspend fun deleteCollection( databaseId: String, @@ -403,15 +378,10 @@ class Databases(client: Client) : Service(client) { * List attributes in the collection. * * @param databaseId Database ID. - * @param collectionId Collection 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 queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error * @return [io.appwrite.models.AttributeList] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.listColumns` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.listColumns"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun listAttributes( @@ -445,18 +415,13 @@ class Databases(client: Client) : Service(client) { * Create a boolean attribute. * * @param databaseId Database ID. - * @param collectionId Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @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. Cannot be set when attribute is required. * @param array Is attribute an array? * @return [io.appwrite.models.AttributeBoolean] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.createBooleanColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.createBooleanColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createBooleanAttribute( @@ -497,18 +462,13 @@ class Databases(client: Client) : Service(client) { * Update a boolean 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 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. Cannot be set when attribute is required. * @param newKey New attribute key. * @return [io.appwrite.models.AttributeBoolean] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.updateBooleanColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.updateBooleanColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateBooleanAttribute( @@ -549,18 +509,13 @@ class Databases(client: Client) : Service(client) { * Create a date time attribute according to the ISO 8601 standard. * * @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 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 the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required. * @param array Is attribute an array? * @return [io.appwrite.models.AttributeDatetime] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.createDatetimeColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.createDatetimeColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createDatetimeAttribute( @@ -601,18 +556,13 @@ class Databases(client: Client) : Service(client) { * Update a date time attribute. Changing the `default` value will not update already existing documents. * * @param databaseId Database ID. - * @param collectionId Collection 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. Cannot be set when attribute is required. * @param newKey New attribute key. * @return [io.appwrite.models.AttributeDatetime] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.updateDatetimeColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.updateDatetimeColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateDatetimeAttribute( @@ -653,18 +603,13 @@ class Databases(client: Client) : Service(client) { * Create an email attribute. * * @param databaseId Database ID. - * @param collectionId Collection 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. Cannot be set when attribute is required. * @param array Is attribute an array? * @return [io.appwrite.models.AttributeEmail] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.createEmailColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.createEmailColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createEmailAttribute( @@ -705,18 +650,13 @@ class Databases(client: Client) : Service(client) { * Update an email attribute. Changing the `default` value will not update already existing documents. * * @param databaseId Database ID. - * @param collectionId Collection 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. Cannot be set when attribute is required. - * @param newKey New Attribute Key. + * @param newKey New attribute key. * @return [io.appwrite.models.AttributeEmail] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.updateEmailColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.updateEmailColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateEmailAttribute( @@ -754,22 +694,17 @@ class Databases(client: Client) : Service(client) { } /** - * Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. + * Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute. * * @param databaseId Database ID. - * @param collectionId Collection 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 elements Array of enum values. + * @param elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. * @param required Is attribute required? * @param default Default value for attribute when not provided. Cannot be set when attribute is required. * @param array Is attribute an array? * @return [io.appwrite.models.AttributeEnum] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.createEnumColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.createEnumColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createEnumAttribute( @@ -812,19 +747,14 @@ class Databases(client: Client) : Service(client) { * Update an enum attribute. Changing the `default` value will not update already existing documents. * * @param databaseId Database ID. - * @param collectionId Collection 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 elements Updated list of enum values. + * @param elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. * @param required Is attribute required? * @param default Default value for attribute when not provided. Cannot be set when attribute is required. - * @param newKey New Attribute Key. + * @param newKey New attribute key. * @return [io.appwrite.models.AttributeEnum] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.updateEnumColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.updateEnumColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateEnumAttribute( @@ -867,20 +797,15 @@ class Databases(client: Client) : Service(client) { * Create a float attribute. Optionally, minimum and maximum values can be provided. * * @param databaseId Database ID. - * @param collectionId Collection 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 min Minimum value. - * @param max Maximum value. - * @param default Default value. Cannot be set when required. + * @param min Minimum value to enforce on new documents + * @param max Maximum value to enforce on new documents + * @param default Default value for attribute when not provided. Cannot be set when attribute is required. * @param array Is attribute an array? * @return [io.appwrite.models.AttributeFloat] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.createFloatColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.createFloatColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createFloatAttribute( @@ -925,20 +850,15 @@ class Databases(client: Client) : Service(client) { * Update a float attribute. Changing the `default` value will not update already existing documents. * * @param databaseId Database ID. - * @param collectionId Collection 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. Cannot be set when required. - * @param min Minimum value. - * @param max Maximum value. - * @param newKey New Attribute Key. + * @param default Default value for attribute when not provided. Cannot be set when attribute is required. + * @param min Minimum value to enforce on new documents + * @param max Maximum value to enforce on new documents + * @param newKey New attribute key. * @return [io.appwrite.models.AttributeFloat] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.updateFloatColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.updateFloatColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateFloatAttribute( @@ -983,20 +903,15 @@ class Databases(client: Client) : Service(client) { * Create an integer attribute. Optionally, minimum and maximum values can be provided. * * @param databaseId Database ID. - * @param collectionId Collection 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 min Minimum value - * @param max Maximum value - * @param default Default value. Cannot be set when attribute is required. + * @param min Minimum value to enforce on new documents + * @param max Maximum value to enforce on new documents + * @param default Default value for attribute when not provided. Cannot be set when attribute is required. * @param array Is attribute an array? * @return [io.appwrite.models.AttributeInteger] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.createIntegerColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.createIntegerColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createIntegerAttribute( @@ -1041,20 +956,15 @@ class Databases(client: Client) : Service(client) { * Update an integer attribute. Changing the `default` value will not update already existing documents. * * @param databaseId Database ID. - * @param collectionId Collection 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. Cannot be set when attribute is required. - * @param min Minimum value - * @param max Maximum value - * @param newKey New Attribute Key. + * @param default Default value for attribute when not provided. Cannot be set when attribute is required. + * @param min Minimum value to enforce on new documents + * @param max Maximum value to enforce on new documents + * @param newKey New attribute key. * @return [io.appwrite.models.AttributeInteger] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.updateIntegerColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.updateIntegerColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateIntegerAttribute( @@ -1099,18 +1009,13 @@ class Databases(client: Client) : Service(client) { * Create IP address attribute. * * @param databaseId Database ID. - * @param collectionId Collection 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. Cannot be set when attribute is required. + * @param default Default value for attribute when not provided. Cannot be set when attribute is required. * @param array Is attribute an array? * @return [io.appwrite.models.AttributeIp] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.createIpColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.createIpColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createIpAttribute( @@ -1151,18 +1056,13 @@ class Databases(client: Client) : Service(client) { * Update an ip attribute. Changing the `default` value will not update already existing documents. * * @param databaseId Database ID. - * @param collectionId Collection 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. Cannot be set when attribute is required. - * @param newKey New Attribute Key. + * @param default Default value for attribute when not provided. Cannot be set when attribute is required. + * @param newKey New attribute key. * @return [io.appwrite.models.AttributeIp] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.updateIpColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.updateIpColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateIpAttribute( @@ -1203,8 +1103,8 @@ class Databases(client: Client) : Service(client) { * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). * * @param databaseId Database ID. - * @param collectionId Collection ID. - * @param relatedCollectionId Related Collection 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 relatedCollectionId Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param type Relation type * @param twoWay Is Two Way? * @param key Attribute Key. @@ -1212,11 +1112,6 @@ class Databases(client: Client) : Service(client) { * @param onDelete Constraints option * @return [io.appwrite.models.AttributeRelationship] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.createRelationshipColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.createRelationshipColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createRelationshipAttribute( @@ -1261,7 +1156,7 @@ class Databases(client: Client) : Service(client) { * Create a string attribute. * * @param databaseId Database ID. - * @param collectionId Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @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 size Attribute size for text attributes, in number of characters. * @param required Is attribute required? @@ -1270,11 +1165,6 @@ class Databases(client: Client) : Service(client) { * @param encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. * @return [io.appwrite.models.AttributeString] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.createStringColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.createStringColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createStringAttribute( @@ -1319,19 +1209,14 @@ class Databases(client: Client) : Service(client) { * Update a string attribute. Changing the `default` value will not update already existing documents. * * @param databaseId Database ID. - * @param collectionId Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @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. Cannot be set when attribute is required. * @param size Maximum size of the string attribute. - * @param newKey New Attribute Key. + * @param newKey New attribute key. * @return [io.appwrite.models.AttributeString] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.updateStringColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.updateStringColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateStringAttribute( @@ -1374,18 +1259,13 @@ class Databases(client: Client) : Service(client) { * Create a URL attribute. * * @param databaseId Database ID. - * @param collectionId Collection 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. Cannot be set when attribute is required. * @param array Is attribute an array? * @return [io.appwrite.models.AttributeUrl] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.createUrlColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.createUrlColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createUrlAttribute( @@ -1426,18 +1306,13 @@ class Databases(client: Client) : Service(client) { * Update an url attribute. Changing the `default` value will not update already existing documents. * * @param databaseId Database ID. - * @param collectionId Collection 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. Cannot be set when attribute is required. - * @param newKey New Attribute Key. + * @param newKey New attribute key. * @return [io.appwrite.models.AttributeUrl] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.updateUrlColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.updateUrlColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateUrlAttribute( @@ -1478,15 +1353,10 @@ class Databases(client: Client) : Service(client) { * Get attribute by ID. * * @param databaseId Database ID. - * @param collectionId Collection 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. * @return [Any] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.getColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.getColumn"), - since = "1.8.0" - ) @Throws(AppwriteException::class) suspend fun getAttribute( databaseId: String, @@ -1515,15 +1385,10 @@ class Databases(client: Client) : Service(client) { * Deletes an attribute. * * @param databaseId Database ID. - * @param collectionId Collection 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. * @return [Any] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.deleteColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.deleteColumn"), - since = "1.8.0" - ) @Throws(AppwriteException::class) suspend fun deleteAttribute( databaseId: String, @@ -1553,17 +1418,12 @@ class Databases(client: Client) : Service(client) { * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). * * @param databaseId Database ID. - * @param collectionId Collection 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 onDelete Constraints option - * @param newKey New Attribute Key. + * @param newKey New attribute key. * @return [io.appwrite.models.AttributeRelationship] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.updateRelationshipColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.updateRelationshipColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateRelationshipAttribute( @@ -1606,11 +1466,6 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @return [io.appwrite.models.DocumentList] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.listRows` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.listRows"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun listDocuments( @@ -1649,11 +1504,6 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @return [io.appwrite.models.DocumentList] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.listRows` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.listRows"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun listDocuments( @@ -1677,11 +1527,6 @@ class Databases(client: Client) : Service(client) { * @param permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). * @return [io.appwrite.models.Document] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.createRow` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.createRow"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createDocument( @@ -1727,11 +1572,6 @@ class Databases(client: Client) : Service(client) { * @param permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). * @return [io.appwrite.models.Document] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.createRow` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.createRow"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createDocument( @@ -1757,11 +1597,6 @@ class Databases(client: Client) : Service(client) { * @param documents Array of documents data as JSON objects. * @return [io.appwrite.models.DocumentList] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.createRow` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.createRow"), - since = "1.8.0" - ) @Throws(AppwriteException::class) suspend fun createDocuments( databaseId: String, @@ -1800,11 +1635,6 @@ class Databases(client: Client) : Service(client) { * @param documents Array of documents data as JSON objects. * @return [io.appwrite.models.DocumentList] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.createRow` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.createRow"), - since = "1.8.0" - ) @Throws(AppwriteException::class) suspend fun createDocuments( databaseId: String, @@ -1822,17 +1652,14 @@ class Databases(client: Client) : Service(client) { * * @param databaseId Database ID. * @param collectionId Collection ID. + * @param documents Array of document data as JSON objects. May contain partial documents. * @return [io.appwrite.models.DocumentList] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.upsertRows` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.upsertRows"), - since = "1.8.0" - ) @Throws(AppwriteException::class) suspend fun upsertDocuments( databaseId: String, collectionId: String, + documents: List, nestedType: Class, ): io.appwrite.models.DocumentList { val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents" @@ -1840,6 +1667,7 @@ class Databases(client: Client) : Service(client) { .replace("{collectionId}", collectionId) val apiParams = mutableMapOf( + "documents" to documents, ) val apiHeaders = mutableMapOf( "content-type" to "application/json", @@ -1862,20 +1690,18 @@ class Databases(client: Client) : Service(client) { * * @param databaseId Database ID. * @param collectionId Collection ID. + * @param documents Array of document data as JSON objects. May contain partial documents. * @return [io.appwrite.models.DocumentList] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.upsertRows` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.upsertRows"), - since = "1.8.0" - ) @Throws(AppwriteException::class) suspend fun upsertDocuments( databaseId: String, collectionId: String, + documents: List, ): io.appwrite.models.DocumentList> = upsertDocuments( databaseId, collectionId, + documents, nestedType = classOf(), ) @@ -1888,11 +1714,6 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @return [io.appwrite.models.DocumentList] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.updateRows` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.updateRows"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateDocuments( @@ -1935,11 +1756,6 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @return [io.appwrite.models.DocumentList] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.updateRows` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.updateRows"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateDocuments( @@ -1963,11 +1779,6 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @return [io.appwrite.models.DocumentList] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.deleteRows` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.deleteRows"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun deleteDocuments( @@ -2007,11 +1818,6 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @return [io.appwrite.models.DocumentList] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.deleteRows` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.deleteRows"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun deleteDocuments( @@ -2034,11 +1840,6 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @return [io.appwrite.models.Document] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.getRow` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.getRow"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun getDocument( @@ -2080,11 +1881,6 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @return [io.appwrite.models.Document] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.getRow` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.getRow"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun getDocument( @@ -2106,18 +1902,18 @@ class Databases(client: Client) : Service(client) { * @param databaseId Database ID. * @param collectionId Collection ID. * @param documentId Document ID. + * @param data Document data as JSON object. Include all required attributes of the document to be created or updated. + * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @return [io.appwrite.models.Document] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.upsertRow` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.upsertRow"), - since = "1.8.0" - ) + @JvmOverloads @Throws(AppwriteException::class) suspend fun upsertDocument( databaseId: String, collectionId: String, documentId: String, + data: Any, + permissions: List? = null, nestedType: Class, ): io.appwrite.models.Document { val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" @@ -2126,6 +1922,8 @@ class Databases(client: Client) : Service(client) { .replace("{documentId}", documentId) val apiParams = mutableMapOf( + "data" to data, + "permissions" to permissions, ) val apiHeaders = mutableMapOf( "content-type" to "application/json", @@ -2149,22 +1947,24 @@ class Databases(client: Client) : Service(client) { * @param databaseId Database ID. * @param collectionId Collection ID. * @param documentId Document ID. + * @param data Document data as JSON object. Include all required attributes of the document to be created or updated. + * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @return [io.appwrite.models.Document] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.upsertRow` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.upsertRow"), - since = "1.8.0" - ) + @JvmOverloads @Throws(AppwriteException::class) suspend fun upsertDocument( databaseId: String, collectionId: String, documentId: String, + data: Any, + permissions: List? = null, ): io.appwrite.models.Document> = upsertDocument( databaseId, collectionId, documentId, + data, + permissions, nestedType = classOf(), ) @@ -2178,11 +1978,6 @@ class Databases(client: Client) : Service(client) { * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @return [io.appwrite.models.Document] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.updateRow` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.updateRow"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateDocument( @@ -2228,11 +2023,6 @@ class Databases(client: Client) : Service(client) { * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @return [io.appwrite.models.Document] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.updateRow` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.updateRow"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateDocument( @@ -2258,11 +2048,6 @@ class Databases(client: Client) : Service(client) { * @param documentId Document ID. * @return [Any] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.deleteRow` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.deleteRow"), - since = "1.8.0" - ) @Throws(AppwriteException::class) suspend fun deleteDocument( databaseId: String, @@ -2295,15 +2080,10 @@ class Databases(client: Client) : Service(client) { * @param collectionId Collection ID. * @param documentId Document ID. * @param attribute Attribute key. - * @param value Value to increment the attribute by. The value must be a number. + * @param value Value to decrement the attribute by. The value must be a number. * @param min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. * @return [io.appwrite.models.Document] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.decrementRowColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.decrementRowColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun decrementDocumentAttribute( @@ -2348,15 +2128,10 @@ class Databases(client: Client) : Service(client) { * @param collectionId Collection ID. * @param documentId Document ID. * @param attribute Attribute key. - * @param value Value to increment the attribute by. The value must be a number. + * @param value Value to decrement the attribute by. The value must be a number. * @param min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. * @return [io.appwrite.models.Document] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.decrementRowColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.decrementRowColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun decrementDocumentAttribute( @@ -2387,11 +2162,6 @@ class Databases(client: Client) : Service(client) { * @param max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. * @return [io.appwrite.models.Document] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.incrementRowColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.incrementRowColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun incrementDocumentAttribute( @@ -2440,11 +2210,6 @@ class Databases(client: Client) : Service(client) { * @param max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. * @return [io.appwrite.models.Document] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.incrementRowColumn` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.incrementRowColumn"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun incrementDocumentAttribute( @@ -2472,11 +2237,6 @@ class Databases(client: Client) : Service(client) { * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error * @return [io.appwrite.models.IndexList] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.listIndexes` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.listIndexes"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun listIndexes( @@ -2518,11 +2278,6 @@ class Databases(client: Client) : Service(client) { * @param lengths Length of index. Maximum of 100 * @return [io.appwrite.models.Index] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.createIndex` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.createIndex"), - since = "1.8.0" - ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createIndex( @@ -2569,11 +2324,6 @@ class Databases(client: Client) : Service(client) { * @param key Index Key. * @return [io.appwrite.models.Index] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.getIndex` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.getIndex"), - since = "1.8.0" - ) @Throws(AppwriteException::class) suspend fun getIndex( databaseId: String, @@ -2610,11 +2360,6 @@ class Databases(client: Client) : Service(client) { * @param key Index Key. * @return [Any] */ - @Deprecated( - message = "This API has been deprecated since 1.8.0. Please use `Tables.deleteIndex` instead.", - replaceWith = ReplaceWith("io.appwrite.services.Tables.deleteIndex"), - since = "1.8.0" - ) @Throws(AppwriteException::class) suspend fun deleteIndex( databaseId: String, diff --git a/src/main/kotlin/io/appwrite/services/Tables.kt b/src/main/kotlin/io/appwrite/services/Tables.kt deleted file mode 100644 index 027b003..0000000 --- a/src/main/kotlin/io/appwrite/services/Tables.kt +++ /dev/null @@ -1,2201 +0,0 @@ -package io.appwrite.services - -import io.appwrite.Client -import io.appwrite.models.* -import io.appwrite.enums.* -import io.appwrite.exceptions.AppwriteException -import io.appwrite.extensions.classOf -import okhttp3.Cookie -import java.io.File - -/** - * The Tables service allows you to create structured tables of rows, query and filter lists of rows -**/ -class Tables(client: Client) : Service(client) { - - /** - * Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. - * - * @param databaseId Database ID. - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, rowSecurity - * @param search Search term to filter your list results. Max length: 256 chars. - * @return [io.appwrite.models.TableList] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun list( - databaseId: String, - queries: List? = null, - search: String? = null, - ): io.appwrite.models.TableList { - val apiPath = "/databases/{databaseId}/tables" - .replace("{databaseId}", databaseId) - - val apiParams = mutableMapOf( - "queries" to queries, - "search" to search, - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.TableList = { - io.appwrite.models.TableList.from(map = it as Map) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.TableList::class.java, - converter, - ) - } - - /** - * Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - * - * @param databaseId Database ID. - * @param tableId Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param name Table name. Max length: 128 chars. - * @param permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param rowSecurity Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param enabled Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. - * @return [io.appwrite.models.Table] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun create( - databaseId: String, - tableId: String, - name: String, - permissions: List? = null, - rowSecurity: Boolean? = null, - enabled: Boolean? = null, - ): io.appwrite.models.Table { - val apiPath = "/databases/{databaseId}/tables" - .replace("{databaseId}", databaseId) - - val apiParams = mutableMapOf( - "tableId" to tableId, - "name" to name, - "permissions" to permissions, - "rowSecurity" to rowSecurity, - "enabled" to enabled, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Table = { - io.appwrite.models.Table.from(map = it as Map) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.Table::class.java, - converter, - ) - } - - /** - * Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @return [io.appwrite.models.Table] - */ - @Throws(AppwriteException::class) - suspend fun get( - databaseId: String, - tableId: String, - ): io.appwrite.models.Table { - val apiPath = "/databases/{databaseId}/tables/{tableId}" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.Table = { - io.appwrite.models.Table.from(map = it as Map) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.Table::class.java, - converter, - ) - } - - /** - * Update a table by its unique ID. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param name Table name. Max length: 128 chars. - * @param permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param rowSecurity Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param enabled Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. - * @return [io.appwrite.models.Table] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun update( - databaseId: String, - tableId: String, - name: String, - permissions: List? = null, - rowSecurity: Boolean? = null, - enabled: Boolean? = null, - ): io.appwrite.models.Table { - val apiPath = "/databases/{databaseId}/tables/{tableId}" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "name" to name, - "permissions" to permissions, - "rowSecurity" to rowSecurity, - "enabled" to enabled, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Table = { - io.appwrite.models.Table.from(map = it as Map) - } - return client.call( - "PUT", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.Table::class.java, - converter, - ) - } - - /** - * Delete a table by its unique ID. Only users with write permissions have access to delete this resource. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @return [Any] - */ - @Throws(AppwriteException::class) - suspend fun delete( - databaseId: String, - tableId: String, - ): Any { - val apiPath = "/databases/{databaseId}/tables/{tableId}" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - return client.call( - "DELETE", - apiPath, - apiHeaders, - apiParams, - responseType = Any::class.java, - ) - } - - /** - * List attributes in the collection. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error - * @return [io.appwrite.models.ColumnList] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun listColumns( - databaseId: String, - tableId: String, - queries: List? = null, - ): io.appwrite.models.ColumnList { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "queries" to queries, - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.ColumnList = { - io.appwrite.models.ColumnList.from(map = it as Map) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnList::class.java, - converter, - ) - } - - /** - * Create a boolean column. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - * @param key Column Key. - * @param required Is column required? - * @param default Default value for column when not provided. Cannot be set when column is required. - * @param array Is column an array? - * @return [io.appwrite.models.ColumnBoolean] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun createBooleanColumn( - databaseId: String, - tableId: String, - key: String, - required: Boolean, - default: Boolean? = null, - array: Boolean? = null, - ): io.appwrite.models.ColumnBoolean { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/boolean" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "key" to key, - "required" to required, - "default" to default, - "array" to array, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.ColumnBoolean = { - io.appwrite.models.ColumnBoolean.from(map = it as Map) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnBoolean::class.java, - converter, - ) - } - - /** - * Update a boolean 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 Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - * @param key Column Key. - * @param required Is column required? - * @param default Default value for column when not provided. Cannot be set when column is required. - * @param newKey New Column Key. - * @return [io.appwrite.models.ColumnBoolean] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updateBooleanColumn( - databaseId: String, - tableId: String, - key: String, - required: Boolean, - default: Boolean? = null, - newKey: String? = null, - ): io.appwrite.models.ColumnBoolean { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/boolean/{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.ColumnBoolean = { - io.appwrite.models.ColumnBoolean.from(map = it as Map) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnBoolean::class.java, - converter, - ) - } - - /** - * Create a date time column according to the ISO 8601 standard. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @param required Is column required? - * @param default Default value for the column in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when column is required. - * @param array Is column an array? - * @return [io.appwrite.models.ColumnDatetime] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun createDatetimeColumn( - databaseId: String, - tableId: String, - key: String, - required: Boolean, - default: String? = null, - array: Boolean? = null, - ): io.appwrite.models.ColumnDatetime { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/datetime" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "key" to key, - "required" to required, - "default" to default, - "array" to array, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.ColumnDatetime = { - io.appwrite.models.ColumnDatetime.from(map = it as Map) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnDatetime::class.java, - converter, - ) - } - - /** - * Update a date time column. Changing the `default` value will not update already existing rows. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @param required Is column required? - * @param default Default value for column when not provided. Cannot be set when column is required. - * @param newKey New Column Key. - * @return [io.appwrite.models.ColumnDatetime] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updateDatetimeColumn( - databaseId: String, - tableId: String, - key: String, - required: Boolean, - default: String? = null, - newKey: String? = null, - ): io.appwrite.models.ColumnDatetime { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/datetime/{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.ColumnDatetime = { - io.appwrite.models.ColumnDatetime.from(map = it as Map) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnDatetime::class.java, - converter, - ) - } - - /** - * Create an email column. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @param required Is column required? - * @param default Default value for column when not provided. Cannot be set when column is required. - * @param array Is column an array? - * @return [io.appwrite.models.ColumnEmail] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun createEmailColumn( - databaseId: String, - tableId: String, - key: String, - required: Boolean, - default: String? = null, - array: Boolean? = null, - ): io.appwrite.models.ColumnEmail { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/email" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "key" to key, - "required" to required, - "default" to default, - "array" to array, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.ColumnEmail = { - io.appwrite.models.ColumnEmail.from(map = it as Map) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnEmail::class.java, - converter, - ) - } - - /** - * Update an email column. Changing the `default` value will not update already existing rows. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @param required Is column required? - * @param default Default value for column when not provided. Cannot be set when column is required. - * @param newKey New Column Key. - * @return [io.appwrite.models.ColumnEmail] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updateEmailColumn( - databaseId: String, - tableId: String, - key: String, - required: Boolean, - default: String? = null, - newKey: String? = null, - ): io.appwrite.models.ColumnEmail { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/email/{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.ColumnEmail = { - io.appwrite.models.ColumnEmail.from(map = it as Map) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnEmail::class.java, - converter, - ) - } - - /** - * Create an enumeration column. The `elements` param acts as a white-list of accepted values for this column. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @param elements Array of enum values. - * @param required Is column required? - * @param default Default value for column when not provided. Cannot be set when column is required. - * @param array Is column an array? - * @return [io.appwrite.models.ColumnEnum] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun createEnumColumn( - databaseId: String, - tableId: String, - key: String, - elements: List, - required: Boolean, - default: String? = null, - array: Boolean? = null, - ): io.appwrite.models.ColumnEnum { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/enum" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "key" to key, - "elements" to elements, - "required" to required, - "default" to default, - "array" to array, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.ColumnEnum = { - io.appwrite.models.ColumnEnum.from(map = it as Map) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnEnum::class.java, - converter, - ) - } - - /** - * Update an enum column. Changing the `default` value will not update already existing rows. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @param elements Updated list of enum values. - * @param required Is column required? - * @param default Default value for column when not provided. Cannot be set when column is required. - * @param newKey New Column Key. - * @return [io.appwrite.models.ColumnEnum] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updateEnumColumn( - databaseId: String, - tableId: String, - key: String, - elements: List, - required: Boolean, - default: String? = null, - newKey: String? = null, - ): io.appwrite.models.ColumnEnum { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/enum/{key}" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - .replace("{key}", key) - - val apiParams = mutableMapOf( - "elements" to elements, - "required" to required, - "default" to default, - "newKey" to newKey, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.ColumnEnum = { - io.appwrite.models.ColumnEnum.from(map = it as Map) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnEnum::class.java, - converter, - ) - } - - /** - * Create a float column. Optionally, minimum and maximum values can be provided. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @param required Is column required? - * @param min Minimum value - * @param max Maximum value - * @param default Default value. Cannot be set when required. - * @param array Is column an array? - * @return [io.appwrite.models.ColumnFloat] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun createFloatColumn( - databaseId: String, - tableId: String, - key: String, - required: Boolean, - min: Double? = null, - max: Double? = null, - default: Double? = null, - array: Boolean? = null, - ): io.appwrite.models.ColumnFloat { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/float" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "key" to key, - "required" to required, - "min" to min, - "max" to max, - "default" to default, - "array" to array, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.ColumnFloat = { - io.appwrite.models.ColumnFloat.from(map = it as Map) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnFloat::class.java, - converter, - ) - } - - /** - * Update a float column. Changing the `default` value will not update already existing rows. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @param required Is column required? - * @param default Default value. Cannot be set when required. - * @param min Minimum value - * @param max Maximum value - * @param newKey New Column Key. - * @return [io.appwrite.models.ColumnFloat] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updateFloatColumn( - databaseId: String, - tableId: String, - key: String, - required: Boolean, - default: Double? = null, - min: Double? = null, - max: Double? = null, - newKey: String? = null, - ): io.appwrite.models.ColumnFloat { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/float/{key}" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - .replace("{key}", key) - - val apiParams = mutableMapOf( - "required" to required, - "min" to min, - "max" to max, - "default" to default, - "newKey" to newKey, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.ColumnFloat = { - io.appwrite.models.ColumnFloat.from(map = it as Map) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnFloat::class.java, - converter, - ) - } - - /** - * Create an integer column. Optionally, minimum and maximum values can be provided. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @param required Is column required? - * @param min Minimum value - * @param max Maximum value - * @param default Default value. Cannot be set when column is required. - * @param array Is column an array? - * @return [io.appwrite.models.ColumnInteger] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun createIntegerColumn( - databaseId: String, - tableId: String, - key: String, - required: Boolean, - min: Long? = null, - max: Long? = null, - default: Long? = null, - array: Boolean? = null, - ): io.appwrite.models.ColumnInteger { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/integer" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "key" to key, - "required" to required, - "min" to min, - "max" to max, - "default" to default, - "array" to array, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.ColumnInteger = { - io.appwrite.models.ColumnInteger.from(map = it as Map) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnInteger::class.java, - converter, - ) - } - - /** - * Update an integer column. Changing the `default` value will not update already existing rows. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @param required Is column required? - * @param default Default value. Cannot be set when column is required. - * @param min Minimum value - * @param max Maximum value - * @param newKey New Column Key. - * @return [io.appwrite.models.ColumnInteger] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updateIntegerColumn( - databaseId: String, - tableId: String, - key: String, - required: Boolean, - default: Long? = null, - min: Long? = null, - max: Long? = null, - newKey: String? = null, - ): io.appwrite.models.ColumnInteger { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/integer/{key}" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - .replace("{key}", key) - - val apiParams = mutableMapOf( - "required" to required, - "min" to min, - "max" to max, - "default" to default, - "newKey" to newKey, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.ColumnInteger = { - io.appwrite.models.ColumnInteger.from(map = it as Map) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnInteger::class.java, - converter, - ) - } - - /** - * Create IP address column. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @param required Is column required? - * @param default Default value. Cannot be set when column is required. - * @param array Is column an array? - * @return [io.appwrite.models.ColumnIp] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun createIpColumn( - databaseId: String, - tableId: String, - key: String, - required: Boolean, - default: String? = null, - array: Boolean? = null, - ): io.appwrite.models.ColumnIp { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/ip" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "key" to key, - "required" to required, - "default" to default, - "array" to array, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.ColumnIp = { - io.appwrite.models.ColumnIp.from(map = it as Map) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnIp::class.java, - converter, - ) - } - - /** - * Update an ip column. Changing the `default` value will not update already existing rows. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @param required Is column required? - * @param default Default value. Cannot be set when column is required. - * @param newKey New Column Key. - * @return [io.appwrite.models.ColumnIp] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updateIpColumn( - databaseId: String, - tableId: String, - key: String, - required: Boolean, - default: String? = null, - newKey: String? = null, - ): io.appwrite.models.ColumnIp { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/ip/{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.ColumnIp = { - io.appwrite.models.ColumnIp.from(map = it as Map) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnIp::class.java, - converter, - ) - } - - /** - * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param relatedTableId Related Table ID. - * @param type Relation type - * @param twoWay Is Two Way? - * @param key Column Key. - * @param twoWayKey Two Way Column Key. - * @param onDelete Constraints option - * @return [io.appwrite.models.ColumnRelationship] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun createRelationshipColumn( - databaseId: String, - tableId: String, - relatedTableId: String, - type: io.appwrite.enums.RelationshipType, - twoWay: Boolean? = null, - key: String? = null, - twoWayKey: String? = null, - onDelete: io.appwrite.enums.RelationMutate? = null, - ): io.appwrite.models.ColumnRelationship { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/relationship" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "relatedTableId" to relatedTableId, - "type" to type, - "twoWay" to twoWay, - "key" to key, - "twoWayKey" to twoWayKey, - "onDelete" to onDelete, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.ColumnRelationship = { - io.appwrite.models.ColumnRelationship.from(map = it as Map) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnRelationship::class.java, - converter, - ) - } - - /** - * Create a string column. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - * @param key Column Key. - * @param size Attribute size for text attributes, in number of characters. - * @param required Is column required? - * @param default Default value for column when not provided. Cannot be set when column is required. - * @param array Is column an array? - * @param encrypt Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @return [io.appwrite.models.ColumnString] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun createStringColumn( - databaseId: String, - tableId: String, - key: String, - size: Long, - required: Boolean, - default: String? = null, - array: Boolean? = null, - encrypt: Boolean? = null, - ): io.appwrite.models.ColumnString { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/string" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "key" to key, - "size" to size, - "required" to required, - "default" to default, - "array" to array, - "encrypt" to encrypt, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.ColumnString = { - io.appwrite.models.ColumnString.from(map = it as Map) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnString::class.java, - converter, - ) - } - - /** - * Update a string 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 Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - * @param key Column Key. - * @param required Is column required? - * @param default Default value for column when not provided. Cannot be set when column is required. - * @param size Maximum size of the string column. - * @param newKey New Column Key. - * @return [io.appwrite.models.ColumnString] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updateStringColumn( - databaseId: String, - tableId: String, - key: String, - required: Boolean, - default: String? = null, - size: Long? = null, - newKey: String? = null, - ): io.appwrite.models.ColumnString { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/string/{key}" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - .replace("{key}", key) - - val apiParams = mutableMapOf( - "required" to required, - "default" to default, - "size" to size, - "newKey" to newKey, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.ColumnString = { - io.appwrite.models.ColumnString.from(map = it as Map) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnString::class.java, - converter, - ) - } - - /** - * Create a URL column. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @param required Is column required? - * @param default Default value for column when not provided. Cannot be set when column is required. - * @param array Is column an array? - * @return [io.appwrite.models.ColumnUrl] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun createUrlColumn( - databaseId: String, - tableId: String, - key: String, - required: Boolean, - default: String? = null, - array: Boolean? = null, - ): io.appwrite.models.ColumnUrl { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/url" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "key" to key, - "required" to required, - "default" to default, - "array" to array, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.ColumnUrl = { - io.appwrite.models.ColumnUrl.from(map = it as Map) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnUrl::class.java, - converter, - ) - } - - /** - * Update an url column. Changing the `default` value will not update already existing rows. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @param required Is column required? - * @param default Default value for column when not provided. Cannot be set when column is required. - * @param newKey New Column Key. - * @return [io.appwrite.models.ColumnUrl] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updateUrlColumn( - databaseId: String, - tableId: String, - key: String, - required: Boolean, - default: String? = null, - newKey: String? = null, - ): io.appwrite.models.ColumnUrl { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/url/{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.ColumnUrl = { - io.appwrite.models.ColumnUrl.from(map = it as Map) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnUrl::class.java, - converter, - ) - } - - /** - * Get column by ID. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @return [Any] - */ - @Throws(AppwriteException::class) - suspend fun getColumn( - databaseId: String, - tableId: String, - key: String, - ): Any { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/{key}" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - .replace("{key}", key) - - val apiParams = mutableMapOf( - ) - val apiHeaders = mutableMapOf( - ) - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = Any::class.java, - ) - } - - /** - * Deletes a column. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @return [Any] - */ - @Throws(AppwriteException::class) - suspend fun deleteColumn( - databaseId: String, - tableId: String, - key: String, - ): Any { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/{key}" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - .replace("{key}", key) - - val apiParams = mutableMapOf( - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - return client.call( - "DELETE", - apiPath, - apiHeaders, - apiParams, - responseType = Any::class.java, - ) - } - - /** - * Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param key Column Key. - * @param onDelete Constraints option - * @param newKey New Column Key. - * @return [io.appwrite.models.ColumnRelationship] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updateRelationshipColumn( - databaseId: String, - tableId: String, - key: String, - onDelete: io.appwrite.enums.RelationMutate? = null, - newKey: String? = null, - ): io.appwrite.models.ColumnRelationship { - val apiPath = "/databases/{databaseId}/tables/{tableId}/columns/{key}/relationship" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - .replace("{key}", key) - - val apiParams = mutableMapOf( - "onDelete" to onDelete, - "newKey" to newKey, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.ColumnRelationship = { - io.appwrite.models.ColumnRelationship.from(map = it as Map) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnRelationship::class.java, - converter, - ) - } - - /** - * List indexes in the collection. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error - * @return [io.appwrite.models.ColumnIndexList] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun listIndexes( - databaseId: String, - tableId: String, - queries: List? = null, - ): io.appwrite.models.ColumnIndexList { - val apiPath = "/databases/{databaseId}/tables/{tableId}/indexes" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "queries" to queries, - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.ColumnIndexList = { - io.appwrite.models.ColumnIndexList.from(map = it as Map) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnIndexList::class.java, - converter, - ) - } - - /** - * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request.Attributes can be `key`, `fulltext`, and `unique`. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - * @param key Index Key. - * @param type Index type. - * @param columns Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long. - * @param orders Array of index orders. Maximum of 100 orders are allowed. - * @param lengths Length of index. Maximum of 100 - * @return [io.appwrite.models.ColumnIndex] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun createIndex( - databaseId: String, - tableId: String, - key: String, - type: io.appwrite.enums.IndexType, - columns: List, - orders: List? = null, - lengths: List? = null, - ): io.appwrite.models.ColumnIndex { - val apiPath = "/databases/{databaseId}/tables/{tableId}/indexes" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "key" to key, - "type" to type, - "columns" to columns, - "orders" to orders, - "lengths" to lengths, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.ColumnIndex = { - io.appwrite.models.ColumnIndex.from(map = it as Map) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnIndex::class.java, - converter, - ) - } - - /** - * Get index by ID. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - * @param key Index Key. - * @return [io.appwrite.models.ColumnIndex] - */ - @Throws(AppwriteException::class) - suspend fun getIndex( - databaseId: String, - tableId: String, - key: String, - ): io.appwrite.models.ColumnIndex { - val apiPath = "/databases/{databaseId}/tables/{tableId}/indexes/{key}" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - .replace("{key}", key) - - val apiParams = mutableMapOf( - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.ColumnIndex = { - io.appwrite.models.ColumnIndex.from(map = it as Map) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ColumnIndex::class.java, - converter, - ) - } - - /** - * Delete an index. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - * @param key Index Key. - * @return [Any] - */ - @Throws(AppwriteException::class) - suspend fun deleteIndex( - databaseId: String, - tableId: String, - key: String, - ): Any { - val apiPath = "/databases/{databaseId}/tables/{tableId}/indexes/{key}" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - .replace("{key}", key) - - val apiParams = mutableMapOf( - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - return client.call( - "DELETE", - apiPath, - apiHeaders, - apiParams, - responseType = Any::class.java, - ) - } - - /** - * Get a list of all the user's rows in a given table. You can use the query params to filter your results. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @return [io.appwrite.models.RowList] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun listRows( - databaseId: String, - tableId: String, - queries: List? = null, - nestedType: Class, - ): io.appwrite.models.RowList { - val apiPath = "/databases/{databaseId}/tables/{tableId}/rows" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "queries" to queries, - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.RowList = { - io.appwrite.models.RowList.from(map = it as Map, nestedType) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Get a list of all the user's rows in a given table. You can use the query params to filter your results. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @return [io.appwrite.models.RowList] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun listRows( - databaseId: String, - tableId: String, - queries: List? = null, - ): io.appwrite.models.RowList> = listRows( - databaseId, - tableId, - queries, - nestedType = classOf(), - ) - - /** - * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows. - * @param rowId Row ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param data Row data as JSON object. - * @param permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @return [io.appwrite.models.Row] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun createRow( - databaseId: String, - tableId: String, - rowId: String, - data: Any, - permissions: List? = null, - nestedType: Class, - ): io.appwrite.models.Row { - val apiPath = "/databases/{databaseId}/tables/{tableId}/rows" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "rowId" to rowId, - "data" to data, - "permissions" to permissions, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Row = { - io.appwrite.models.Row.from(map = it as Map, nestedType) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows. - * @param rowId Row ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param data Row data as JSON object. - * @param permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @return [io.appwrite.models.Row] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun createRow( - databaseId: String, - tableId: String, - rowId: String, - data: Any, - permissions: List? = null, - ): io.appwrite.models.Row> = createRow( - databaseId, - tableId, - rowId, - data, - permissions, - nestedType = classOf(), - ) - - /** - * Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows. - * @param rows Array of documents data as JSON objects. - * @return [io.appwrite.models.RowList] - */ - @Throws(AppwriteException::class) - suspend fun createRows( - databaseId: String, - tableId: String, - rows: List, - nestedType: Class, - ): io.appwrite.models.RowList { - val apiPath = "/databases/{databaseId}/tables/{tableId}/rows" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "rows" to rows, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.RowList = { - io.appwrite.models.RowList.from(map = it as Map, nestedType) - } - return client.call( - "POST", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows. - * @param rows Array of documents data as JSON objects. - * @return [io.appwrite.models.RowList] - */ - @Throws(AppwriteException::class) - suspend fun createRows( - databaseId: String, - tableId: String, - rows: List, - ): io.appwrite.models.RowList> = createRows( - databaseId, - tableId, - rows, - nestedType = classOf(), - ) - - /** - * Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @return [io.appwrite.models.RowList] - */ - @Throws(AppwriteException::class) - suspend fun upsertRows( - databaseId: String, - tableId: String, - nestedType: Class, - ): io.appwrite.models.RowList { - val apiPath = "/databases/{databaseId}/tables/{tableId}/rows" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.RowList = { - io.appwrite.models.RowList.from(map = it as Map, nestedType) - } - return client.call( - "PUT", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @return [io.appwrite.models.RowList] - */ - @Throws(AppwriteException::class) - suspend fun upsertRows( - databaseId: String, - tableId: String, - ): io.appwrite.models.RowList> = upsertRows( - databaseId, - tableId, - nestedType = classOf(), - ) - - /** - * Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param data Row data as JSON object. Include only column and value pairs to be updated. - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @return [io.appwrite.models.RowList] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updateRows( - databaseId: String, - tableId: String, - data: Any? = null, - queries: List? = null, - nestedType: Class, - ): io.appwrite.models.RowList { - val apiPath = "/databases/{databaseId}/tables/{tableId}/rows" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "data" to data, - "queries" to queries, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.RowList = { - io.appwrite.models.RowList.from(map = it as Map, nestedType) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param data Row data as JSON object. Include only column and value pairs to be updated. - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @return [io.appwrite.models.RowList] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updateRows( - databaseId: String, - tableId: String, - data: Any? = null, - queries: List? = null, - ): io.appwrite.models.RowList> = updateRows( - databaseId, - tableId, - data, - queries, - nestedType = classOf(), - ) - - /** - * Bulk delete rows using queries, if no queries are passed then all rows are deleted. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @return [io.appwrite.models.RowList] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun deleteRows( - databaseId: String, - tableId: String, - queries: List? = null, - nestedType: Class, - ): io.appwrite.models.RowList { - val apiPath = "/databases/{databaseId}/tables/{tableId}/rows" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - - val apiParams = mutableMapOf( - "queries" to queries, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.RowList = { - io.appwrite.models.RowList.from(map = it as Map, nestedType) - } - return client.call( - "DELETE", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Bulk delete rows using queries, if no queries are passed then all rows are deleted. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @return [io.appwrite.models.RowList] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun deleteRows( - databaseId: String, - tableId: String, - queries: List? = null, - ): io.appwrite.models.RowList> = deleteRows( - databaseId, - tableId, - queries, - nestedType = classOf(), - ) - - /** - * Get a row by its unique ID. This endpoint response returns a JSON object with the row data. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - * @param rowId Row ID. - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @return [io.appwrite.models.Row] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun getRow( - databaseId: String, - tableId: String, - rowId: String, - queries: List? = null, - nestedType: Class, - ): io.appwrite.models.Row { - val apiPath = "/databases/{databaseId}/tables/{tableId}/rows/{rowId}" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - .replace("{rowId}", rowId) - - val apiParams = mutableMapOf( - "queries" to queries, - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.Row = { - io.appwrite.models.Row.from(map = it as Map, nestedType) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Get a row by its unique ID. This endpoint response returns a JSON object with the row data. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - * @param rowId Row ID. - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @return [io.appwrite.models.Row] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun getRow( - databaseId: String, - tableId: String, - rowId: String, - queries: List? = null, - ): io.appwrite.models.Row> = getRow( - databaseId, - tableId, - rowId, - queries, - nestedType = classOf(), - ) - - /** - * Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param rowId Row ID. - * @return [io.appwrite.models.Row] - */ - @Throws(AppwriteException::class) - suspend fun upsertRow( - databaseId: String, - tableId: String, - rowId: String, - nestedType: Class, - ): io.appwrite.models.Row { - val apiPath = "/databases/{databaseId}/tables/{tableId}/rows/{rowId}" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - .replace("{rowId}", rowId) - - val apiParams = mutableMapOf( - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Row = { - io.appwrite.models.Row.from(map = it as Map, nestedType) - } - return client.call( - "PUT", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param rowId Row ID. - * @return [io.appwrite.models.Row] - */ - @Throws(AppwriteException::class) - suspend fun upsertRow( - databaseId: String, - tableId: String, - rowId: String, - ): io.appwrite.models.Row> = upsertRow( - databaseId, - tableId, - rowId, - nestedType = classOf(), - ) - - /** - * Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param rowId Row ID. - * @param data Row data as JSON object. Include only columns and value pairs to be updated. - * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @return [io.appwrite.models.Row] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updateRow( - databaseId: String, - tableId: String, - rowId: String, - data: Any? = null, - permissions: List? = null, - nestedType: Class, - ): io.appwrite.models.Row { - val apiPath = "/databases/{databaseId}/tables/{tableId}/rows/{rowId}" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - .replace("{rowId}", rowId) - - val apiParams = mutableMapOf( - "data" to data, - "permissions" to permissions, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Row = { - io.appwrite.models.Row.from(map = it as Map, nestedType) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param rowId Row ID. - * @param data Row data as JSON object. Include only columns and value pairs to be updated. - * @param permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @return [io.appwrite.models.Row] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updateRow( - databaseId: String, - tableId: String, - rowId: String, - data: Any? = null, - permissions: List? = null, - ): io.appwrite.models.Row> = updateRow( - databaseId, - tableId, - rowId, - data, - permissions, - nestedType = classOf(), - ) - - /** - * Delete a row by its unique ID. - * - * @param databaseId Database ID. - * @param tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - * @param rowId Row ID. - * @return [Any] - */ - @Throws(AppwriteException::class) - suspend fun deleteRow( - databaseId: String, - tableId: String, - rowId: String, - ): Any { - val apiPath = "/databases/{databaseId}/tables/{tableId}/rows/{rowId}" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - .replace("{rowId}", rowId) - - val apiParams = mutableMapOf( - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - return client.call( - "DELETE", - apiPath, - apiHeaders, - apiParams, - responseType = Any::class.java, - ) - } - - /** - * Decrement a specific column of a row by a given value. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param rowId Row ID. - * @param column Column key. - * @param value Value to increment the column by. The value must be a number. - * @param min Minimum value for the column. If the current value is lesser than this value, an exception will be thrown. - * @return [io.appwrite.models.Row] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun decrementRowColumn( - databaseId: String, - tableId: String, - rowId: String, - column: String, - value: Double? = null, - min: Double? = null, - nestedType: Class, - ): io.appwrite.models.Row { - val apiPath = "/databases/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - .replace("{rowId}", rowId) - .replace("{column}", column) - - val apiParams = mutableMapOf( - "value" to value, - "min" to min, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Row = { - io.appwrite.models.Row.from(map = it as Map, nestedType) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Decrement a specific column of a row by a given value. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param rowId Row ID. - * @param column Column key. - * @param value Value to increment the column by. The value must be a number. - * @param min Minimum value for the column. If the current value is lesser than this value, an exception will be thrown. - * @return [io.appwrite.models.Row] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun decrementRowColumn( - databaseId: String, - tableId: String, - rowId: String, - column: String, - value: Double? = null, - min: Double? = null, - ): io.appwrite.models.Row> = decrementRowColumn( - databaseId, - tableId, - rowId, - column, - value, - min, - nestedType = classOf(), - ) - - /** - * Increment a specific column of a row by a given value. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param rowId Row ID. - * @param column Column key. - * @param value Value to increment the column by. The value must be a number. - * @param max Maximum value for the column. If the current value is greater than this value, an error will be thrown. - * @return [io.appwrite.models.Row] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun incrementRowColumn( - databaseId: String, - tableId: String, - rowId: String, - column: String, - value: Double? = null, - max: Double? = null, - nestedType: Class, - ): io.appwrite.models.Row { - val apiPath = "/databases/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment" - .replace("{databaseId}", databaseId) - .replace("{tableId}", tableId) - .replace("{rowId}", rowId) - .replace("{column}", column) - - val apiParams = mutableMapOf( - "value" to value, - "max" to max, - ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", - ) - val converter: (Any) -> io.appwrite.models.Row = { - io.appwrite.models.Row.from(map = it as Map, nestedType) - } - return client.call( - "PATCH", - apiPath, - apiHeaders, - apiParams, - responseType = classOf(), - converter, - ) - } - - /** - * Increment a specific column of a row by a given value. - * - * @param databaseId Database ID. - * @param tableId Table ID. - * @param rowId Row ID. - * @param column Column key. - * @param value Value to increment the column by. The value must be a number. - * @param max Maximum value for the column. If the current value is greater than this value, an error will be thrown. - * @return [io.appwrite.models.Row] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun incrementRowColumn( - databaseId: String, - tableId: String, - rowId: String, - column: String, - value: Double? = null, - max: Double? = null, - ): io.appwrite.models.Row> = incrementRowColumn( - databaseId, - tableId, - rowId, - column, - value, - max, - nestedType = classOf(), - ) - -} \ No newline at end of file From 5221112bd243bf0807c16935eb159f21dbfb85b8 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 24 Jul 2025 11:16:59 +0000 Subject: [PATCH 4/5] chore: add changelog --- CHANGELOG.md | 30 ++++++++++++++++++++++++++- README.md | 4 ++-- src/main/kotlin/io/appwrite/Client.kt | 4 ++-- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa4d35e..c7194d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,29 @@ -# Change Log \ No newline at end of file +# Change Log + +## 9.1.0 + +* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service +* Add `dart38` and `flutter332` support to runtime models +* Add `gif` support to `ImageFormat` enum +* Add `encrypt` support to `StringAttribute` model +* Add `sequence` support to `Document` model + +## 9.0.0 + +* Add `` to doc examples due to the new multi region endpoints +* Add doc examples and methods for bulk api transactions: `createDocuments`, `deleteDocuments` etc. +* Add doc examples, class and methods for new `Sites` service +* Add doc examples, class and methods for new `Tokens` service +* Add enums for `BuildRuntime `, `Adapter`, `Framework`, `DeploymentDownloadType` and `VCSDeploymentType` +* Update enum for `runtimes` with Pythonml312, Dart219, Flutter327 and Flutter329 +* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage +* Add `queries` and `search` params to `listMemberships` method +* Remove `search` param from `listExecutions` method + +## 8.0.0 + +* Fix requests failing by removing `Content-Type` header from `GET` and `HEAD` requests + +## 7.0.0 + +* Fix pong response & chunked upload diff --git a/README.md b/README.md index 52fd0c1..126160d 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:9.0.0") +implementation("io.appwrite:sdk-for-kotlin:9.1.0") ``` ### Maven @@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-kotlin - 9.0.0 + 9.1.0 ``` diff --git a/src/main/kotlin/io/appwrite/Client.kt b/src/main/kotlin/io/appwrite/Client.kt index c7824ef..429131e 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/9.0.0 ${System.getProperty("http.agent")}", + "user-agent" to "AppwriteKotlinSDK/9.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 "9.0.0", + "x-sdk-version" to "9.1.0", "x-appwrite-response-format" to "1.7.0", ) From 74e11383aef7653e2a4df48a1d06a5cd47085126 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 25 Jul 2025 11:46:50 +0000 Subject: [PATCH 5/5] chore: update readme --- README.md | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/README.md b/README.md index 126160d..f3824c3 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,77 @@ suspend fun main() { } ``` +### Type Safety with Models + +The Appwrite Kotlin SDK provides type safety when working with database documents through generic methods. Methods like `listDocuments`, `getDocument`, and others accept a `nestedType` parameter that allows you to specify your custom model type for full type safety. + +```kotlin +data class Book( + val name: String, + val author: String, + val releaseYear: String? = null, + val category: String? = null, + val genre: List? = null, + val isCheckedOut: Boolean +) + +val databases = Databases(client) + +try { + val documents = databases.listDocuments( + databaseId = "your-database-id", + collectionId = "your-collection-id", + nestedType = Book::class.java // Pass in your custom model type + ) + + for (book in documents.documents) { + Log.d("Appwrite", "Book: ${book.name} by ${book.author}") // Now you have full type safety + } +} catch (e: AppwriteException) { + Log.e("Appwrite", e.message ?: "Unknown error") +} +``` + +**Tip**: You can use the `appwrite types` command to automatically generate model definitions based on your Appwrite database schema. Learn more about [type generation](https://appwrite.io/docs/products/databases/type-generation). + +### Working with Model Methods + +All Appwrite models come with built-in methods for data conversion and manipulation: + +**`toMap()`** - Converts a model instance to a Map format, useful for debugging or manual data manipulation: +```kotlin +val account = Account(client) +val user = account.get() +val userMap = user.toMap() +Log.d("Appwrite", userMap.toString()) // Prints all user properties as a Map +``` + +**`from(map:, nestedType:)`** - Creates a model instance from a Map, useful when working with raw data: +```kotlin +val userData: Map = mapOf( + "\$id" to "123", + "name" to "John", + "email" to "john@example.com" +) +val user = User.from(userData, User::class.java) +``` + +**JSON Serialization** - Models can be easily converted to/from JSON using Gson (which the SDK uses internally): +```kotlin +import com.google.gson.Gson + +val account = Account(client) +val user = account.get() + +// Convert to JSON +val gson = Gson() +val jsonString = gson.toJson(user) +Log.d("Appwrite", "User JSON: $jsonString") + +// Convert from JSON +val userFromJson = gson.fromJson(jsonString, User::class.java) +``` + ### Error Handling The Appwrite Kotlin SDK raises `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching `AppwriteException` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example.