diff --git a/README.md b/README.md index 9ddec57..8469be2 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.2") +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.2 + 10.0.0 ``` diff --git a/docs/examples/java/account/create-m-f-a-authenticator.md b/docs/examples/java/account/create-m-f-a-authenticator.md new file mode 100644 index 0000000..d38ddd3 --- /dev/null +++ b/docs/examples/java/account/create-m-f-a-authenticator.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; +import io.appwrite.enums.AuthenticatorType; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.createMFAAuthenticator( + AuthenticatorType.TOTP, // type + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/account/create-m-f-a-challenge.md b/docs/examples/java/account/create-m-f-a-challenge.md new file mode 100644 index 0000000..5c048cb --- /dev/null +++ b/docs/examples/java/account/create-m-f-a-challenge.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; +import io.appwrite.enums.AuthenticationFactor; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createMFAChallenge( + AuthenticationFactor.EMAIL, // factor + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/account/create-m-f-a-recovery-codes.md b/docs/examples/java/account/create-m-f-a-recovery-codes.md new file mode 100644 index 0000000..6a47a17 --- /dev/null +++ b/docs/examples/java/account/create-m-f-a-recovery-codes.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.createMFARecoveryCodes(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/java/account/delete-m-f-a-authenticator.md b/docs/examples/java/account/delete-m-f-a-authenticator.md new file mode 100644 index 0000000..20a6acd --- /dev/null +++ b/docs/examples/java/account/delete-m-f-a-authenticator.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; +import io.appwrite.enums.AuthenticatorType; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.deleteMFAAuthenticator( + AuthenticatorType.TOTP, // type + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/account/get-m-f-a-recovery-codes.md b/docs/examples/java/account/get-m-f-a-recovery-codes.md new file mode 100644 index 0000000..813a0a6 --- /dev/null +++ b/docs/examples/java/account/get-m-f-a-recovery-codes.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.getMFARecoveryCodes(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/java/account/list-m-f-a-factors.md b/docs/examples/java/account/list-m-f-a-factors.md new file mode 100644 index 0000000..0bdc378 --- /dev/null +++ b/docs/examples/java/account/list-m-f-a-factors.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.listMFAFactors(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/java/account/update-m-f-a-authenticator.md b/docs/examples/java/account/update-m-f-a-authenticator.md new file mode 100644 index 0000000..87e3852 --- /dev/null +++ b/docs/examples/java/account/update-m-f-a-authenticator.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; +import io.appwrite.enums.AuthenticatorType; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updateMFAAuthenticator( + AuthenticatorType.TOTP, // type + "", // otp + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/account/update-m-f-a-challenge.md b/docs/examples/java/account/update-m-f-a-challenge.md new file mode 100644 index 0000000..5e1bebe --- /dev/null +++ b/docs/examples/java/account/update-m-f-a-challenge.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updateMFAChallenge( + "", // challengeId + "", // otp + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/account/update-m-f-a-recovery-codes.md b/docs/examples/java/account/update-m-f-a-recovery-codes.md new file mode 100644 index 0000000..7c303dd --- /dev/null +++ b/docs/examples/java/account/update-m-f-a-recovery-codes.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updateMFARecoveryCodes(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/java/databases/decrement-document-attribute.md b/docs/examples/java/databases/decrement-document-attribute.md index 34b7472..a44cc51 100644 --- a/docs/examples/java/databases/decrement-document-attribute.md +++ b/docs/examples/java/databases/decrement-document-attribute.md @@ -5,7 +5,7 @@ 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 + .setSession(""); // The user session to authenticate with Databases databases = new Databases(client); diff --git a/docs/examples/java/databases/increment-document-attribute.md b/docs/examples/java/databases/increment-document-attribute.md index ca9c357..b5b5054 100644 --- a/docs/examples/java/databases/increment-document-attribute.md +++ b/docs/examples/java/databases/increment-document-attribute.md @@ -5,7 +5,7 @@ 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 + .setSession(""); // The user session to authenticate with Databases databases = new Databases(client); diff --git a/docs/examples/java/messaging/create-a-p-n-s-provider.md b/docs/examples/java/messaging/create-a-p-n-s-provider.md new file mode 100644 index 0000000..acae476 --- /dev/null +++ b/docs/examples/java/messaging/create-a-p-n-s-provider.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createAPNSProvider( + "", // providerId + "", // name + "", // authKey (optional) + "", // authKeyId (optional) + "", // teamId (optional) + "", // bundleId (optional) + false, // sandbox (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/create-f-c-m-provider.md b/docs/examples/java/messaging/create-f-c-m-provider.md new file mode 100644 index 0000000..0d67e28 --- /dev/null +++ b/docs/examples/java/messaging/create-f-c-m-provider.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createFCMProvider( + "", // providerId + "", // name + mapOf( "a" to "b" ), // serviceAccountJSON (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/create-s-m-s.md b/docs/examples/java/messaging/create-s-m-s.md new file mode 100644 index 0000000..ca40cc3 --- /dev/null +++ b/docs/examples/java/messaging/create-s-m-s.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createSMS( + "", // messageId + "", // content + listOf(), // topics (optional) + listOf(), // users (optional) + listOf(), // targets (optional) + false, // draft (optional) + "", // scheduledAt (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/create-s-m-t-p-provider.md b/docs/examples/java/messaging/create-s-m-t-p-provider.md new file mode 100644 index 0000000..1f1a0f9 --- /dev/null +++ b/docs/examples/java/messaging/create-s-m-t-p-provider.md @@ -0,0 +1,36 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createSMTPProvider( + "", // providerId + "", // name + "", // host + 1, // port (optional) + "", // username (optional) + "", // password (optional) + SmtpEncryption.NONE, // encryption (optional) + false, // autoTLS (optional) + "", // mailer (optional) + "", // fromName (optional) + "email@example.com", // fromEmail (optional) + "", // replyToName (optional) + "email@example.com", // replyToEmail (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/update-a-p-n-s-provider.md b/docs/examples/java/messaging/update-a-p-n-s-provider.md new file mode 100644 index 0000000..c5da5ba --- /dev/null +++ b/docs/examples/java/messaging/update-a-p-n-s-provider.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateAPNSProvider( + "", // providerId + "", // name (optional) + false, // enabled (optional) + "", // authKey (optional) + "", // authKeyId (optional) + "", // teamId (optional) + "", // bundleId (optional) + false, // sandbox (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/update-f-c-m-provider.md b/docs/examples/java/messaging/update-f-c-m-provider.md new file mode 100644 index 0000000..dd92f93 --- /dev/null +++ b/docs/examples/java/messaging/update-f-c-m-provider.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateFCMProvider( + "", // providerId + "", // name (optional) + false, // enabled (optional) + mapOf( "a" to "b" ), // serviceAccountJSON (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/update-s-m-s.md b/docs/examples/java/messaging/update-s-m-s.md new file mode 100644 index 0000000..c59505b --- /dev/null +++ b/docs/examples/java/messaging/update-s-m-s.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateSMS( + "", // messageId + listOf(), // topics (optional) + listOf(), // users (optional) + listOf(), // targets (optional) + "", // content (optional) + false, // draft (optional) + "", // scheduledAt (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/update-s-m-t-p-provider.md b/docs/examples/java/messaging/update-s-m-t-p-provider.md new file mode 100644 index 0000000..36f1200 --- /dev/null +++ b/docs/examples/java/messaging/update-s-m-t-p-provider.md @@ -0,0 +1,36 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateSMTPProvider( + "", // providerId + "", // name (optional) + "", // host (optional) + 1, // port (optional) + "", // username (optional) + "", // password (optional) + SmtpEncryption.NONE, // encryption (optional) + false, // autoTLS (optional) + "", // mailer (optional) + "", // fromName (optional) + "email@example.com", // fromEmail (optional) + "", // replyToName (optional) + "", // replyToEmail (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/create-boolean-column.md b/docs/examples/java/tablesdb/create-boolean-column.md new file mode 100644 index 0000000..14a96a1 --- /dev/null +++ b/docs/examples/java/tablesdb/create-boolean-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/create-datetime-column.md b/docs/examples/java/tablesdb/create-datetime-column.md new file mode 100644 index 0000000..6dd28b3 --- /dev/null +++ b/docs/examples/java/tablesdb/create-datetime-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/create-email-column.md b/docs/examples/java/tablesdb/create-email-column.md new file mode 100644 index 0000000..e9f3d36 --- /dev/null +++ b/docs/examples/java/tablesdb/create-email-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/create-enum-column.md b/docs/examples/java/tablesdb/create-enum-column.md new file mode 100644 index 0000000..bc31bbe --- /dev/null +++ b/docs/examples/java/tablesdb/create-enum-column.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/create-float-column.md b/docs/examples/java/tablesdb/create-float-column.md new file mode 100644 index 0000000..51312d0 --- /dev/null +++ b/docs/examples/java/tablesdb/create-float-column.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/create-index.md b/docs/examples/java/tablesdb/create-index.md new file mode 100644 index 0000000..991bd34 --- /dev/null +++ b/docs/examples/java/tablesdb/create-index.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; +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 + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/create-integer-column.md b/docs/examples/java/tablesdb/create-integer-column.md new file mode 100644 index 0000000..1e0a363 --- /dev/null +++ b/docs/examples/java/tablesdb/create-integer-column.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/create-ip-column.md b/docs/examples/java/tablesdb/create-ip-column.md new file mode 100644 index 0000000..a963cc1 --- /dev/null +++ b/docs/examples/java/tablesdb/create-ip-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/create-relationship-column.md b/docs/examples/java/tablesdb/create-relationship-column.md new file mode 100644 index 0000000..956c1fa --- /dev/null +++ b/docs/examples/java/tablesdb/create-relationship-column.md @@ -0,0 +1,31 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; +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 + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/create-row.md b/docs/examples/java/tablesdb/create-row.md new file mode 100644 index 0000000..4145022 --- /dev/null +++ b/docs/examples/java/tablesdb/create-row.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/create-rows.md b/docs/examples/java/tablesdb/create-rows.md new file mode 100644 index 0000000..21bdd21 --- /dev/null +++ b/docs/examples/java/tablesdb/create-rows.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/create-string-column.md b/docs/examples/java/tablesdb/create-string-column.md new file mode 100644 index 0000000..3596340 --- /dev/null +++ b/docs/examples/java/tablesdb/create-string-column.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/create-table.md b/docs/examples/java/tablesdb/create-table.md new file mode 100644 index 0000000..5bd3b6d --- /dev/null +++ b/docs/examples/java/tablesdb/create-table.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.createTable( + "", // 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/tablesdb/create-url-column.md b/docs/examples/java/tablesdb/create-url-column.md new file mode 100644 index 0000000..20c10e6 --- /dev/null +++ b/docs/examples/java/tablesdb/create-url-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/create.md b/docs/examples/java/tablesdb/create.md new file mode 100644 index 0000000..112e8e6 --- /dev/null +++ b/docs/examples/java/tablesdb/create.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.create( + "", // databaseId + "", // name + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/decrement-row-column.md b/docs/examples/java/tablesdb/decrement-row-column.md new file mode 100644 index 0000000..b9f250f --- /dev/null +++ b/docs/examples/java/tablesdb/decrement-row-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/delete-column.md b/docs/examples/java/tablesdb/delete-column.md new file mode 100644 index 0000000..25d94d2 --- /dev/null +++ b/docs/examples/java/tablesdb/delete-column.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.deleteColumn( + "", // databaseId + "", // tableId + "", // key + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/delete-index.md b/docs/examples/java/tablesdb/delete-index.md new file mode 100644 index 0000000..aa40dd0 --- /dev/null +++ b/docs/examples/java/tablesdb/delete-index.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.deleteIndex( + "", // databaseId + "", // tableId + "", // key + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/delete-row.md b/docs/examples/java/tablesdb/delete-row.md new file mode 100644 index 0000000..fd66525 --- /dev/null +++ b/docs/examples/java/tablesdb/delete-row.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.deleteRow( + "", // databaseId + "", // tableId + "", // rowId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/delete-rows.md b/docs/examples/java/tablesdb/delete-rows.md new file mode 100644 index 0000000..43b772e --- /dev/null +++ b/docs/examples/java/tablesdb/delete-rows.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/delete-table.md b/docs/examples/java/tablesdb/delete-table.md new file mode 100644 index 0000000..dcd6daa --- /dev/null +++ b/docs/examples/java/tablesdb/delete-table.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.deleteTable( + "", // databaseId + "", // tableId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/delete.md b/docs/examples/java/tablesdb/delete.md new file mode 100644 index 0000000..ea30c34 --- /dev/null +++ b/docs/examples/java/tablesdb/delete.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.delete( + "", // databaseId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/get-column.md b/docs/examples/java/tablesdb/get-column.md new file mode 100644 index 0000000..42ed776 --- /dev/null +++ b/docs/examples/java/tablesdb/get-column.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.getColumn( + "", // databaseId + "", // tableId + "", // key + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/get-index.md b/docs/examples/java/tablesdb/get-index.md new file mode 100644 index 0000000..d14579d --- /dev/null +++ b/docs/examples/java/tablesdb/get-index.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.getIndex( + "", // databaseId + "", // tableId + "", // key + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/get-row.md b/docs/examples/java/tablesdb/get-row.md new file mode 100644 index 0000000..03cf3fb --- /dev/null +++ b/docs/examples/java/tablesdb/get-row.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/get-table.md b/docs/examples/java/tablesdb/get-table.md new file mode 100644 index 0000000..4486249 --- /dev/null +++ b/docs/examples/java/tablesdb/get-table.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.getTable( + "", // databaseId + "", // tableId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/get.md b/docs/examples/java/tablesdb/get.md new file mode 100644 index 0000000..6480d62 --- /dev/null +++ b/docs/examples/java/tablesdb/get.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.get( + "", // databaseId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/increment-row-column.md b/docs/examples/java/tablesdb/increment-row-column.md new file mode 100644 index 0000000..db48d05 --- /dev/null +++ b/docs/examples/java/tablesdb/increment-row-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/list-columns.md b/docs/examples/java/tablesdb/list-columns.md new file mode 100644 index 0000000..f0e70d3 --- /dev/null +++ b/docs/examples/java/tablesdb/list-columns.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/list-indexes.md b/docs/examples/java/tablesdb/list-indexes.md new file mode 100644 index 0000000..1e5d1f9 --- /dev/null +++ b/docs/examples/java/tablesdb/list-indexes.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/list-rows.md b/docs/examples/java/tablesdb/list-rows.md new file mode 100644 index 0000000..52cf2a1 --- /dev/null +++ b/docs/examples/java/tablesdb/list-rows.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/list-tables.md b/docs/examples/java/tablesdb/list-tables.md new file mode 100644 index 0000000..5e98cb6 --- /dev/null +++ b/docs/examples/java/tablesdb/list-tables.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.listTables( + "", // 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/tablesdb/list.md b/docs/examples/java/tablesdb/list.md new file mode 100644 index 0000000..34dc9da --- /dev/null +++ b/docs/examples/java/tablesdb/list.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.list( + 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/tablesdb/update-boolean-column.md b/docs/examples/java/tablesdb/update-boolean-column.md new file mode 100644 index 0000000..d31932f --- /dev/null +++ b/docs/examples/java/tablesdb/update-boolean-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/update-datetime-column.md b/docs/examples/java/tablesdb/update-datetime-column.md new file mode 100644 index 0000000..b9fb3b2 --- /dev/null +++ b/docs/examples/java/tablesdb/update-datetime-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/update-email-column.md b/docs/examples/java/tablesdb/update-email-column.md new file mode 100644 index 0000000..ed6b93b --- /dev/null +++ b/docs/examples/java/tablesdb/update-email-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/update-enum-column.md b/docs/examples/java/tablesdb/update-enum-column.md new file mode 100644 index 0000000..5a8036a --- /dev/null +++ b/docs/examples/java/tablesdb/update-enum-column.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/update-float-column.md b/docs/examples/java/tablesdb/update-float-column.md new file mode 100644 index 0000000..0487c06 --- /dev/null +++ b/docs/examples/java/tablesdb/update-float-column.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/update-integer-column.md b/docs/examples/java/tablesdb/update-integer-column.md new file mode 100644 index 0000000..a9ed33a --- /dev/null +++ b/docs/examples/java/tablesdb/update-integer-column.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/update-ip-column.md b/docs/examples/java/tablesdb/update-ip-column.md new file mode 100644 index 0000000..3250954 --- /dev/null +++ b/docs/examples/java/tablesdb/update-ip-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/update-relationship-column.md b/docs/examples/java/tablesdb/update-relationship-column.md new file mode 100644 index 0000000..45aea8a --- /dev/null +++ b/docs/examples/java/tablesdb/update-relationship-column.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/update-row.md b/docs/examples/java/tablesdb/update-row.md new file mode 100644 index 0000000..bedc816 --- /dev/null +++ b/docs/examples/java/tablesdb/update-row.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/update-rows.md b/docs/examples/java/tablesdb/update-rows.md new file mode 100644 index 0000000..169b57c --- /dev/null +++ b/docs/examples/java/tablesdb/update-rows.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/update-string-column.md b/docs/examples/java/tablesdb/update-string-column.md new file mode 100644 index 0000000..36a2ed5 --- /dev/null +++ b/docs/examples/java/tablesdb/update-string-column.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/update-table.md b/docs/examples/java/tablesdb/update-table.md new file mode 100644 index 0000000..e593a04 --- /dev/null +++ b/docs/examples/java/tablesdb/update-table.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.updateTable( + "", // 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/tablesdb/update-url-column.md b/docs/examples/java/tablesdb/update-url-column.md new file mode 100644 index 0000000..d2273b9 --- /dev/null +++ b/docs/examples/java/tablesdb/update-url-column.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.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/tablesdb/update.md b/docs/examples/java/tablesdb/update.md new file mode 100644 index 0000000..3b1da0c --- /dev/null +++ b/docs/examples/java/tablesdb/update.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.update( + "", // databaseId + "", // name + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/tablesdb/upsert-row.md b/docs/examples/java/tablesdb/upsert-row.md new file mode 100644 index 0000000..d6155fc --- /dev/null +++ b/docs/examples/java/tablesdb/upsert-row.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession(""); // The user session to authenticate with + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.upsertRow( + "", // 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/tablesdb/upsert-rows.md b/docs/examples/java/tablesdb/upsert-rows.md new file mode 100644 index 0000000..da15f6a --- /dev/null +++ b/docs/examples/java/tablesdb/upsert-rows.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.TablesDB; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +tablesDB.upsertRows( + "", // databaseId + "", // tableId + listOf(), // rows + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/create-m-f-a-recovery-codes.md b/docs/examples/java/users/create-m-f-a-recovery-codes.md new file mode 100644 index 0000000..167c92c --- /dev/null +++ b/docs/examples/java/users/create-m-f-a-recovery-codes.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Users users = new Users(client); + +users.createMFARecoveryCodes( + "", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/delete-m-f-a-authenticator.md b/docs/examples/java/users/delete-m-f-a-authenticator.md new file mode 100644 index 0000000..c27b39e --- /dev/null +++ b/docs/examples/java/users/delete-m-f-a-authenticator.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; +import io.appwrite.enums.AuthenticatorType; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Users users = new Users(client); + +users.deleteMFAAuthenticator( + "", // userId + AuthenticatorType.TOTP, // type + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/get-m-f-a-recovery-codes.md b/docs/examples/java/users/get-m-f-a-recovery-codes.md new file mode 100644 index 0000000..e617355 --- /dev/null +++ b/docs/examples/java/users/get-m-f-a-recovery-codes.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Users users = new Users(client); + +users.getMFARecoveryCodes( + "", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/list-m-f-a-factors.md b/docs/examples/java/users/list-m-f-a-factors.md new file mode 100644 index 0000000..c26f463 --- /dev/null +++ b/docs/examples/java/users/list-m-f-a-factors.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Users users = new Users(client); + +users.listMFAFactors( + "", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/update-m-f-a-recovery-codes.md b/docs/examples/java/users/update-m-f-a-recovery-codes.md new file mode 100644 index 0000000..98522b6 --- /dev/null +++ b/docs/examples/java/users/update-m-f-a-recovery-codes.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Users users = new Users(client); + +users.updateMFARecoveryCodes( + "", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/update-m-f-a.md b/docs/examples/java/users/update-m-f-a.md new file mode 100644 index 0000000..dbcded6 --- /dev/null +++ b/docs/examples/java/users/update-m-f-a.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey(""); // Your secret API key + +Users users = new Users(client); + +users.updateMFA( + "", // userId + false, // mfa + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/kotlin/account/create-m-f-a-authenticator.md b/docs/examples/kotlin/account/create-m-f-a-authenticator.md new file mode 100644 index 0000000..fed90b4 --- /dev/null +++ b/docs/examples/kotlin/account/create-m-f-a-authenticator.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account +import io.appwrite.enums.AuthenticatorType + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.createMFAAuthenticator( + type = AuthenticatorType.TOTP +) diff --git a/docs/examples/kotlin/account/create-m-f-a-challenge.md b/docs/examples/kotlin/account/create-m-f-a-challenge.md new file mode 100644 index 0000000..7213142 --- /dev/null +++ b/docs/examples/kotlin/account/create-m-f-a-challenge.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account +import io.appwrite.enums.AuthenticationFactor + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val response = account.createMFAChallenge( + factor = AuthenticationFactor.EMAIL +) diff --git a/docs/examples/kotlin/account/create-m-f-a-recovery-codes.md b/docs/examples/kotlin/account/create-m-f-a-recovery-codes.md new file mode 100644 index 0000000..c01499b --- /dev/null +++ b/docs/examples/kotlin/account/create-m-f-a-recovery-codes.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.createMFARecoveryCodes() diff --git a/docs/examples/kotlin/account/delete-m-f-a-authenticator.md b/docs/examples/kotlin/account/delete-m-f-a-authenticator.md new file mode 100644 index 0000000..9b06f8c --- /dev/null +++ b/docs/examples/kotlin/account/delete-m-f-a-authenticator.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account +import io.appwrite.enums.AuthenticatorType + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.deleteMFAAuthenticator( + type = AuthenticatorType.TOTP +) diff --git a/docs/examples/kotlin/account/get-m-f-a-recovery-codes.md b/docs/examples/kotlin/account/get-m-f-a-recovery-codes.md new file mode 100644 index 0000000..96567f4 --- /dev/null +++ b/docs/examples/kotlin/account/get-m-f-a-recovery-codes.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.getMFARecoveryCodes() diff --git a/docs/examples/kotlin/account/list-m-f-a-factors.md b/docs/examples/kotlin/account/list-m-f-a-factors.md new file mode 100644 index 0000000..0f073df --- /dev/null +++ b/docs/examples/kotlin/account/list-m-f-a-factors.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.listMFAFactors() diff --git a/docs/examples/kotlin/account/update-m-f-a-authenticator.md b/docs/examples/kotlin/account/update-m-f-a-authenticator.md new file mode 100644 index 0000000..99764f2 --- /dev/null +++ b/docs/examples/kotlin/account/update-m-f-a-authenticator.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account +import io.appwrite.enums.AuthenticatorType + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateMFAAuthenticator( + type = AuthenticatorType.TOTP, + otp = "" +) diff --git a/docs/examples/kotlin/account/update-m-f-a-challenge.md b/docs/examples/kotlin/account/update-m-f-a-challenge.md new file mode 100644 index 0000000..de90873 --- /dev/null +++ b/docs/examples/kotlin/account/update-m-f-a-challenge.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateMFAChallenge( + challengeId = "", + otp = "" +) diff --git a/docs/examples/kotlin/account/update-m-f-a-recovery-codes.md b/docs/examples/kotlin/account/update-m-f-a-recovery-codes.md new file mode 100644 index 0000000..05f6476 --- /dev/null +++ b/docs/examples/kotlin/account/update-m-f-a-recovery-codes.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateMFARecoveryCodes() diff --git a/docs/examples/kotlin/databases/decrement-document-attribute.md b/docs/examples/kotlin/databases/decrement-document-attribute.md index 05204d7..d0226c0 100644 --- a/docs/examples/kotlin/databases/decrement-document-attribute.md +++ b/docs/examples/kotlin/databases/decrement-document-attribute.md @@ -5,7 +5,7 @@ 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 + .setSession("") // The user session to authenticate with val databases = Databases(client) diff --git a/docs/examples/kotlin/databases/increment-document-attribute.md b/docs/examples/kotlin/databases/increment-document-attribute.md index 40c1224..b56ed91 100644 --- a/docs/examples/kotlin/databases/increment-document-attribute.md +++ b/docs/examples/kotlin/databases/increment-document-attribute.md @@ -5,7 +5,7 @@ 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 + .setSession("") // The user session to authenticate with val databases = Databases(client) diff --git a/docs/examples/kotlin/messaging/create-a-p-n-s-provider.md b/docs/examples/kotlin/messaging/create-a-p-n-s-provider.md new file mode 100644 index 0000000..5104edf --- /dev/null +++ b/docs/examples/kotlin/messaging/create-a-p-n-s-provider.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createAPNSProvider( + providerId = "", + name = "", + authKey = "", // optional + authKeyId = "", // optional + teamId = "", // optional + bundleId = "", // optional + sandbox = false, // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/messaging/create-f-c-m-provider.md b/docs/examples/kotlin/messaging/create-f-c-m-provider.md new file mode 100644 index 0000000..b1a2ef8 --- /dev/null +++ b/docs/examples/kotlin/messaging/create-f-c-m-provider.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createFCMProvider( + providerId = "", + name = "", + serviceAccountJSON = mapOf( "a" to "b" ), // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/messaging/create-s-m-s.md b/docs/examples/kotlin/messaging/create-s-m-s.md new file mode 100644 index 0000000..54c06eb --- /dev/null +++ b/docs/examples/kotlin/messaging/create-s-m-s.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createSMS( + messageId = "", + content = "", + topics = listOf(), // optional + users = listOf(), // optional + targets = listOf(), // optional + draft = false, // optional + scheduledAt = "" // optional +) diff --git a/docs/examples/kotlin/messaging/create-s-m-t-p-provider.md b/docs/examples/kotlin/messaging/create-s-m-t-p-provider.md new file mode 100644 index 0000000..ce50130 --- /dev/null +++ b/docs/examples/kotlin/messaging/create-s-m-t-p-provider.md @@ -0,0 +1,27 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createSMTPProvider( + providerId = "", + name = "", + host = "", + port = 1, // optional + username = "", // optional + password = "", // optional + encryption = "none", // optional + autoTLS = false, // optional + mailer = "", // optional + fromName = "", // optional + fromEmail = "email@example.com", // optional + replyToName = "", // optional + replyToEmail = "email@example.com", // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/messaging/update-a-p-n-s-provider.md b/docs/examples/kotlin/messaging/update-a-p-n-s-provider.md new file mode 100644 index 0000000..29b436e --- /dev/null +++ b/docs/examples/kotlin/messaging/update-a-p-n-s-provider.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateAPNSProvider( + providerId = "", + name = "", // optional + enabled = false, // optional + authKey = "", // optional + authKeyId = "", // optional + teamId = "", // optional + bundleId = "", // optional + sandbox = false // optional +) diff --git a/docs/examples/kotlin/messaging/update-f-c-m-provider.md b/docs/examples/kotlin/messaging/update-f-c-m-provider.md new file mode 100644 index 0000000..84e5635 --- /dev/null +++ b/docs/examples/kotlin/messaging/update-f-c-m-provider.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateFCMProvider( + providerId = "", + name = "", // optional + enabled = false, // optional + serviceAccountJSON = mapOf( "a" to "b" ) // optional +) diff --git a/docs/examples/kotlin/messaging/update-s-m-s.md b/docs/examples/kotlin/messaging/update-s-m-s.md new file mode 100644 index 0000000..534e9ad --- /dev/null +++ b/docs/examples/kotlin/messaging/update-s-m-s.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateSMS( + messageId = "", + topics = listOf(), // optional + users = listOf(), // optional + targets = listOf(), // optional + content = "", // optional + draft = false, // optional + scheduledAt = "" // optional +) diff --git a/docs/examples/kotlin/messaging/update-s-m-t-p-provider.md b/docs/examples/kotlin/messaging/update-s-m-t-p-provider.md new file mode 100644 index 0000000..7652e53 --- /dev/null +++ b/docs/examples/kotlin/messaging/update-s-m-t-p-provider.md @@ -0,0 +1,27 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateSMTPProvider( + providerId = "", + name = "", // optional + host = "", // optional + port = 1, // optional + username = "", // optional + password = "", // optional + encryption = "none", // optional + autoTLS = false, // optional + mailer = "", // optional + fromName = "", // optional + fromEmail = "email@example.com", // optional + replyToName = "", // optional + replyToEmail = "", // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/tablesdb/create-boolean-column.md b/docs/examples/kotlin/tablesdb/create-boolean-column.md new file mode 100644 index 0000000..fac14d9 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-boolean-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.createBooleanColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = false, // optional + array = false // optional +) diff --git a/docs/examples/kotlin/tablesdb/create-datetime-column.md b/docs/examples/kotlin/tablesdb/create-datetime-column.md new file mode 100644 index 0000000..e40d8e4 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-datetime-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.createDatetimeColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "", // optional + array = false // optional +) diff --git a/docs/examples/kotlin/tablesdb/create-email-column.md b/docs/examples/kotlin/tablesdb/create-email-column.md new file mode 100644 index 0000000..e93e0b8 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-email-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.createEmailColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "email@example.com", // optional + array = false // optional +) diff --git a/docs/examples/kotlin/tablesdb/create-enum-column.md b/docs/examples/kotlin/tablesdb/create-enum-column.md new file mode 100644 index 0000000..1d19a58 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-enum-column.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.createEnumColumn( + databaseId = "", + tableId = "", + key = "", + elements = listOf(), + required = false, + default = "", // optional + array = false // optional +) diff --git a/docs/examples/kotlin/tablesdb/create-float-column.md b/docs/examples/kotlin/tablesdb/create-float-column.md new file mode 100644 index 0000000..3c24b0d --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-float-column.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.createFloatColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + min = 0, // optional + max = 0, // optional + default = 0, // optional + array = false // optional +) diff --git a/docs/examples/kotlin/tablesdb/create-index.md b/docs/examples/kotlin/tablesdb/create-index.md new file mode 100644 index 0000000..2492f71 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-index.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB +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 tablesDB = TablesDB(client) + +val response = tablesDB.createIndex( + databaseId = "", + tableId = "", + key = "", + type = IndexType.KEY, + columns = listOf(), + orders = listOf(), // optional + lengths = listOf() // optional +) diff --git a/docs/examples/kotlin/tablesdb/create-integer-column.md b/docs/examples/kotlin/tablesdb/create-integer-column.md new file mode 100644 index 0000000..90c558c --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-integer-column.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.createIntegerColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + min = 0, // optional + max = 0, // optional + default = 0, // optional + array = false // optional +) diff --git a/docs/examples/kotlin/tablesdb/create-ip-column.md b/docs/examples/kotlin/tablesdb/create-ip-column.md new file mode 100644 index 0000000..81412c7 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-ip-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.createIpColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "", // optional + array = false // optional +) diff --git a/docs/examples/kotlin/tablesdb/create-relationship-column.md b/docs/examples/kotlin/tablesdb/create-relationship-column.md new file mode 100644 index 0000000..fbdf365 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-relationship-column.md @@ -0,0 +1,22 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB +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 tablesDB = TablesDB(client) + +val response = tablesDB.createRelationshipColumn( + databaseId = "", + tableId = "", + relatedTableId = "", + type = RelationshipType.ONETOONE, + twoWay = false, // optional + key = "", // optional + twoWayKey = "", // optional + onDelete = "cascade" // optional +) diff --git a/docs/examples/kotlin/tablesdb/create-row.md b/docs/examples/kotlin/tablesdb/create-row.md new file mode 100644 index 0000000..6a5b188 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-row.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val tablesDB = TablesDB(client) + +val response = tablesDB.createRow( + databaseId = "", + tableId = "", + rowId = "", + data = mapOf( "a" to "b" ), + permissions = listOf("read("any")") // optional +) diff --git a/docs/examples/kotlin/tablesdb/create-rows.md b/docs/examples/kotlin/tablesdb/create-rows.md new file mode 100644 index 0000000..1da47b5 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-rows.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.createRows( + databaseId = "", + tableId = "", + rows = listOf() +) diff --git a/docs/examples/kotlin/tablesdb/create-string-column.md b/docs/examples/kotlin/tablesdb/create-string-column.md new file mode 100644 index 0000000..5b5d88d --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-string-column.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.createStringColumn( + databaseId = "", + tableId = "", + key = "", + size = 1, + required = false, + default = "", // optional + array = false, // optional + encrypt = false // optional +) diff --git a/docs/examples/kotlin/tablesdb/create-table.md b/docs/examples/kotlin/tablesdb/create-table.md new file mode 100644 index 0000000..88b50d2 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-table.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.createTable( + databaseId = "", + tableId = "", + name = "", + permissions = listOf("read("any")"), // optional + rowSecurity = false, // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/tablesdb/create-url-column.md b/docs/examples/kotlin/tablesdb/create-url-column.md new file mode 100644 index 0000000..a0351e4 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create-url-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.createUrlColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "https://example.com", // optional + array = false // optional +) diff --git a/docs/examples/kotlin/tablesdb/create.md b/docs/examples/kotlin/tablesdb/create.md new file mode 100644 index 0000000..4b025b8 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/create.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.create( + databaseId = "", + name = "", + enabled = false // optional +) diff --git a/docs/examples/kotlin/tablesdb/decrement-row-column.md b/docs/examples/kotlin/tablesdb/decrement-row-column.md new file mode 100644 index 0000000..e284ec3 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/decrement-row-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val tablesDB = TablesDB(client) + +val response = tablesDB.decrementRowColumn( + databaseId = "", + tableId = "", + rowId = "", + column = "", + value = 0, // optional + min = 0 // optional +) diff --git a/docs/examples/kotlin/tablesdb/delete-column.md b/docs/examples/kotlin/tablesdb/delete-column.md new file mode 100644 index 0000000..05d341d --- /dev/null +++ b/docs/examples/kotlin/tablesdb/delete-column.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.deleteColumn( + databaseId = "", + tableId = "", + key = "" +) diff --git a/docs/examples/kotlin/tablesdb/delete-index.md b/docs/examples/kotlin/tablesdb/delete-index.md new file mode 100644 index 0000000..b5f2330 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/delete-index.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.deleteIndex( + databaseId = "", + tableId = "", + key = "" +) diff --git a/docs/examples/kotlin/tablesdb/delete-row.md b/docs/examples/kotlin/tablesdb/delete-row.md new file mode 100644 index 0000000..f24b935 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/delete-row.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val tablesDB = TablesDB(client) + +val response = tablesDB.deleteRow( + databaseId = "", + tableId = "", + rowId = "" +) diff --git a/docs/examples/kotlin/tablesdb/delete-rows.md b/docs/examples/kotlin/tablesdb/delete-rows.md new file mode 100644 index 0000000..c915a5c --- /dev/null +++ b/docs/examples/kotlin/tablesdb/delete-rows.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.deleteRows( + databaseId = "", + tableId = "", + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/tablesdb/delete-table.md b/docs/examples/kotlin/tablesdb/delete-table.md new file mode 100644 index 0000000..dce8e58 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/delete-table.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.deleteTable( + databaseId = "", + tableId = "" +) diff --git a/docs/examples/kotlin/tablesdb/delete.md b/docs/examples/kotlin/tablesdb/delete.md new file mode 100644 index 0000000..3e335fa --- /dev/null +++ b/docs/examples/kotlin/tablesdb/delete.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.delete( + databaseId = "" +) diff --git a/docs/examples/kotlin/tablesdb/get-column.md b/docs/examples/kotlin/tablesdb/get-column.md new file mode 100644 index 0000000..c4cf24d --- /dev/null +++ b/docs/examples/kotlin/tablesdb/get-column.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.getColumn( + databaseId = "", + tableId = "", + key = "" +) diff --git a/docs/examples/kotlin/tablesdb/get-index.md b/docs/examples/kotlin/tablesdb/get-index.md new file mode 100644 index 0000000..4db2547 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/get-index.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.getIndex( + databaseId = "", + tableId = "", + key = "" +) diff --git a/docs/examples/kotlin/tablesdb/get-row.md b/docs/examples/kotlin/tablesdb/get-row.md new file mode 100644 index 0000000..ec54631 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/get-row.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val tablesDB = TablesDB(client) + +val response = tablesDB.getRow( + databaseId = "", + tableId = "", + rowId = "", + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/tablesdb/get-table.md b/docs/examples/kotlin/tablesdb/get-table.md new file mode 100644 index 0000000..65afae8 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/get-table.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.getTable( + databaseId = "", + tableId = "" +) diff --git a/docs/examples/kotlin/tablesdb/get.md b/docs/examples/kotlin/tablesdb/get.md new file mode 100644 index 0000000..e58da26 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/get.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.get( + databaseId = "" +) diff --git a/docs/examples/kotlin/tablesdb/increment-row-column.md b/docs/examples/kotlin/tablesdb/increment-row-column.md new file mode 100644 index 0000000..cac151e --- /dev/null +++ b/docs/examples/kotlin/tablesdb/increment-row-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val tablesDB = TablesDB(client) + +val response = tablesDB.incrementRowColumn( + databaseId = "", + tableId = "", + rowId = "", + column = "", + value = 0, // optional + max = 0 // optional +) diff --git a/docs/examples/kotlin/tablesdb/list-columns.md b/docs/examples/kotlin/tablesdb/list-columns.md new file mode 100644 index 0000000..85a9aab --- /dev/null +++ b/docs/examples/kotlin/tablesdb/list-columns.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.listColumns( + databaseId = "", + tableId = "", + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/tablesdb/list-indexes.md b/docs/examples/kotlin/tablesdb/list-indexes.md new file mode 100644 index 0000000..db5aad4 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/list-indexes.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.listIndexes( + databaseId = "", + tableId = "", + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/tablesdb/list-rows.md b/docs/examples/kotlin/tablesdb/list-rows.md new file mode 100644 index 0000000..b0f5df4 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/list-rows.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val tablesDB = TablesDB(client) + +val response = tablesDB.listRows( + databaseId = "", + tableId = "", + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/tablesdb/list-tables.md b/docs/examples/kotlin/tablesdb/list-tables.md new file mode 100644 index 0000000..1e8eb8f --- /dev/null +++ b/docs/examples/kotlin/tablesdb/list-tables.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.listTables( + databaseId = "", + queries = listOf(), // optional + search = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/list.md b/docs/examples/kotlin/tablesdb/list.md new file mode 100644 index 0000000..58b48a0 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/list.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.list( + queries = listOf(), // optional + search = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/update-boolean-column.md b/docs/examples/kotlin/tablesdb/update-boolean-column.md new file mode 100644 index 0000000..43ab43b --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update-boolean-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.updateBooleanColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = false, + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/update-datetime-column.md b/docs/examples/kotlin/tablesdb/update-datetime-column.md new file mode 100644 index 0000000..077cff7 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update-datetime-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.updateDatetimeColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "", + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/update-email-column.md b/docs/examples/kotlin/tablesdb/update-email-column.md new file mode 100644 index 0000000..5becaa6 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update-email-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.updateEmailColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "email@example.com", + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/update-enum-column.md b/docs/examples/kotlin/tablesdb/update-enum-column.md new file mode 100644 index 0000000..4351703 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update-enum-column.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.updateEnumColumn( + databaseId = "", + tableId = "", + key = "", + elements = listOf(), + required = false, + default = "", + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/update-float-column.md b/docs/examples/kotlin/tablesdb/update-float-column.md new file mode 100644 index 0000000..6d40c3f --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update-float-column.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.updateFloatColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = 0, + min = 0, // optional + max = 0, // optional + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/update-integer-column.md b/docs/examples/kotlin/tablesdb/update-integer-column.md new file mode 100644 index 0000000..9d6bfaa --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update-integer-column.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.updateIntegerColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = 0, + min = 0, // optional + max = 0, // optional + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/update-ip-column.md b/docs/examples/kotlin/tablesdb/update-ip-column.md new file mode 100644 index 0000000..fd04b98 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update-ip-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.updateIpColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "", + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/update-relationship-column.md b/docs/examples/kotlin/tablesdb/update-relationship-column.md new file mode 100644 index 0000000..f69defd --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update-relationship-column.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.updateRelationshipColumn( + databaseId = "", + tableId = "", + key = "", + onDelete = "cascade", // optional + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/update-row.md b/docs/examples/kotlin/tablesdb/update-row.md new file mode 100644 index 0000000..9c5248f --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update-row.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val tablesDB = TablesDB(client) + +val response = tablesDB.updateRow( + databaseId = "", + tableId = "", + rowId = "", + data = mapOf( "a" to "b" ), // optional + permissions = listOf("read("any")") // optional +) diff --git a/docs/examples/kotlin/tablesdb/update-rows.md b/docs/examples/kotlin/tablesdb/update-rows.md new file mode 100644 index 0000000..c285d5b --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update-rows.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.updateRows( + databaseId = "", + tableId = "", + data = mapOf( "a" to "b" ), // optional + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/tablesdb/update-string-column.md b/docs/examples/kotlin/tablesdb/update-string-column.md new file mode 100644 index 0000000..acdd3ad --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update-string-column.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.updateStringColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "", + size = 1, // optional + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/update-table.md b/docs/examples/kotlin/tablesdb/update-table.md new file mode 100644 index 0000000..5238908 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update-table.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.updateTable( + databaseId = "", + tableId = "", + name = "", + permissions = listOf("read("any")"), // optional + rowSecurity = false, // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/tablesdb/update-url-column.md b/docs/examples/kotlin/tablesdb/update-url-column.md new file mode 100644 index 0000000..fbe68c9 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update-url-column.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.updateUrlColumn( + databaseId = "", + tableId = "", + key = "", + required = false, + default = "https://example.com", + newKey = "" // optional +) diff --git a/docs/examples/kotlin/tablesdb/update.md b/docs/examples/kotlin/tablesdb/update.md new file mode 100644 index 0000000..48d1a8e --- /dev/null +++ b/docs/examples/kotlin/tablesdb/update.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.update( + databaseId = "", + name = "", + enabled = false // optional +) diff --git a/docs/examples/kotlin/tablesdb/upsert-row.md b/docs/examples/kotlin/tablesdb/upsert-row.md new file mode 100644 index 0000000..3fcbc61 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/upsert-row.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setSession("") // The user session to authenticate with + +val tablesDB = TablesDB(client) + +val response = tablesDB.upsertRow( + databaseId = "", + tableId = "", + rowId = "", + data = mapOf( "a" to "b" ), // optional + permissions = listOf("read("any")") // optional +) diff --git a/docs/examples/kotlin/tablesdb/upsert-rows.md b/docs/examples/kotlin/tablesdb/upsert-rows.md new file mode 100644 index 0000000..7059c60 --- /dev/null +++ b/docs/examples/kotlin/tablesdb/upsert-rows.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.TablesDB + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val tablesDB = TablesDB(client) + +val response = tablesDB.upsertRows( + databaseId = "", + tableId = "", + rows = listOf() +) diff --git a/docs/examples/kotlin/users/create-m-f-a-recovery-codes.md b/docs/examples/kotlin/users/create-m-f-a-recovery-codes.md new file mode 100644 index 0000000..7a0b1c6 --- /dev/null +++ b/docs/examples/kotlin/users/create-m-f-a-recovery-codes.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val users = Users(client) + +val response = users.createMFARecoveryCodes( + userId = "" +) diff --git a/docs/examples/kotlin/users/delete-m-f-a-authenticator.md b/docs/examples/kotlin/users/delete-m-f-a-authenticator.md new file mode 100644 index 0000000..a7c8089 --- /dev/null +++ b/docs/examples/kotlin/users/delete-m-f-a-authenticator.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users +import io.appwrite.enums.AuthenticatorType + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val users = Users(client) + +val response = users.deleteMFAAuthenticator( + userId = "", + type = AuthenticatorType.TOTP +) diff --git a/docs/examples/kotlin/users/get-m-f-a-recovery-codes.md b/docs/examples/kotlin/users/get-m-f-a-recovery-codes.md new file mode 100644 index 0000000..1ad9197 --- /dev/null +++ b/docs/examples/kotlin/users/get-m-f-a-recovery-codes.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val users = Users(client) + +val response = users.getMFARecoveryCodes( + userId = "" +) diff --git a/docs/examples/kotlin/users/list-m-f-a-factors.md b/docs/examples/kotlin/users/list-m-f-a-factors.md new file mode 100644 index 0000000..9d0791c --- /dev/null +++ b/docs/examples/kotlin/users/list-m-f-a-factors.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val users = Users(client) + +val response = users.listMFAFactors( + userId = "" +) diff --git a/docs/examples/kotlin/users/update-m-f-a-recovery-codes.md b/docs/examples/kotlin/users/update-m-f-a-recovery-codes.md new file mode 100644 index 0000000..80b92b4 --- /dev/null +++ b/docs/examples/kotlin/users/update-m-f-a-recovery-codes.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val users = Users(client) + +val response = users.updateMFARecoveryCodes( + userId = "" +) diff --git a/docs/examples/kotlin/users/update-m-f-a.md b/docs/examples/kotlin/users/update-m-f-a.md new file mode 100644 index 0000000..d2f448e --- /dev/null +++ b/docs/examples/kotlin/users/update-m-f-a.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +val users = Users(client) + +val response = users.updateMFA( + userId = "", + mfa = false +) diff --git a/src/main/kotlin/io/appwrite/Client.kt b/src/main/kotlin/io/appwrite/Client.kt index 68a45cb..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.2 ${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.2", - "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/Query.kt b/src/main/kotlin/io/appwrite/Query.kt index 6efbb11..bb34452 100644 --- a/src/main/kotlin/io/appwrite/Query.kt +++ b/src/main/kotlin/io/appwrite/Query.kt @@ -51,6 +51,24 @@ class Query( fun contains(attribute: String, value: Any) = Query("contains", attribute, parseValue(value)).toJson() + fun notContains(attribute: String, value: Any) = Query("notContains", attribute, parseValue(value)).toJson() + + fun notSearch(attribute: String, value: String) = Query("notSearch", attribute, listOf(value)).toJson() + + fun notBetween(attribute: String, start: Any, end: Any) = Query("notBetween", attribute, listOf(start, end)).toJson() + + fun notStartsWith(attribute: String, value: String) = Query("notStartsWith", attribute, listOf(value)).toJson() + + fun notEndsWith(attribute: String, value: String) = Query("notEndsWith", attribute, listOf(value)).toJson() + + fun createdBefore(value: String) = Query("createdBefore", null, listOf(value)).toJson() + + fun createdAfter(value: String) = Query("createdAfter", null, listOf(value)).toJson() + + fun updatedBefore(value: String) = Query("updatedBefore", null, listOf(value)).toJson() + + fun updatedAfter(value: String) = Query("updatedAfter", null, listOf(value)).toJson() + fun or(queries: List) = Query("or", null, queries.map { it.fromJson() }).toJson() fun and(queries: List) = Query("and", null, queries.map { it.fromJson() }).toJson() diff --git a/src/main/kotlin/io/appwrite/models/BucketList.kt b/src/main/kotlin/io/appwrite/models/BucketList.kt index 91e331f..8c2f255 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 that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/Collection.kt b/src/main/kotlin/io/appwrite/models/Collection.kt index 56b7b41..00cfa81 100644 --- a/src/main/kotlin/io/appwrite/models/Collection.kt +++ b/src/main/kotlin/io/appwrite/models/Collection.kt @@ -44,7 +44,7 @@ data class Collection( val name: String, /** - * Collection enabled. Can be 'enabled' or 'disabled'. When disabled, the collection is inaccessible to users, but remains accessible to Server SDKs using API keys. + * Collection enabled. Can be 'enabled' or 'disabled'. When disabled, the collection is inaccessible to users, but remains accessible to Server SDKs using API keys. */ @SerializedName("enabled") val enabled: Boolean, diff --git a/src/main/kotlin/io/appwrite/models/CollectionList.kt b/src/main/kotlin/io/appwrite/models/CollectionList.kt index b171ae8..590efd6 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 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..e55bb22 --- /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 column when not provided. Cannot be set when column 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..fc35b86 --- /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 column 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..4e190f7 --- /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 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, + ) = 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..45244b1 --- /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 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, + "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..77ec024 --- /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 column when not provided. Cannot be set when column 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..617fbee --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ColumnIndex.kt @@ -0,0 +1,102 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Index + */ +data class ColumnIndex( + /** + * Index ID. + */ + @SerializedName("\$id") + val id: String, + + /** + * Index creation date in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Index update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + + /** + * 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?, + +) { + fun toMap(): Map = mapOf( + "\$id" to id as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, + "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, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ColumnIndex( + id = map["\$id"] as String, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, + 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?, + ) + } +} \ 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..e532637 --- /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 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..a827bd1 --- /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 column when not provided. Cannot be set when column 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..b3741bb --- /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 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, + ) = 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..789acff 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 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..47c0e72 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 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..5a57a02 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 that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/Database.kt b/src/main/kotlin/io/appwrite/models/Database.kt index 76ccdd9..f40c578 100644 --- a/src/main/kotlin/io/appwrite/models/Database.kt +++ b/src/main/kotlin/io/appwrite/models/Database.kt @@ -32,11 +32,17 @@ data class Database( val updatedAt: String, /** - * If database is enabled. Can be 'enabled' or 'disabled'. When disabled, the database is inaccessible to users, but remains accessible to Server SDKs using API keys. + * If database is enabled. Can be 'enabled' or 'disabled'. When disabled, the database is inaccessible to users, but remains accessible to Server SDKs using API keys. */ @SerializedName("enabled") val enabled: Boolean, + /** + * Database type. + */ + @SerializedName("type") + val type: String, + ) { fun toMap(): Map = mapOf( "\$id" to id as Any, @@ -44,6 +50,7 @@ data class Database( "\$createdAt" to createdAt as Any, "\$updatedAt" to updatedAt as Any, "enabled" to enabled as Any, + "type" to type as Any, ) companion object { @@ -57,6 +64,7 @@ data class Database( createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, enabled = map["enabled"] as Boolean, + type = map["type"] as String, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/DatabaseList.kt b/src/main/kotlin/io/appwrite/models/DatabaseList.kt index 81c91aa..28a2b09 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 that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/Deployment.kt b/src/main/kotlin/io/appwrite/models/Deployment.kt index 17ee770..9edb654 100644 --- a/src/main/kotlin/io/appwrite/models/Deployment.kt +++ b/src/main/kotlin/io/appwrite/models/Deployment.kt @@ -92,7 +92,7 @@ data class Deployment( val screenshotDark: String, /** - * The deployment status. Possible values are "waiting", "processing", "building", "ready", and "failed". + * The deployment status. Possible values are "waiting", "processing", "building", "ready", and "failed". */ @SerializedName("status") val status: String, diff --git a/src/main/kotlin/io/appwrite/models/DeploymentList.kt b/src/main/kotlin/io/appwrite/models/DeploymentList.kt index 2b7cf64..991a344 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 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..c26cd26 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 that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/Execution.kt b/src/main/kotlin/io/appwrite/models/Execution.kt index 216e146..8b395c6 100644 --- a/src/main/kotlin/io/appwrite/models/Execution.kt +++ b/src/main/kotlin/io/appwrite/models/Execution.kt @@ -20,7 +20,7 @@ data class Execution( val createdAt: String, /** - * Execution upate date in ISO 8601 format. + * Execution update date in ISO 8601 format. */ @SerializedName("\$updatedAt") val updatedAt: String, @@ -37,6 +37,12 @@ data class Execution( @SerializedName("functionId") val functionId: String, + /** + * Function's deployment ID used to create the execution. + */ + @SerializedName("deploymentId") + val deploymentId: String, + /** * The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. */ @@ -116,6 +122,7 @@ data class Execution( "\$updatedAt" to updatedAt as Any, "\$permissions" to permissions as Any, "functionId" to functionId as Any, + "deploymentId" to deploymentId as Any, "trigger" to trigger as Any, "status" to status as Any, "requestMethod" to requestMethod as Any, @@ -141,6 +148,7 @@ data class Execution( updatedAt = map["\$updatedAt"] as String, permissions = map["\$permissions"] as List, functionId = map["functionId"] as String, + deploymentId = map["deploymentId"] as String, trigger = map["trigger"] as String, status = map["status"] as String, requestMethod = map["requestMethod"] as String, diff --git a/src/main/kotlin/io/appwrite/models/ExecutionList.kt b/src/main/kotlin/io/appwrite/models/ExecutionList.kt index 322aeee..a976e78 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 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..dfdd212 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 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..658bab8 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 that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/Function.kt b/src/main/kotlin/io/appwrite/models/Function.kt index f6c20e4..6cc111f 100644 --- a/src/main/kotlin/io/appwrite/models/Function.kt +++ b/src/main/kotlin/io/appwrite/models/Function.kt @@ -44,7 +44,7 @@ data class Function( val enabled: Boolean, /** - * Is the function deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the function to update it with the latest configuration. + * Is the function deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the function to update it with the latest configuration. */ @SerializedName("live") val live: Boolean, @@ -62,7 +62,7 @@ data class Function( val runtime: String, /** - * Function's active deployment ID. + * Function's active deployment ID. */ @SerializedName("deploymentId") val deploymentId: String, @@ -74,7 +74,7 @@ data class Function( val deploymentCreatedAt: String, /** - * Function's latest deployment ID. + * Function's latest deployment ID. */ @SerializedName("latestDeploymentId") val latestDeploymentId: String, @@ -86,7 +86,7 @@ data class Function( val latestDeploymentCreatedAt: String, /** - * Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". + * Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". */ @SerializedName("latestDeploymentStatus") val latestDeploymentStatus: String, diff --git a/src/main/kotlin/io/appwrite/models/FunctionList.kt b/src/main/kotlin/io/appwrite/models/FunctionList.kt index 6aaa86a..ba19cec 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 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..49c3346 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 that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/Index.kt b/src/main/kotlin/io/appwrite/models/Index.kt index a368c13..93fe6df 100644 --- a/src/main/kotlin/io/appwrite/models/Index.kt +++ b/src/main/kotlin/io/appwrite/models/Index.kt @@ -8,7 +8,25 @@ import io.appwrite.extensions.jsonCast */ data class Index( /** - * Index Key. + * Index ID. + */ + @SerializedName("\$id") + val id: String, + + /** + * Index creation date in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Index update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + + /** + * Index key. */ @SerializedName("key") val key: String, @@ -49,20 +67,11 @@ data class Index( @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( + "\$id" to id as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, "key" to key as Any, "type" to type as Any, "status" to status as Any, @@ -70,8 +79,6 @@ data class Index( "attributes" to attributes as Any, "lengths" to lengths as Any, "orders" to orders as Any, - "\$createdAt" to createdAt as Any, - "\$updatedAt" to updatedAt as Any, ) companion object { @@ -80,6 +87,9 @@ data class Index( fun from( map: Map, ) = Index( + id = map["\$id"] as String, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, key = map["key"] as String, type = map["type"] as String, status = map["status"] as String, @@ -87,8 +97,6 @@ data class Index( attributes = map["attributes"] 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/IndexList.kt b/src/main/kotlin/io/appwrite/models/IndexList.kt index a14167d..e757c05 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 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..1aac2f7 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 that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/Locale.kt b/src/main/kotlin/io/appwrite/models/Locale.kt index abe4a0e..93d28d4 100644 --- a/src/main/kotlin/io/appwrite/models/Locale.kt +++ b/src/main/kotlin/io/appwrite/models/Locale.kt @@ -26,7 +26,7 @@ data class Locale( val country: String, /** - * Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America. + * Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America. */ @SerializedName("continentCode") val continentCode: String, diff --git a/src/main/kotlin/io/appwrite/models/LocaleCodeList.kt b/src/main/kotlin/io/appwrite/models/LocaleCodeList.kt index 3973a03..7949b57 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 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..c88451c 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 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..b2bea4e 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 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..5f27130 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 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..5f7c22f 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 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..0676663 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 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..07b1e4c 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 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..5e99cd7 --- /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 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..8aefaaa 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 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..22fba69 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 that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/Site.kt b/src/main/kotlin/io/appwrite/models/Site.kt index d3de7b0..c246ac1 100644 --- a/src/main/kotlin/io/appwrite/models/Site.kt +++ b/src/main/kotlin/io/appwrite/models/Site.kt @@ -38,7 +38,7 @@ data class Site( val enabled: Boolean, /** - * Is the site deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the site to update it with the latest configuration. + * Is the site deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the site to update it with the latest configuration. */ @SerializedName("live") val live: Boolean, @@ -56,7 +56,7 @@ data class Site( val framework: String, /** - * Site's active deployment ID. + * Site's active deployment ID. */ @SerializedName("deploymentId") val deploymentId: String, @@ -80,7 +80,7 @@ data class Site( val deploymentScreenshotDark: String, /** - * Site's latest deployment ID. + * Site's latest deployment ID. */ @SerializedName("latestDeploymentId") val latestDeploymentId: String, @@ -92,7 +92,7 @@ data class Site( val latestDeploymentCreatedAt: String, /** - * Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". + * Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". */ @SerializedName("latestDeploymentStatus") val latestDeploymentStatus: String, diff --git a/src/main/kotlin/io/appwrite/models/SiteList.kt b/src/main/kotlin/io/appwrite/models/SiteList.kt index 15ecc7f..f280b5d 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 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..f2e6688 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 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..8cfadf0 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 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..c741b43 --- /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..0cd5cc9 --- /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 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..6307609 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 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..c95cc56 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 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..68be717 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 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..b89e46e 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 that matched your query. */ @SerializedName("total") val total: Long, diff --git a/src/main/kotlin/io/appwrite/models/Variable.kt b/src/main/kotlin/io/appwrite/models/Variable.kt index 47518f1..992fcdf 100644 --- a/src/main/kotlin/io/appwrite/models/Variable.kt +++ b/src/main/kotlin/io/appwrite/models/Variable.kt @@ -44,13 +44,13 @@ data class Variable( val secret: Boolean, /** - * Service to which the variable belongs. Possible values are "project", "function" + * Service to which the variable belongs. Possible values are "project", "function" */ @SerializedName("resourceType") val resourceType: String, /** - * ID of resource to which the variable belongs. If resourceType is "project", it is empty. If resourceType is "function", it is ID of the function. + * ID of resource to which the variable belongs. If resourceType is "project", it is empty. If resourceType is "function", it is ID of the function. */ @SerializedName("resourceId") val resourceId: String, diff --git a/src/main/kotlin/io/appwrite/models/VariableList.kt b/src/main/kotlin/io/appwrite/models/VariableList.kt index 06004c6..492b67e 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 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..ce9c501 100644 --- a/src/main/kotlin/io/appwrite/services/Account.kt +++ b/src/main/kotlin/io/appwrite/services/Account.kt @@ -119,7 +119,9 @@ class Account(client: Client) : Service(client) { ) /** - * Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request.This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. + * Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request. + * This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. + * * * @param email User email. * @param password User password. Must be at least 8 chars. @@ -154,7 +156,9 @@ class Account(client: Client) : Service(client) { } /** - * Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request.This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. + * Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request. + * This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. + * * * @param email User email. * @param password User password. Must be at least 8 chars. @@ -339,6 +343,11 @@ class Account(client: Client) : Service(client) { * @param type Type of authenticator. Must be `totp` * @return [io.appwrite.models.MfaType] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Account.createMFAAuthenticator` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Account.createMFAAuthenticator"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun createMfaAuthenticator( type: io.appwrite.enums.AuthenticatorType, @@ -364,6 +373,37 @@ class Account(client: Client) : Service(client) { ) } + /** + * Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method. + * + * @param type Type of authenticator. Must be `totp` + * @return [io.appwrite.models.MfaType] + */ + @Throws(AppwriteException::class) + suspend fun createMFAAuthenticator( + type: io.appwrite.enums.AuthenticatorType, + ): io.appwrite.models.MfaType { + val apiPath = "/account/mfa/authenticators/{type}" + .replace("{type}", type.value) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.MfaType = { + io.appwrite.models.MfaType.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MfaType::class.java, + converter, + ) + } + /** * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. * @@ -371,6 +411,11 @@ class Account(client: Client) : Service(client) { * @param otp Valid verification token. * @return [io.appwrite.models.User] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Account.updateMFAAuthenticator"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun updateMfaAuthenticator( type: io.appwrite.enums.AuthenticatorType, @@ -406,6 +451,11 @@ class Account(client: Client) : Service(client) { * @param otp Valid verification token. * @return [io.appwrite.models.User] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Account.updateMFAAuthenticator"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun updateMfaAuthenticator( type: io.appwrite.enums.AuthenticatorType, @@ -416,12 +466,69 @@ class Account(client: Client) : Service(client) { nestedType = classOf(), ) + /** + * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. + * + * @param type Type of authenticator. + * @param otp Valid verification token. + * @return [io.appwrite.models.User] + */ + @Throws(AppwriteException::class) + suspend fun updateMFAAuthenticator( + type: io.appwrite.enums.AuthenticatorType, + otp: String, + nestedType: Class, + ): io.appwrite.models.User { + val apiPath = "/account/mfa/authenticators/{type}" + .replace("{type}", type.value) + + val apiParams = mutableMapOf( + "otp" to otp, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.User = { + io.appwrite.models.User.from(map = it as Map, nestedType) + } + return client.call( + "PUT", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. + * + * @param type Type of authenticator. + * @param otp Valid verification token. + * @return [io.appwrite.models.User] + */ + @Throws(AppwriteException::class) + suspend fun updateMFAAuthenticator( + type: io.appwrite.enums.AuthenticatorType, + otp: String, + ): io.appwrite.models.User> = updateMFAAuthenticator( + type, + otp, + nestedType = classOf(), + ) + /** * Delete an authenticator for a user by ID. * * @param type Type of authenticator. * @return [Any] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Account.deleteMFAAuthenticator` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Account.deleteMFAAuthenticator"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun deleteMfaAuthenticator( type: io.appwrite.enums.AuthenticatorType, @@ -443,12 +550,44 @@ class Account(client: Client) : Service(client) { ) } + /** + * Delete an authenticator for a user by ID. + * + * @param type Type of authenticator. + * @return [Any] + */ + @Throws(AppwriteException::class) + suspend fun deleteMFAAuthenticator( + type: io.appwrite.enums.AuthenticatorType, + ): Any { + val apiPath = "/account/mfa/authenticators/{type}" + .replace("{type}", type.value) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + /** * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. * * @param factor Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. * @return [io.appwrite.models.MfaChallenge] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Account.createMFAChallenge"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun createMfaChallenge( factor: io.appwrite.enums.AuthenticationFactor, @@ -474,6 +613,37 @@ class Account(client: Client) : Service(client) { ) } + /** + * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. + * + * @param factor Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. + * @return [io.appwrite.models.MfaChallenge] + */ + @Throws(AppwriteException::class) + suspend fun createMFAChallenge( + factor: io.appwrite.enums.AuthenticationFactor, + ): io.appwrite.models.MfaChallenge { + val apiPath = "/account/mfa/challenge" + + val apiParams = mutableMapOf( + "factor" to factor, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.MfaChallenge = { + io.appwrite.models.MfaChallenge.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MfaChallenge::class.java, + converter, + ) + } + /** * Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. * @@ -481,6 +651,11 @@ class Account(client: Client) : Service(client) { * @param otp Valid verification token. * @return [io.appwrite.models.Session] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Account.updateMFAChallenge` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Account.updateMFAChallenge"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun updateMfaChallenge( challengeId: String, @@ -508,11 +683,50 @@ class Account(client: Client) : Service(client) { ) } + /** + * Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. + * + * @param challengeId ID of the challenge. + * @param otp Valid verification token. + * @return [io.appwrite.models.Session] + */ + @Throws(AppwriteException::class) + suspend fun updateMFAChallenge( + challengeId: String, + otp: String, + ): io.appwrite.models.Session { + val apiPath = "/account/mfa/challenge" + + val apiParams = mutableMapOf( + "challengeId" to challengeId, + "otp" to otp, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Session = { + io.appwrite.models.Session.from(map = it as Map) + } + return client.call( + "PUT", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Session::class.java, + converter, + ) + } + /** * List the factors available on the account to be used as a MFA challange. * * @return [io.appwrite.models.MfaFactors] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Account.listMFAFactors"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun listMfaFactors( ): io.appwrite.models.MfaFactors { @@ -535,11 +749,43 @@ class Account(client: Client) : Service(client) { ) } + /** + * List the factors available on the account to be used as a MFA challange. + * + * @return [io.appwrite.models.MfaFactors] + */ + @Throws(AppwriteException::class) + suspend fun listMFAFactors( + ): io.appwrite.models.MfaFactors { + val apiPath = "/account/mfa/factors" + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.MfaFactors = { + io.appwrite.models.MfaFactors.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MfaFactors::class.java, + converter, + ) + } + /** * Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes. * * @return [io.appwrite.models.MfaRecoveryCodes] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Account.getMFARecoveryCodes"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun getMfaRecoveryCodes( ): io.appwrite.models.MfaRecoveryCodes { @@ -563,11 +809,43 @@ class Account(client: Client) : Service(client) { } /** - * Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. + * Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes. * * @return [io.appwrite.models.MfaRecoveryCodes] */ @Throws(AppwriteException::class) + suspend fun getMFARecoveryCodes( + ): io.appwrite.models.MfaRecoveryCodes { + val apiPath = "/account/mfa/recovery-codes" + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { + io.appwrite.models.MfaRecoveryCodes.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MfaRecoveryCodes::class.java, + converter, + ) + } + + /** + * Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. + * + * @return [io.appwrite.models.MfaRecoveryCodes] + */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Account.createMFARecoveryCodes"), + since = "1.8.0" + ) + @Throws(AppwriteException::class) suspend fun createMfaRecoveryCodes( ): io.appwrite.models.MfaRecoveryCodes { val apiPath = "/account/mfa/recovery-codes" @@ -590,11 +868,44 @@ class Account(client: Client) : Service(client) { ) } + /** + * Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. + * + * @return [io.appwrite.models.MfaRecoveryCodes] + */ + @Throws(AppwriteException::class) + suspend fun createMFARecoveryCodes( + ): io.appwrite.models.MfaRecoveryCodes { + val apiPath = "/account/mfa/recovery-codes" + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { + io.appwrite.models.MfaRecoveryCodes.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MfaRecoveryCodes::class.java, + converter, + ) + } + /** * Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes. * * @return [io.appwrite.models.MfaRecoveryCodes] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Account.updateMFARecoveryCodes"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun updateMfaRecoveryCodes( ): io.appwrite.models.MfaRecoveryCodes { @@ -618,6 +929,34 @@ class Account(client: Client) : Service(client) { ) } + /** + * Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes. + * + * @return [io.appwrite.models.MfaRecoveryCodes] + */ + @Throws(AppwriteException::class) + suspend fun updateMFARecoveryCodes( + ): io.appwrite.models.MfaRecoveryCodes { + val apiPath = "/account/mfa/recovery-codes" + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { + io.appwrite.models.MfaRecoveryCodes.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MfaRecoveryCodes::class.java, + converter, + ) + } + /** * Update currently logged in user account name. * @@ -719,7 +1058,7 @@ class Account(client: Client) : Service(client) { ) /** - * Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS. + * Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS. * * @param phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. * @param password User password. Must be at least 8 chars. @@ -754,7 +1093,7 @@ class Account(client: Client) : Service(client) { } /** - * Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS. + * Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS. * * @param phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. * @param password User password. Must be at least 8 chars. @@ -856,7 +1195,7 @@ class Account(client: Client) : Service(client) { ) /** - * Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour. + * Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour. * * @param email User email. * @param url URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. @@ -890,7 +1229,9 @@ class Account(client: Client) : Service(client) { } /** - * Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint.Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + * Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint. + * + * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. * * @param userId User ID. * @param secret Valid reset token. @@ -1006,7 +1347,9 @@ class Account(client: Client) : Service(client) { } /** - * Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user. + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * * @param email User email. * @param password User password. Must be at least 8 chars. @@ -1046,6 +1389,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 +1426,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, @@ -1142,7 +1491,7 @@ class Account(client: Client) : Service(client) { } /** - * Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. + * Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. * * @param sessionId Session ID. Use the string 'current' to get the current device session. * @return [io.appwrite.models.Session] @@ -1172,7 +1521,7 @@ class Account(client: Client) : Service(client) { } /** - * Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider. + * Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider. * * @param sessionId Session ID. Use the string 'current' to update the current device session. * @return [io.appwrite.models.Session] @@ -1203,7 +1552,7 @@ class Account(client: Client) : Service(client) { } /** - * Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead. + * Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead. * * @param sessionId Session ID. Use the string 'current' to delete the current device session. * @return [Any] @@ -1270,9 +1619,12 @@ class Account(client: Client) : Service(client) { ) /** - * Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes.A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * Sends the user an email with a secret key for creating a session. If the email address has never been used, a **new account is created** using the provided `userId`. Otherwise, if the email address is already attached to an account, the **user ID is ignored**. Then, the user will receive an email with the one-time password. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes. + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * * - * @param userId User 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 userId User 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. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored. * @param email User email. * @param phrase Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow. * @return [io.appwrite.models.Token] @@ -1308,9 +1660,12 @@ class Account(client: Client) : Service(client) { } /** - * Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour.A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * * - * @param userId 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 userId 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. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored. * @param email User email. * @param url URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param phrase Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow. @@ -1349,7 +1704,11 @@ class Account(client: Client) : Service(client) { } /** - * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint.A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. + * + * If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint. + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * * @param provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom. * @param success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. @@ -1384,9 +1743,11 @@ class Account(client: Client) : Service(client) { } /** - * Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes.A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes. + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * - * @param userId 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 userId 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. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored. * @param phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. * @return [io.appwrite.models.Token] */ @@ -1418,7 +1779,10 @@ class Account(client: Client) : Service(client) { } /** - * Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + * Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days. + * + * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + * * * @param url URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @return [io.appwrite.models.Token] @@ -1483,7 +1847,7 @@ class Account(client: Client) : Service(client) { } /** - * Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes. + * Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes. * * @return [io.appwrite.models.Token] */ @@ -1511,7 +1875,7 @@ class Account(client: Client) : Service(client) { } /** - * Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code. + * Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code. * * @param userId User ID. * @param secret Valid verification token. diff --git a/src/main/kotlin/io/appwrite/services/Avatars.kt b/src/main/kotlin/io/appwrite/services/Avatars.kt index e6f4673..ee1ead3 100644 --- a/src/main/kotlin/io/appwrite/services/Avatars.kt +++ b/src/main/kotlin/io/appwrite/services/Avatars.kt @@ -16,7 +16,9 @@ import java.io.File class Avatars(client: Client) : Service(client) { /** - * You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings.When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. * * @param code Browser Code. * @param width Image width. Pass an integer between 0 to 2000. Defaults to 100. @@ -51,7 +53,10 @@ class Avatars(client: Client) : Service(client) { } /** - * The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * * * @param code Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro, rupay. * @param width Image width. Pass an integer between 0 to 2000. Defaults to 100. @@ -86,7 +91,9 @@ class Avatars(client: Client) : Service(client) { } /** - * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.This endpoint does not follow HTTP redirects. + * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. + * + * This endpoint does not follow HTTP redirects. * * @param url Website URL which you want to fetch the favicon from. * @return [ByteArray] @@ -111,7 +118,10 @@ class Avatars(client: Client) : Service(client) { } /** - * You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * * * @param code Country Code. ISO Alpha-2 country code format. * @param width Image width. Pass an integer between 0 to 2000. Defaults to 100. @@ -146,7 +156,11 @@ class Avatars(client: Client) : Service(client) { } /** - * Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px.This endpoint does not follow HTTP redirects. + * Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px. + * + * This endpoint does not follow HTTP redirects. * * @param url Image URL which you want to crop. * @param width Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400. @@ -178,7 +192,12 @@ class Avatars(client: Client) : Service(client) { } /** - * Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials.When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. + * + * You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * * * @param name Full Name. When empty, current user name or email will be used. Max length: 128 chars. * @param width Image width. Pass an integer between 0 to 2000. Defaults to 100. @@ -214,6 +233,7 @@ class Avatars(client: Client) : Service(client) { /** * Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. + * * * @param text Plain text to be converted to QR code image. * @param size QR code size. Pass an integer between 1 to 1000. Defaults to 400. diff --git a/src/main/kotlin/io/appwrite/services/Databases.kt b/src/main/kotlin/io/appwrite/services/Databases.kt index 6c57ede..3531a93 100644 --- a/src/main/kotlin/io/appwrite/services/Databases.kt +++ b/src/main/kotlin/io/appwrite/services/Databases.kt @@ -20,6 +20,11 @@ class Databases(client: Client) : Service(client) { * @param search Search term to filter your list results. Max length: 256 chars. * @return [io.appwrite.models.DatabaseList] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `TablesDB.list` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.list"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun list( @@ -49,12 +54,18 @@ class Databases(client: Client) : Service(client) { /** * Create a new Database. + * * * @param databaseId 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 Database name. Max length: 128 chars. * @param enabled Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. * @return [io.appwrite.models.Database] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `TablesDB.createDatabase` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createDatabase"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun create( @@ -91,6 +102,11 @@ class Databases(client: Client) : Service(client) { * @param databaseId Database ID. * @return [io.appwrite.models.Database] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `TablesDB.get` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.get"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun get( databaseId: String, @@ -123,6 +139,11 @@ class Databases(client: Client) : Service(client) { * @param enabled Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. * @return [io.appwrite.models.Database] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.update"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun update( @@ -159,6 +180,11 @@ class Databases(client: Client) : Service(client) { * @param databaseId Database ID. * @return [Any] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `TablesDB.delete` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.delete"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun delete( databaseId: String, @@ -188,6 +214,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 `TablesDB.listTables` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.listTables"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun listCollections( @@ -228,6 +259,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 `TablesDB.createTable` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createTable"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createCollection( @@ -271,6 +307,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 `TablesDB.getTable` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.getTable"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun getCollection( databaseId: String, @@ -308,6 +349,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 `TablesDB.updateTable` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updateTable"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateCollection( @@ -351,6 +397,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 `TablesDB.deleteTable` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.deleteTable"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun deleteCollection( databaseId: String, @@ -378,10 +429,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 `TablesDB.listColumns` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.listColumns"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun listAttributes( @@ -413,15 +469,21 @@ 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 `TablesDB.createBooleanColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createBooleanColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createBooleanAttribute( @@ -462,13 +524,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 `TablesDB.updateBooleanColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updateBooleanColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateBooleanAttribute( @@ -509,13 +576,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 `TablesDB.createDatetimeColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createDatetimeColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createDatetimeAttribute( @@ -556,13 +628,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 `TablesDB.updateDatetimeColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updateDatetimeColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateDatetimeAttribute( @@ -601,15 +678,21 @@ 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 `TablesDB.createEmailColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createEmailColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createEmailAttribute( @@ -648,15 +731,21 @@ 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 `TablesDB.updateEmailColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updateEmailColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateEmailAttribute( @@ -694,17 +783,23 @@ 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 `TablesDB.createEnumColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createEnumColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createEnumAttribute( @@ -745,16 +840,22 @@ 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 `TablesDB.updateEnumColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updateEnumColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateEnumAttribute( @@ -795,17 +896,23 @@ 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 `TablesDB.createFloatColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createFloatColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createFloatAttribute( @@ -848,17 +955,23 @@ 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 `TablesDB.updateFloatColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updateFloatColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateFloatAttribute( @@ -901,17 +1014,23 @@ 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 `TablesDB.createIntegerColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createIntegerColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createIntegerAttribute( @@ -954,17 +1073,23 @@ 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 `TablesDB.updateIntegerColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updateIntegerColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateIntegerAttribute( @@ -1007,15 +1132,21 @@ 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 `TablesDB.createIpColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createIpColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createIpAttribute( @@ -1054,15 +1185,21 @@ 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 `TablesDB.updateIpColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updateIpColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateIpAttribute( @@ -1101,10 +1238,11 @@ 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 +1250,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 `TablesDB.createRelationshipColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createRelationshipColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createRelationshipAttribute( @@ -1154,9 +1297,10 @@ 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 +1309,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 `TablesDB.createStringColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createStringColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createStringAttribute( @@ -1207,16 +1356,22 @@ 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 `TablesDB.updateStringColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updateStringColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateStringAttribute( @@ -1257,15 +1412,21 @@ 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 `TablesDB.createUrlColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createUrlColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createUrlAttribute( @@ -1304,15 +1465,21 @@ 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 `TablesDB.updateUrlColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updateUrlColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateUrlAttribute( @@ -1353,10 +1520,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 `TablesDB.getColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.getColumn"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun getAttribute( databaseId: String, @@ -1385,10 +1557,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 `TablesDB.deleteColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.deleteColumn"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun deleteAttribute( databaseId: String, @@ -1416,14 +1593,20 @@ 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 `TablesDB.updateRelationshipColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updateRelationshipColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateRelationshipAttribute( @@ -1459,13 +1642,18 @@ class Databases(client: Client) : Service(client) { } /** - * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * * @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 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 `TablesDB.listRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.listRows"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun listDocuments( @@ -1497,13 +1685,18 @@ class Databases(client: Client) : Service(client) { } /** - * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * * @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 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 `TablesDB.listRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.listRows"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun listDocuments( @@ -1527,6 +1720,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 `TablesDB.createRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createRow"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createDocument( @@ -1572,6 +1770,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 `TablesDB.createRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createRow"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createDocument( @@ -1590,13 +1793,18 @@ class Databases(client: Client) : Service(client) { ) /** - * **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. + * 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. * @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 `TablesDB.createRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createRows"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun createDocuments( databaseId: String, @@ -1628,13 +1836,18 @@ class Databases(client: Client) : Service(client) { } /** - * **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. + * 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. * @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 `TablesDB.createRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createRows"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun createDocuments( databaseId: String, @@ -1648,13 +1861,19 @@ class Databases(client: Client) : Service(client) { ) /** - * **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. + * 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] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.upsertRows"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun upsertDocuments( databaseId: String, @@ -1686,13 +1905,19 @@ class Databases(client: Client) : Service(client) { } /** - * **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. + * 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] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.upsertRows"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun upsertDocuments( databaseId: String, @@ -1706,7 +1931,7 @@ class Databases(client: Client) : Service(client) { ) /** - * **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. + * 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. @@ -1714,6 +1939,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 `TablesDB.updateRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updateRows"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateDocuments( @@ -1748,7 +1978,7 @@ class Databases(client: Client) : Service(client) { } /** - * **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. + * 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. @@ -1756,6 +1986,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 `TablesDB.updateRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updateRows"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateDocuments( @@ -1772,13 +2007,18 @@ class Databases(client: Client) : Service(client) { ) /** - * **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. + * 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). * @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 `TablesDB.deleteRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.deleteRows"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun deleteDocuments( @@ -1811,13 +2051,18 @@ class Databases(client: Client) : Service(client) { } /** - * **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. + * 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). * @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 `TablesDB.deleteRows` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.deleteRows"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun deleteDocuments( @@ -1840,6 +2085,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 `TablesDB.getRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.getRow"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun getDocument( @@ -1881,6 +2131,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 `TablesDB.getRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.getRow"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun getDocument( @@ -1897,7 +2152,7 @@ class Databases(client: Client) : Service(client) { ) /** - * **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. + * 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. @@ -1906,6 +2161,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 `TablesDB.upsertRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.upsertRow"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun upsertDocument( @@ -1942,7 +2202,7 @@ class Databases(client: Client) : Service(client) { } /** - * **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. + * 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. @@ -1951,6 +2211,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 `TablesDB.upsertRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.upsertRow"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun upsertDocument( @@ -1978,6 +2243,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 `TablesDB.updateRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updateRow"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateDocument( @@ -2023,6 +2293,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 `TablesDB.updateRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.updateRow"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateDocument( @@ -2048,6 +2323,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 `TablesDB.deleteRow` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.deleteRow"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun deleteDocument( databaseId: String, @@ -2080,10 +2360,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 `TablesDB.decrementRowColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.decrementRowColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun decrementDocumentAttribute( @@ -2128,10 +2413,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 `TablesDB.decrementRowColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.decrementRowColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun decrementDocumentAttribute( @@ -2162,6 +2452,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 `TablesDB.incrementRowColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.incrementRowColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun incrementDocumentAttribute( @@ -2210,6 +2505,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 `TablesDB.incrementRowColumn` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.incrementRowColumn"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun incrementDocumentAttribute( @@ -2237,6 +2537,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 `TablesDB.listIndexes` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.listIndexes"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun listIndexes( @@ -2267,7 +2572,8 @@ class Databases(client: Client) : Service(client) { } /** - * 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`. + * 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 collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). @@ -2278,6 +2584,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 `TablesDB.createIndex` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.createIndex"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createIndex( @@ -2324,6 +2635,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 `TablesDB.getIndex` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.getIndex"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun getIndex( databaseId: String, @@ -2360,6 +2676,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 `TablesDB.deleteIndex` instead.", + replaceWith = ReplaceWith("io.appwrite.services.TablesDB.deleteIndex"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun deleteIndex( databaseId: String, diff --git a/src/main/kotlin/io/appwrite/services/Functions.kt b/src/main/kotlin/io/appwrite/services/Functions.kt index 8e09dc9..354a07b 100644 --- a/src/main/kotlin/io/appwrite/services/Functions.kt +++ b/src/main/kotlin/io/appwrite/services/Functions.kt @@ -16,7 +16,7 @@ import java.io.File class Functions(client: Client) : Service(client) { /** - * Get a list of all the project's functions. You can use the query params to filter your results. + * Get a list of all the project's functions. You can use the query params to filter your results. * * @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, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId * @param search Search term to filter your list results. Max length: 256 chars. @@ -361,7 +361,7 @@ class Functions(client: Client) : Service(client) { } /** - * Get a list of all the function's code deployments. You can use the query params to filter your results. + * Get a list of all the function's code deployments. You can use the query params to filter your results. * * @param functionId Function 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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type @@ -398,7 +398,11 @@ class Functions(client: Client) : Service(client) { } /** - * Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID.This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions).Use the "command" param to set the entrypoint used to execute your code. + * Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. + * + * This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). + * + * Use the "command" param to set the entrypoint used to execute your code. * * @param functionId Function ID. * @param code Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. @@ -447,7 +451,7 @@ class Functions(client: Client) : Service(client) { } /** - * Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + * Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. * * @param functionId Function ID. * @param deploymentId Deployment ID. @@ -485,7 +489,9 @@ class Functions(client: Client) : Service(client) { } /** - * Create a deployment based on a template.Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details. + * Create a deployment based on a template. + * + * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details. * * @param functionId Function ID. * @param repository Repository name of the template. @@ -532,7 +538,9 @@ class Functions(client: Client) : Service(client) { } /** - * Create a deployment when a function is connected to VCS.This endpoint lets you create deployment from a branch, commit, or a tag. + * Create a deployment when a function is connected to VCS. + * + * This endpoint lets you create deployment from a branch, commit, or a tag. * * @param functionId Function ID. * @param type Type of reference passed. Allowed values are: branch, commit @@ -636,7 +644,7 @@ class Functions(client: Client) : Service(client) { } /** - * Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + * Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. * * @param functionId Function ID. * @param deploymentId Deployment ID. @@ -668,7 +676,7 @@ class Functions(client: Client) : Service(client) { } /** - * Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + * Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. * * @param functionId Function ID. * @param deploymentId Deployment ID. diff --git a/src/main/kotlin/io/appwrite/services/Health.kt b/src/main/kotlin/io/appwrite/services/Health.kt index af44ef1..f8d9cbf 100644 --- a/src/main/kotlin/io/appwrite/services/Health.kt +++ b/src/main/kotlin/io/appwrite/services/Health.kt @@ -9,7 +9,7 @@ import okhttp3.Cookie import java.io.File /** - * The Health service allows you to both validate and monitor your Appwrite server's health. + * The Health service allows you to both validate and monitor your Appwrite server's health. **/ class Health(client: Client) : Service(client) { @@ -308,6 +308,7 @@ class Health(client: Client) : Service(client) { /** * Returns the amount of failed jobs in a given queue. + * * * @param name The name of the queue * @param threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. diff --git a/src/main/kotlin/io/appwrite/services/Locale.kt b/src/main/kotlin/io/appwrite/services/Locale.kt index e598c0b..7d7dbfc 100644 --- a/src/main/kotlin/io/appwrite/services/Locale.kt +++ b/src/main/kotlin/io/appwrite/services/Locale.kt @@ -9,12 +9,14 @@ import okhttp3.Cookie import java.io.File /** - * The Locale service allows you to customize your app based on your users' location. + * The Locale service allows you to customize your app based on your users' location. **/ class Locale(client: Client) : Service(client) { /** - * Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.([IP Geolocation by DB-IP](https://db-ip.com)) + * Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) * * @return [io.appwrite.models.Locale] */ diff --git a/src/main/kotlin/io/appwrite/services/Messaging.kt b/src/main/kotlin/io/appwrite/services/Messaging.kt index f8cfcff..38a94d7 100644 --- a/src/main/kotlin/io/appwrite/services/Messaging.kt +++ b/src/main/kotlin/io/appwrite/services/Messaging.kt @@ -114,6 +114,7 @@ class Messaging(client: Client) : Service(client) { /** * Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * * * @param messageId Message ID. * @param topics List of Topic IDs. @@ -265,6 +266,7 @@ class Messaging(client: Client) : Service(client) { /** * Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * * * @param messageId Message ID. * @param topics List of Topic IDs. @@ -361,6 +363,11 @@ class Messaging(client: Client) : Service(client) { * @param scheduledAt Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. * @return [io.appwrite.models.Message] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Messaging.createSMS` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Messaging.createSMS"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createSms( @@ -399,8 +406,59 @@ class Messaging(client: Client) : Service(client) { ) } + /** + * Create a new SMS message. + * + * @param messageId Message 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 content SMS Content. + * @param topics List of Topic IDs. + * @param users List of User IDs. + * @param targets List of Targets IDs. + * @param draft Is message a draft + * @param scheduledAt Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @return [io.appwrite.models.Message] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createSMS( + messageId: String, + content: String, + topics: List? = null, + users: List? = null, + targets: List? = null, + draft: Boolean? = null, + scheduledAt: String? = null, + ): io.appwrite.models.Message { + val apiPath = "/messaging/messages/sms" + + val apiParams = mutableMapOf( + "messageId" to messageId, + "content" to content, + "topics" to topics, + "users" to users, + "targets" to targets, + "draft" to draft, + "scheduledAt" to scheduledAt, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Message = { + io.appwrite.models.Message.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Message::class.java, + converter, + ) + } + /** * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * * * @param messageId Message ID. * @param topics List of Topic IDs. @@ -411,6 +469,11 @@ class Messaging(client: Client) : Service(client) { * @param scheduledAt Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. * @return [io.appwrite.models.Message] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Messaging.updateSMS` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Messaging.updateSMS"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateSms( @@ -449,8 +512,60 @@ class Messaging(client: Client) : Service(client) { ) } + /** + * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param messageId Message ID. + * @param topics List of Topic IDs. + * @param users List of User IDs. + * @param targets List of Targets IDs. + * @param content Email Content. + * @param draft Is message a draft + * @param scheduledAt Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @return [io.appwrite.models.Message] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateSMS( + messageId: String, + topics: List? = null, + users: List? = null, + targets: List? = null, + content: String? = null, + draft: Boolean? = null, + scheduledAt: String? = null, + ): io.appwrite.models.Message { + val apiPath = "/messaging/messages/sms/{messageId}" + .replace("{messageId}", messageId) + + val apiParams = mutableMapOf( + "topics" to topics, + "users" to users, + "targets" to targets, + "content" to content, + "draft" to draft, + "scheduledAt" to scheduledAt, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Message = { + io.appwrite.models.Message.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Message::class.java, + converter, + ) + } + /** * Get a message by its unique ID. + * * * @param messageId Message ID. * @return [io.appwrite.models.Message] @@ -621,6 +736,11 @@ class Messaging(client: Client) : Service(client) { * @param enabled Set as enabled. * @return [io.appwrite.models.Provider] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Messaging.createAPNSProvider` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Messaging.createAPNSProvider"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createApnsProvider( @@ -661,6 +781,59 @@ class Messaging(client: Client) : Service(client) { ) } + /** + * Create a new Apple Push Notification service provider. + * + * @param providerId Provider 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 Provider name. + * @param authKey APNS authentication key. + * @param authKeyId APNS authentication key ID. + * @param teamId APNS team ID. + * @param bundleId APNS bundle ID. + * @param sandbox Use APNS sandbox environment. + * @param enabled Set as enabled. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createAPNSProvider( + providerId: String, + name: String, + authKey: String? = null, + authKeyId: String? = null, + teamId: String? = null, + bundleId: String? = null, + sandbox: Boolean? = null, + enabled: Boolean? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/apns" + + val apiParams = mutableMapOf( + "providerId" to providerId, + "name" to name, + "authKey" to authKey, + "authKeyId" to authKeyId, + "teamId" to teamId, + "bundleId" to bundleId, + "sandbox" to sandbox, + "enabled" to enabled, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Provider = { + io.appwrite.models.Provider.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + /** * Update a Apple Push Notification service provider by its unique ID. * @@ -674,6 +847,11 @@ class Messaging(client: Client) : Service(client) { * @param sandbox Use APNS sandbox environment. * @return [io.appwrite.models.Provider] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Messaging.updateAPNSProvider` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Messaging.updateAPNSProvider"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateApnsProvider( @@ -714,6 +892,59 @@ class Messaging(client: Client) : Service(client) { ) } + /** + * Update a Apple Push Notification service provider by its unique ID. + * + * @param providerId Provider ID. + * @param name Provider name. + * @param enabled Set as enabled. + * @param authKey APNS authentication key. + * @param authKeyId APNS authentication key ID. + * @param teamId APNS team ID. + * @param bundleId APNS bundle ID. + * @param sandbox Use APNS sandbox environment. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateAPNSProvider( + providerId: String, + name: String? = null, + enabled: Boolean? = null, + authKey: String? = null, + authKeyId: String? = null, + teamId: String? = null, + bundleId: String? = null, + sandbox: Boolean? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/apns/{providerId}" + .replace("{providerId}", providerId) + + val apiParams = mutableMapOf( + "name" to name, + "enabled" to enabled, + "authKey" to authKey, + "authKeyId" to authKeyId, + "teamId" to teamId, + "bundleId" to bundleId, + "sandbox" to sandbox, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Provider = { + io.appwrite.models.Provider.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + /** * Create a new Firebase Cloud Messaging provider. * @@ -723,6 +954,11 @@ class Messaging(client: Client) : Service(client) { * @param enabled Set as enabled. * @return [io.appwrite.models.Provider] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Messaging.createFCMProvider` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Messaging.createFCMProvider"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createFcmProvider( @@ -755,6 +991,47 @@ class Messaging(client: Client) : Service(client) { ) } + /** + * Create a new Firebase Cloud Messaging provider. + * + * @param providerId Provider 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 Provider name. + * @param serviceAccountJSON FCM service account JSON. + * @param enabled Set as enabled. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createFCMProvider( + providerId: String, + name: String, + serviceAccountJSON: Any? = null, + enabled: Boolean? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/fcm" + + val apiParams = mutableMapOf( + "providerId" to providerId, + "name" to name, + "serviceAccountJSON" to serviceAccountJSON, + "enabled" to enabled, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Provider = { + io.appwrite.models.Provider.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + /** * Update a Firebase Cloud Messaging provider by its unique ID. * @@ -764,6 +1041,11 @@ class Messaging(client: Client) : Service(client) { * @param serviceAccountJSON FCM service account JSON. * @return [io.appwrite.models.Provider] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Messaging.updateFCMProvider` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Messaging.updateFCMProvider"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateFcmProvider( @@ -796,6 +1078,47 @@ class Messaging(client: Client) : Service(client) { ) } + /** + * Update a Firebase Cloud Messaging provider by its unique ID. + * + * @param providerId Provider ID. + * @param name Provider name. + * @param enabled Set as enabled. + * @param serviceAccountJSON FCM service account JSON. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateFCMProvider( + providerId: String, + name: String? = null, + enabled: Boolean? = null, + serviceAccountJSON: Any? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/fcm/{providerId}" + .replace("{providerId}", providerId) + + val apiParams = mutableMapOf( + "name" to name, + "enabled" to enabled, + "serviceAccountJSON" to serviceAccountJSON, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Provider = { + io.appwrite.models.Provider.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + /** * Create a new Mailgun provider. * @@ -1133,6 +1456,11 @@ class Messaging(client: Client) : Service(client) { * @param enabled Set as enabled. * @return [io.appwrite.models.Provider] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Messaging.createSMTPProvider` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Messaging.createSMTPProvider"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun createSmtpProvider( @@ -1185,6 +1513,77 @@ class Messaging(client: Client) : Service(client) { ) } + /** + * Create a new SMTP provider. + * + * @param providerId Provider 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 Provider name. + * @param host SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param port The default SMTP server port. + * @param username Authentication username. + * @param password Authentication password. + * @param encryption Encryption type. Can be omitted, 'ssl', or 'tls' + * @param autoTLS Enable SMTP AutoTLS feature. + * @param mailer The value to use for the X-Mailer header. + * @param fromName Sender Name. + * @param fromEmail Sender email address. + * @param replyToName Name set in the reply to field for the mail. Default value is sender name. + * @param replyToEmail Email set in the reply to field for the mail. Default value is sender email. + * @param enabled Set as enabled. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createSMTPProvider( + providerId: String, + name: String, + host: String, + port: Long? = null, + username: String? = null, + password: String? = null, + encryption: io.appwrite.enums.SmtpEncryption? = null, + autoTLS: Boolean? = null, + mailer: String? = null, + fromName: String? = null, + fromEmail: String? = null, + replyToName: String? = null, + replyToEmail: String? = null, + enabled: Boolean? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/smtp" + + val apiParams = mutableMapOf( + "providerId" to providerId, + "name" to name, + "host" to host, + "port" to port, + "username" to username, + "password" to password, + "encryption" to encryption, + "autoTLS" to autoTLS, + "mailer" to mailer, + "fromName" to fromName, + "fromEmail" to fromEmail, + "replyToName" to replyToName, + "replyToEmail" to replyToEmail, + "enabled" to enabled, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Provider = { + io.appwrite.models.Provider.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + /** * Update a SMTP provider by its unique ID. * @@ -1204,6 +1603,11 @@ class Messaging(client: Client) : Service(client) { * @param enabled Set as enabled. * @return [io.appwrite.models.Provider] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Messaging.updateSMTPProvider` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Messaging.updateSMTPProvider"), + since = "1.8.0" + ) @JvmOverloads @Throws(AppwriteException::class) suspend fun updateSmtpProvider( @@ -1256,6 +1660,77 @@ class Messaging(client: Client) : Service(client) { ) } + /** + * Update a SMTP provider by its unique ID. + * + * @param providerId Provider ID. + * @param name Provider name. + * @param host SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param port SMTP port. + * @param username Authentication username. + * @param password Authentication password. + * @param encryption Encryption type. Can be 'ssl' or 'tls' + * @param autoTLS Enable SMTP AutoTLS feature. + * @param mailer The value to use for the X-Mailer header. + * @param fromName Sender Name. + * @param fromEmail Sender email address. + * @param replyToName Name set in the Reply To field for the mail. Default value is Sender Name. + * @param replyToEmail Email set in the Reply To field for the mail. Default value is Sender Email. + * @param enabled Set as enabled. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateSMTPProvider( + providerId: String, + name: String? = null, + host: String? = null, + port: Long? = null, + username: String? = null, + password: String? = null, + encryption: io.appwrite.enums.SmtpEncryption? = null, + autoTLS: Boolean? = null, + mailer: String? = null, + fromName: String? = null, + fromEmail: String? = null, + replyToName: String? = null, + replyToEmail: String? = null, + enabled: Boolean? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/smtp/{providerId}" + .replace("{providerId}", providerId) + + val apiParams = mutableMapOf( + "name" to name, + "host" to host, + "port" to port, + "username" to username, + "password" to password, + "encryption" to encryption, + "autoTLS" to autoTLS, + "mailer" to mailer, + "fromName" to fromName, + "fromEmail" to fromEmail, + "replyToName" to replyToName, + "replyToEmail" to replyToEmail, + "enabled" to enabled, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Provider = { + io.appwrite.models.Provider.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + /** * Create a new Telesign provider. * @@ -1634,6 +2109,7 @@ class Messaging(client: Client) : Service(client) { /** * Get a provider by its unique ID. + * * * @param providerId Provider ID. * @return [io.appwrite.models.Provider] @@ -1831,6 +2307,7 @@ class Messaging(client: Client) : Service(client) { /** * Get a topic by its unique ID. + * * * @param topicId Topic ID. * @return [io.appwrite.models.Topic] @@ -1861,6 +2338,7 @@ class Messaging(client: Client) : Service(client) { /** * Update a topic by its unique ID. + * * * @param topicId Topic ID. * @param name Topic Name. @@ -2034,6 +2512,7 @@ class Messaging(client: Client) : Service(client) { /** * Get a subscriber by its unique ID. + * * * @param topicId Topic ID. The topic ID subscribed to. * @param subscriberId Subscriber ID. diff --git a/src/main/kotlin/io/appwrite/services/Sites.kt b/src/main/kotlin/io/appwrite/services/Sites.kt index 07aff05..171a6d9 100644 --- a/src/main/kotlin/io/appwrite/services/Sites.kt +++ b/src/main/kotlin/io/appwrite/services/Sites.kt @@ -16,7 +16,7 @@ import java.io.File class Sites(client: Client) : Service(client) { /** - * Get a list of all the project's sites. You can use the query params to filter your results. + * Get a list of all the project's sites. You can use the query params to filter your results. * * @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, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId * @param search Search term to filter your list results. Max length: 256 chars. @@ -361,7 +361,7 @@ class Sites(client: Client) : Service(client) { } /** - * Get a list of all the site's code deployments. You can use the query params to filter your results. + * Get a list of all the site's code deployments. You can use the query params to filter your results. * * @param siteId Site 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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type @@ -398,7 +398,7 @@ class Sites(client: Client) : Service(client) { } /** - * Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the function's deployment to use your new deployment ID. + * Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the function's deployment to use your new deployment ID. * * @param siteId Site ID. * @param code Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. @@ -450,7 +450,7 @@ class Sites(client: Client) : Service(client) { } /** - * Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + * Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. * * @param siteId Site ID. * @param deploymentId Deployment ID. @@ -484,7 +484,9 @@ class Sites(client: Client) : Service(client) { } /** - * Create a deployment based on a template.Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details. + * Create a deployment based on a template. + * + * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details. * * @param siteId Site ID. * @param repository Repository name of the template. @@ -531,7 +533,9 @@ class Sites(client: Client) : Service(client) { } /** - * Create a deployment when a site is connected to VCS.This endpoint lets you create deployment from a branch, commit, or a tag. + * Create a deployment when a site is connected to VCS. + * + * This endpoint lets you create deployment from a branch, commit, or a tag. * * @param siteId Site ID. * @param type Type of reference passed. Allowed values are: branch, commit @@ -635,7 +639,7 @@ class Sites(client: Client) : Service(client) { } /** - * Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + * Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. * * @param siteId Site ID. * @param deploymentId Deployment ID. @@ -667,7 +671,7 @@ class Sites(client: Client) : Service(client) { } /** - * Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + * Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. * * @param siteId Site ID. * @param deploymentId Deployment ID. diff --git a/src/main/kotlin/io/appwrite/services/Storage.kt b/src/main/kotlin/io/appwrite/services/Storage.kt index f319359..c1cad5e 100644 --- a/src/main/kotlin/io/appwrite/services/Storage.kt +++ b/src/main/kotlin/io/appwrite/services/Storage.kt @@ -262,7 +262,14 @@ class Storage(client: Client) : Service(client) { } /** - * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console.Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. + * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. + * + * Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes. + * + * When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one. + * + * If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. + * * * @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 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. @@ -412,7 +419,7 @@ class Storage(client: Client) : Service(client) { } /** - * Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + * Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. * * @param bucketId Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). * @param fileId File ID. @@ -509,7 +516,7 @@ class Storage(client: Client) : Service(client) { } /** - * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. + * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. * * @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 ID. diff --git a/src/main/kotlin/io/appwrite/services/TablesDb.kt b/src/main/kotlin/io/appwrite/services/TablesDb.kt new file mode 100644 index 0000000..a8229df --- /dev/null +++ b/src/main/kotlin/io/appwrite/services/TablesDb.kt @@ -0,0 +1,2408 @@ +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 + +/** + * +**/ +class TablesDB(client: Client) : Service(client) { + + /** + * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. + * + * @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 columns: name + * @param search Search term to filter your list results. Max length: 256 chars. + * @return [io.appwrite.models.DatabaseList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun list( + queries: List? = null, + search: String? = null, + ): io.appwrite.models.DatabaseList { + val apiPath = "/tablesdb" + + val apiParams = mutableMapOf( + "queries" to queries, + "search" to search, + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.DatabaseList = { + io.appwrite.models.DatabaseList.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.DatabaseList::class.java, + converter, + ) + } + + /** + * Create a new Database. + * + * + * @param databaseId 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 Database name. Max length: 128 chars. + * @param enabled Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + * @return [io.appwrite.models.Database] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun create( + databaseId: String, + name: String, + enabled: Boolean? = null, + ): io.appwrite.models.Database { + val apiPath = "/tablesdb" + + val apiParams = mutableMapOf( + "databaseId" to databaseId, + "name" to name, + "enabled" to enabled, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Database = { + io.appwrite.models.Database.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Database::class.java, + converter, + ) + } + + /** + * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. + * + * @param databaseId Database ID. + * @return [io.appwrite.models.Database] + */ + @Throws(AppwriteException::class) + suspend fun get( + databaseId: String, + ): io.appwrite.models.Database { + val apiPath = "/tablesdb/{databaseId}" + .replace("{databaseId}", databaseId) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.Database = { + io.appwrite.models.Database.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Database::class.java, + converter, + ) + } + + /** + * Update a database by its unique ID. + * + * @param databaseId Database ID. + * @param name Database name. Max length: 128 chars. + * @param enabled Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + * @return [io.appwrite.models.Database] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun update( + databaseId: String, + name: String, + enabled: Boolean? = null, + ): io.appwrite.models.Database { + val apiPath = "/tablesdb/{databaseId}" + .replace("{databaseId}", databaseId) + + val apiParams = mutableMapOf( + "name" to name, + "enabled" to enabled, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Database = { + io.appwrite.models.Database.from(map = it as Map) + } + return client.call( + "PUT", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Database::class.java, + converter, + ) + } + + /** + * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. + * + * @param databaseId Database ID. + * @return [Any] + */ + @Throws(AppwriteException::class) + suspend fun delete( + databaseId: String, + ): Any { + val apiPath = "/tablesdb/{databaseId}" + .replace("{databaseId}", databaseId) + + 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 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 columns: 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 listTables( + databaseId: String, + queries: List? = null, + search: String? = null, + ): io.appwrite.models.TableList { + val apiPath = "/tablesdb/{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/tablesdb#tablesDBCreateTable) 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 createTable( + databaseId: String, + tableId: String, + name: String, + permissions: List? = null, + rowSecurity: Boolean? = null, + enabled: Boolean? = null, + ): io.appwrite.models.Table { + val apiPath = "/tablesdb/{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 getTable( + databaseId: String, + tableId: String, + ): io.appwrite.models.Table { + val apiPath = "/tablesdb/{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 updateTable( + databaseId: String, + tableId: String, + name: String, + permissions: List? = null, + rowSecurity: Boolean? = null, + enabled: Boolean? = null, + ): io.appwrite.models.Table { + val apiPath = "/tablesdb/{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 deleteTable( + databaseId: String, + tableId: String, + ): Any { + val apiPath = "/tablesdb/{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 columns in the table. + * + * @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 columns: 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 = "/tablesdb/{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/tablesdb#tablesDBCreate). + * @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 = "/tablesdb/{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/tablesdb#tablesDBCreate). + * @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 = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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/tablesdb#tablesDBCreate). + * @param key Column Key. + * @param size Column size for text columns, 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 = "/tablesdb/{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/tablesdb#tablesDBCreate). + * @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 = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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 on the table. + * + * @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/tablesdb#tablesDBCreate). + * @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 columns: 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 = "/tablesdb/{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 columns listed. Your index should include all the columns you will query in a single request. + * Type can be `key`, `fulltext`, or `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/tablesdb#tablesDBCreate). + * @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 = "/tablesdb/{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/tablesdb#tablesDBCreate). + * @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 = "/tablesdb/{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/tablesdb#tablesDBCreate). + * @param key Index Key. + * @return [Any] + */ + @Throws(AppwriteException::class) + suspend fun deleteIndex( + databaseId: String, + tableId: String, + key: String, + ): Any { + val apiPath = "/tablesdb/{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 TableDB service [server integration](https://appwrite.io/docs/server/tablesdbdb#tablesdbCreate). + * @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 = "/tablesdb/{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 TableDB service [server integration](https://appwrite.io/docs/server/tablesdbdb#tablesdbCreate). + * @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/tablesdb#tablesDBCreateTable) 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/tablesdb#tablesDBCreate). 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 = "/tablesdb/{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/tablesdb#tablesDBCreateTable) 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/tablesdb#tablesDBCreate). 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/tablesdb#tablesDBCreateTable) 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/tablesdb#tablesDBCreate). 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 = "/tablesdb/{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/tablesdb#tablesDBCreateTable) 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/tablesdb#tablesDBCreate). 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/tablesdb#tablesDBCreateTable) API or directly from your database console. + * + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param rows Array of row data as JSON objects. May contain partial rows. + * @return [io.appwrite.models.RowList] + */ + @Throws(AppwriteException::class) + suspend fun upsertRows( + databaseId: String, + tableId: String, + rows: List, + nestedType: Class, + ): io.appwrite.models.RowList { + val apiPath = "/tablesdb/{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( + "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/tablesdb#tablesDBCreateTable) API or directly from your database console. + * + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param rows Array of row data as JSON objects. May contain partial rows. + * @return [io.appwrite.models.RowList] + */ + @Throws(AppwriteException::class) + suspend fun upsertRows( + databaseId: String, + tableId: String, + rows: List, + ): io.appwrite.models.RowList> = upsertRows( + databaseId, + tableId, + rows, + 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 = "/tablesdb/{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/tablesdb#tablesDBCreate). + * @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 = "/tablesdb/{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/tablesdb#tablesDBCreate). + * @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/tablesdb#tablesDBCreate). + * @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 = "/tablesdb/{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/tablesdb#tablesDBCreate). + * @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/tablesdb#tablesDBCreateTable) API or directly from your database console. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param rowId Row ID. + * @param data Row data as JSON object. Include all required columns of the row 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.Row] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun upsertRow( + databaseId: String, + tableId: String, + rowId: String, + data: Any? = null, + permissions: List? = null, + nestedType: Class, + ): io.appwrite.models.Row { + val apiPath = "/tablesdb/{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( + "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/tablesdb#tablesDBCreateTable) API or directly from your database console. + * + * @param databaseId Database ID. + * @param tableId Table ID. + * @param rowId Row ID. + * @param data Row data as JSON object. Include all required columns of the row 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.Row] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun upsertRow( + databaseId: String, + tableId: String, + rowId: String, + data: Any? = null, + permissions: List? = null, + ): io.appwrite.models.Row> = upsertRow( + databaseId, + tableId, + rowId, + data, + permissions, + 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 = "/tablesdb/{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/tablesdb#tablesDBCreate). + * @param rowId Row ID. + * @return [Any] + */ + @Throws(AppwriteException::class) + suspend fun deleteRow( + databaseId: String, + tableId: String, + rowId: String, + ): Any { + val apiPath = "/tablesdb/{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 = "/tablesdb/{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 = "/tablesdb/{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 diff --git a/src/main/kotlin/io/appwrite/services/Teams.kt b/src/main/kotlin/io/appwrite/services/Teams.kt index 9d601ab..923a01b 100644 --- a/src/main/kotlin/io/appwrite/services/Teams.kt +++ b/src/main/kotlin/io/appwrite/services/Teams.kt @@ -172,7 +172,7 @@ class Teams(client: Client) : Service(client) { ) /** - * Update the team's name by its unique ID. + * Update the team's name by its unique ID. * * @param teamId Team ID. * @param name New team name. Max length: 128 chars. @@ -207,7 +207,7 @@ class Teams(client: Client) : Service(client) { } /** - * Update the team's name by its unique ID. + * Update the team's name by its unique ID. * * @param teamId Team ID. * @param name New team name. Max length: 128 chars. @@ -251,7 +251,7 @@ class Teams(client: Client) : Service(client) { } /** - * Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. + * Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. * * @param teamId Team 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: userId, teamId, invited, joined, confirm, roles @@ -288,7 +288,14 @@ class Teams(client: Client) : Service(client) { } /** - * Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team.You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters.Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. + * Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team. + * + * You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. + * + * Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. + * + * Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. + * * * @param teamId Team ID. * @param roles Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. @@ -372,6 +379,7 @@ class Teams(client: Client) : Service(client) { /** * Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). + * * * @param teamId Team ID. * @param membershipId Membership ID. @@ -438,7 +446,10 @@ class Teams(client: Client) : Service(client) { } /** - * Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user.If the request is successful, a session for the user is automatically created. + * Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user. + * + * If the request is successful, a session for the user is automatically created. + * * * @param teamId Team ID. * @param membershipId Membership ID. @@ -478,7 +489,7 @@ class Teams(client: Client) : Service(client) { } /** - * Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). + * Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). * * @param teamId Team ID. * @return [io.appwrite.models.Preferences] @@ -509,7 +520,7 @@ class Teams(client: Client) : Service(client) { } /** - * Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). + * Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). * * @param teamId Team ID. * @return [io.appwrite.models.Preferences] @@ -523,7 +534,7 @@ class Teams(client: Client) : Service(client) { ) /** - * Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. + * Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. * * @param teamId Team ID. * @param prefs Prefs key-value JSON object. @@ -558,7 +569,7 @@ class Teams(client: Client) : Service(client) { } /** - * Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. + * Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. * * @param teamId Team ID. * @param prefs Prefs key-value JSON object. diff --git a/src/main/kotlin/io/appwrite/services/Tokens.kt b/src/main/kotlin/io/appwrite/services/Tokens.kt index 7e485bd..088b069 100644 --- a/src/main/kotlin/io/appwrite/services/Tokens.kt +++ b/src/main/kotlin/io/appwrite/services/Tokens.kt @@ -119,7 +119,7 @@ class Tokens(client: Client) : Service(client) { } /** - * Update a token by its unique ID. Use this endpoint to update a token's expiry date. + * Update a token by its unique ID. Use this endpoint to update a token's expiry date. * * @param tokenId Token unique ID. * @param expire File token expiry date diff --git a/src/main/kotlin/io/appwrite/services/Users.kt b/src/main/kotlin/io/appwrite/services/Users.kt index 549e858..9af250d 100644 --- a/src/main/kotlin/io/appwrite/services/Users.kt +++ b/src/main/kotlin/io/appwrite/services/Users.kt @@ -14,7 +14,7 @@ import java.io.File class Users(client: Client) : Service(client) { /** - * Get a list of all the project's users. You can use the query params to filter your results. + * Get a list of all the project's users. You can use the query params to filter your results. * * @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 search Search term to filter your list results. Max length: 256 chars. @@ -49,7 +49,7 @@ class Users(client: Client) : Service(client) { } /** - * Get a list of all the project's users. You can use the query params to filter your results. + * Get a list of all the project's users. You can use the query params to filter your results. * * @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 search Search term to filter your list results. Max length: 256 chars. @@ -761,7 +761,7 @@ class Users(client: Client) : Service(client) { ) /** - * Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. + * Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. * * @param userId User ID. * @return [Any] @@ -878,7 +878,9 @@ class Users(client: Client) : Service(client) { } /** - * Update the user labels by its unique ID. Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. + * Update the user labels by its unique ID. + * + * Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. * * @param userId User ID. * @param labels Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. @@ -913,7 +915,9 @@ class Users(client: Client) : Service(client) { } /** - * Update the user labels by its unique ID. Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. + * Update the user labels by its unique ID. + * + * Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. * * @param userId User ID. * @param labels Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. @@ -1007,6 +1011,11 @@ class Users(client: Client) : Service(client) { * @param mfa Enable or disable MFA. * @return [io.appwrite.models.User] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Users.updateMFA` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Users.updateMFA"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun updateMfa( userId: String, @@ -1042,6 +1051,11 @@ class Users(client: Client) : Service(client) { * @param mfa Enable or disable MFA. * @return [io.appwrite.models.User] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Users.updateMFA` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Users.updateMFA"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun updateMfa( userId: String, @@ -1052,6 +1066,58 @@ class Users(client: Client) : Service(client) { nestedType = classOf(), ) + /** + * Enable or disable MFA on a user account. + * + * @param userId User ID. + * @param mfa Enable or disable MFA. + * @return [io.appwrite.models.User] + */ + @Throws(AppwriteException::class) + suspend fun updateMFA( + userId: String, + mfa: Boolean, + nestedType: Class, + ): io.appwrite.models.User { + val apiPath = "/users/{userId}/mfa" + .replace("{userId}", userId) + + val apiParams = mutableMapOf( + "mfa" to mfa, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.User = { + io.appwrite.models.User.from(map = it as Map, nestedType) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Enable or disable MFA on a user account. + * + * @param userId User ID. + * @param mfa Enable or disable MFA. + * @return [io.appwrite.models.User] + */ + @Throws(AppwriteException::class) + suspend fun updateMFA( + userId: String, + mfa: Boolean, + ): io.appwrite.models.User> = updateMFA( + userId, + mfa, + nestedType = classOf(), + ) + /** * Delete an authenticator app. * @@ -1059,6 +1125,11 @@ class Users(client: Client) : Service(client) { * @param type Type of authenticator. * @return [Any] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Users.deleteMFAAuthenticator` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Users.deleteMFAAuthenticator"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun deleteMfaAuthenticator( userId: String, @@ -1082,12 +1153,47 @@ class Users(client: Client) : Service(client) { ) } + /** + * Delete an authenticator app. + * + * @param userId User ID. + * @param type Type of authenticator. + * @return [Any] + */ + @Throws(AppwriteException::class) + suspend fun deleteMFAAuthenticator( + userId: String, + type: io.appwrite.enums.AuthenticatorType, + ): Any { + val apiPath = "/users/{userId}/mfa/authenticators/{type}" + .replace("{userId}", userId) + .replace("{type}", type.value) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + /** * List the factors available on the account to be used as a MFA challange. * * @param userId User ID. * @return [io.appwrite.models.MfaFactors] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Users.listMFAFactors` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Users.listMFAFactors"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun listMfaFactors( userId: String, @@ -1112,12 +1218,47 @@ class Users(client: Client) : Service(client) { ) } + /** + * List the factors available on the account to be used as a MFA challange. + * + * @param userId User ID. + * @return [io.appwrite.models.MfaFactors] + */ + @Throws(AppwriteException::class) + suspend fun listMFAFactors( + userId: String, + ): io.appwrite.models.MfaFactors { + val apiPath = "/users/{userId}/mfa/factors" + .replace("{userId}", userId) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.MfaFactors = { + io.appwrite.models.MfaFactors.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MfaFactors::class.java, + converter, + ) + } + /** * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. * * @param userId User ID. * @return [io.appwrite.models.MfaRecoveryCodes] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Users.getMFARecoveryCodes` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Users.getMFARecoveryCodes"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun getMfaRecoveryCodes( userId: String, @@ -1142,12 +1283,47 @@ class Users(client: Client) : Service(client) { ) } + /** + * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param userId User ID. + * @return [io.appwrite.models.MfaRecoveryCodes] + */ + @Throws(AppwriteException::class) + suspend fun getMFARecoveryCodes( + userId: String, + ): io.appwrite.models.MfaRecoveryCodes { + val apiPath = "/users/{userId}/mfa/recovery-codes" + .replace("{userId}", userId) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + ) + val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { + io.appwrite.models.MfaRecoveryCodes.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MfaRecoveryCodes::class.java, + converter, + ) + } + /** * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. * * @param userId User ID. * @return [io.appwrite.models.MfaRecoveryCodes] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Users.updateMFARecoveryCodes` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Users.updateMFARecoveryCodes"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun updateMfaRecoveryCodes( userId: String, @@ -1173,12 +1349,48 @@ class Users(client: Client) : Service(client) { ) } + /** + * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param userId User ID. + * @return [io.appwrite.models.MfaRecoveryCodes] + */ + @Throws(AppwriteException::class) + suspend fun updateMFARecoveryCodes( + userId: String, + ): io.appwrite.models.MfaRecoveryCodes { + val apiPath = "/users/{userId}/mfa/recovery-codes" + .replace("{userId}", userId) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { + io.appwrite.models.MfaRecoveryCodes.from(map = it as Map) + } + return client.call( + "PUT", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MfaRecoveryCodes::class.java, + converter, + ) + } + /** * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. * * @param userId User ID. * @return [io.appwrite.models.MfaRecoveryCodes] */ + @Deprecated( + message = "This API has been deprecated since 1.8.0. Please use `Users.createMFARecoveryCodes` instead.", + replaceWith = ReplaceWith("io.appwrite.services.Users.createMFARecoveryCodes"), + since = "1.8.0" + ) @Throws(AppwriteException::class) suspend fun createMfaRecoveryCodes( userId: String, @@ -1204,6 +1416,37 @@ class Users(client: Client) : Service(client) { ) } + /** + * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. + * + * @param userId User ID. + * @return [io.appwrite.models.MfaRecoveryCodes] + */ + @Throws(AppwriteException::class) + suspend fun createMFARecoveryCodes( + userId: String, + ): io.appwrite.models.MfaRecoveryCodes { + val apiPath = "/users/{userId}/mfa/recovery-codes" + .replace("{userId}", userId) + + val apiParams = mutableMapOf( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { + io.appwrite.models.MfaRecoveryCodes.from(map = it as Map) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MfaRecoveryCodes::class.java, + converter, + ) + } + /** * Update the user name by its unique ID. * @@ -1488,7 +1731,9 @@ class Users(client: Client) : Service(client) { } /** - * Creates a session for a user. Returns an immediately usable session object.If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. + * Creates a session for a user. Returns an immediately usable session object. + * + * If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. * * @param userId User 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. * @return [io.appwrite.models.Session] @@ -1519,7 +1764,7 @@ class Users(client: Client) : Service(client) { } /** - * Delete all user's sessions by using the user's unique ID. + * Delete all user's sessions by using the user's unique ID. * * @param userId User ID. * @return [Any] @@ -1576,7 +1821,7 @@ class Users(client: Client) : Service(client) { } /** - * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. + * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. * * @param userId User ID. * @param status User Status. To activate the user pass `true` and to block the user pass `false`. @@ -1611,7 +1856,7 @@ class Users(client: Client) : Service(client) { } /** - * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. + * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. * * @param userId User ID. * @param status User Status. To activate the user pass `true` and to block the user pass `false`. @@ -1709,7 +1954,7 @@ class Users(client: Client) : Service(client) { } /** - * Get a user's push notification target by ID. + * Get a user's push notification target by ID. * * @param userId User ID. * @param targetId Target ID. @@ -1817,6 +2062,7 @@ class Users(client: Client) : Service(client) { /** * Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. + * * * @param userId User ID. * @param length Token length in characters. The default length is 6 characters